You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Type confusion in zend_assign_to_string_offset() leads to RCE (PHP 8.6.0) #25637
PHP 8.6.0 (official Windows NTS x64 build, 18/11/2026) has a type confusion in the string offset write path.
zend_assign_to_string_offset() keeps the string alive with GC_ADDREF, but it does not revalidate the container zval after the user error handler runs. If the handler keeps the old string alive and replaces the container with a Closure, the engine writes Z_STRVAL_P(str)[offset] = c into obj+24+offset. Offsets 32 and 120..127 overwrite func.type and func.internal_function.handler, so calling the closure runs zif_system.
On the official 8.6.0 build it prints RCE_PROOF and the current user, exit 0. The RVAs are for this build: zval_ptr_dtor 0x23F60, zif_system 0x26AD60.
This is not fixed by febae1cbfd (GH-25329), which only touches the read path and the JIT read helper.
I know SECURITY.md classifies malicious error handlers as "bugs, not security issues", so I am reporting this as an engine bug, not asking for a CVE.
A related variant: with $s = &$a, the zend_reference is not kept alive either; the handler can free it and the engine writes through the stale pointer (zend_execute.c:2199), giving a write-what-where.
Suggested fix: revalidate Z_TYPE_P(str) == IS_STRING after the callback, like the array fix in 62bec0e083.
Activity
Girgias commentedon Nov 20, 2026
This seems very much related to #20018
ndossche commentedon Nov 21, 2026
This is known, closing as duplicate.