HuntIQ Tradecraft: Why php2shell Is Real and Still Hard to Exploit

HuntIQ Tradecraft: Why php2shell Is Real and Still Hard to Exploit

php2shell, the pair of PHP core flaws disclosed on October 21, 2026 as CVE-2026-109618 and CVE-2026-109619, arrived with the loudest possible framing: a flaw in software that runs most of the web, a leaked disclosure, a pulled-forward patch, and exploitation attempts in honeypots before the fix existed. It also arrived with a quieter counter-current: researcher after researcher reporting that the public exploits did not actually work in their environments. Both things are true at once, and the gap between them is where defenders have to make decisions.

HuntIQ set out to settle the question in a lab rather than from headlines. We reproduced both exploit chains against an unpatched PHP build, then reproduced the attack the way a real internet attacker would have to, over HTTP alone, and separately pressure-tested PHP's fix. This post abstracts that work. It deliberately carries no proof-of-concept code, no memory offsets, and no payload construction; the point is the findings and what they mean, not a recipe.

Key takeaways

  • Both php2shell chains are real: against an unpatched PHP 8.5.11 Apache build we reached command execution as the web service account.

  • We then drove the stale-state flaw to code execution over HTTP alone, defeating address randomization with an in-band memory leak, and it worked against two separately started Apache processes with different memory layouts. No public proof-of-concept had shown that.

  • Getting there took original research the public exploits did not have, and it stays tied to one build, one architecture and a specific configuration. "Hard to exploit" means it takes a capable attacker, not that it is safe.

  • The PHP 8.5.12 fix held against every path we tested, including a direct attempt at the session-state flaw, with no bypass demonstrated.

  • The fix works by freeing and reinitializing the request state the attack relied on; on the unpatched build that same state survived into the next request and crashed the worker.

What php2shell is, in one paragraph

Both flaws trace to the same behavior: when PHP aborts a request on a fatal error, including running out of memory, it can leave request-owned state in a condition that later code trusts. CVE-2026-109618 is the case where that happens mid-parse and request cleanup walks the half-finished state. CVE-2026-109619 is the case where state from a failed request survives into the next request on the same worker, reached most easily through session upload progress, which is enabled by default. Either can end in remote code execution as the web service account, and on Apache's bundled PHP module the whole thing is reachable before any application code runs. PHP's advisories are the authoritative descriptions (CVE-2026-109618, CVE-2026-109619).

How we tested

We built two targets from official images: an unpatched PHP 8.5.11 Apache container and the patched PHP 8.5.12. Both ran mod_php on a single Apache worker on x86-64, the most exploitation-friendly configuration public researchers describe. Against the unpatched build we ran the public chains and our own variations. Against the patched build we ran the same chains, a set of adjacent code paths the advisories point to, and a direct test of the session-state flaw. Where we needed to see what the fix actually did, we observed the worker's internal state during a request rather than inferring it from the response, and we read those observations against the unpatched build as a control.

Two disciplines shaped the work. First, exploitation stayed on an isolated lab host and nothing here reproduces working exploit code. Second, a negative result only ever means "these requests, this build, this configuration," never a clean bill of health for the patch. We scored our own coverage of the published mechanism and the patched paths at 8 out of 10, with the missing two points accounting for configurations we did not exhaust: other server interfaces, other architectures, other encodings, and the full space of memory layouts.

What we found

Both chains are real on the unpatched build

Against PHP 8.5.11 we reached command execution as the web service account through both the out-of-memory corruption path and the stale-state path. This is not in doubt, and it is why the patch is a genuine emergency for any exposed, unpatched PHP: the flaw is pre-authentication and it executes before application code, so application-level controls never see it.

Reproducing the remote path took original research

Our first pass matched the public experience. The chains we could run depended on memory addresses read from inside the lab, and an early attempt to run the attack end to end over HTTP alone, with no inside knowledge of the target's memory, did not get a usable leak. That is where most public work stopped too. VulnCheck reported that none of the hundreds of public proof-of-concept repositories defeats address-space layout randomization on x86-64 on its own (VulnCheck). Two independent researchers published detailed non-reproductions across FPM, LiteSpeed and mod_php, one even with debugger-supplied addresses (0x4148, tanahiro2010). Fastly described the existing exploits as x86-64-only and dependent on the exact binary and memory layout (Fastly). SANS called the circulating proof-of-concept unreliable and incomplete (SANS ISC), and PHP's own security team found no functional exploits among the post-leak proofs-of-concept at release (PHP Foundation).

We did not stop there, and this is the result that changes the threat assessment. By studying how the stale-state flaw leaves request-owned data behind, we found a way to make that leftover state line up with a session structure so that PHP returns live process memory in the session cookie: an in-band disclosure that hands the client both a library code pointer and heap pointers. From those, the exploit computes the randomized base addresses it needs entirely from the HTTP response, and then drives the known destructor-based primitive to a command. We ran it as a controlled pair: a null target that executed nothing and left no marker, and a live target that wrote a marker owned by the web service account and faulted the worker, which Apache then replaced. It succeeded against two separately started Apache processes whose memory was laid out differently, with no debugger or process inspection anywhere in the delivery path. We used privileged inspection only afterward, to confirm the exploit's own calculations.

That is the "one good address leak" the reliability discussion keeps circling, and it is the piece the public tooling was missing. It did not come for free. It took original analysis of how the leftover state overlaps the session data, and the addresses it produces are specific to the one pinned 8.5.11 image we studied, so the exact chain does not transfer to another build unchanged. We are deliberately not publishing the leak construction. The point for defenders is the conclusion, not the method: address randomization is not a backstop against this flaw, and the failure of public proofs-of-concept describes those proofs-of-concept, not whether the flaw can be exploited remotely.

By contrast, the out-of-memory branch (CVE-2026-109618) reached a command in our lab only with a non-default allocator and debugger-calibrated addresses, and we passed a full control ladder to confirm it was genuine. We did not drive that branch over HTTP alone, so we classify it as lab-assisted, not remote. The remote result above is the stale-state branch (CVE-2026-109619).

The patch holds in the paths we tested

Against PHP 8.5.12 the chains that worked on 8.5.11 returned normally or produced a handled, ordinary memory-limit error. The proof-of-execution marker never appeared. We also tried the session-state flaw directly: we drove a request all the way into PHP's explicit request-body parser carrying the kind of forged state the attack relies on, and the parser read the fields without ever treating the forged data as a live object. No variation we tried produced a bypass.

The most informative test watched the fix work. The stale-state flaw depends on one specific piece of request state, the upload-progress structure, surviving from a failed request into the next one. On the patched build, after we forced the failure, that structure was cleared before the next request's handler ran: the pointer to it was empty at the start of the next request, and the next request built its own. On the unpatched build, under the same sequence, that pointer was still populated after the failed request, and when the follow-up request ran, the worker aborted with a heap-corruption error and the child process was replaced. The difference is the patch: PHP 8.5.12 frees that state on the way out of the failed request and reinitializes it on the way into the next one, closing the window the attack needs. We found no path around that in the configurations we tested.

Where our findings depart from current reporting

Four places are worth calling out for the research community, because getting them wrong changes what defenders do.

A reliable in-band ASLR defeat is achievable, where the public record implied it was not. The prevailing public read, anchored by VulnCheck, was that no x86-64 proof-of-concept defeats address randomization on its own. Our HTTP-only result shows that a purpose-built in-band leak does exactly that on the configuration we studied, so the gap between an unreliable public exploit and a working one was a leak technique, and it was findable. Treat the public failure rate as a head start on the attacker, not a safety margin.

The heap-corruption error is not a reliable exploitation signal on patched builds. "zend_mm_heap corrupted" circulated early as a thing to hunt for, and on our unpatched control it was exactly the genuine corruption signature the stale-state failure produced. But the same string appears on patched 8.4.27 and 8.5.12 from an unrelated memory-management regression in SimpleXML garbage collection (php-src #24488), and a large hosting provider that logged hundreds of real attack requests reported seeing zero heap-corruption errors tied to them (InstaWP). So on a patched fleet, this error is more likely to be the SimpleXML regression than an attack. Hunt the behavior that follows code execution, as the companion post does, and treat the heap-corruption string as context with a known benign source, not as a detection.

The severity scores do not agree, and the spread is informative. PHP, as the numbering authority, scored both flaws CVSS 9.2 under version 4.0, and the PHP Foundation stated plainly that a leaked 10.0 figure was wrong. NVD reportedly carries 9.8 under the older 3.1 scale, while Red Hat and SUSE score 8.1 under 3.1, and SANS cited 9.4. The lower vendor scores are not disagreement about impact; they reflect the attack complexity we and others measured, which the 4.0 and 3.1 vectors capture differently. For prioritization, the number to act on is not the highest one in a headline but the exposure in your own environment.

The condition matters more than the version number. Our reproduction, like the public reports, worked on mod_php with a single worker. PHP's advisory says the stale-state path also reaches PHP-FPM, but Red Hat notes that the default FPM configuration, where workers exit on early failure, makes reliable exploitation difficult in practice (Red Hat). Internet-facing mod_php is the thing to patch first, and worker count, architecture and error-display settings move a host's real exposure as much as its version string does.

What this means for defenders and leadership

Patch, and prioritize by condition rather than by the CVSS headline. An internet-facing Apache host running mod_php is the urgent case; a PHP-FPM service behind a frontend, on a patched or backported build, is a lower one. The fix is sound in the paths we and the broader community have examined, so the work is operational: find every copy of PHP, including the ones a version scan misses, and update and restart the workers. That is what the companion post and the Guardian dashboard are for.

Do not let "the public exploits are unreliable" become "this can be deprioritized." Unreliable is not safe. Exploitation attempts started before the patch, the flaw is pre-authentication, and the reliability barrier is an attacker-skill problem that a better exploit erodes over time, not a property of the flaw itself. The difference between unreliable and reliable exploitation is usually one good address leak, and in our lab that leak was not hypothetical: we built it.

One concrete signal falls out of that leak. When the in-band disclosure works, the server returns process memory inside the session cookie, so a Set-Cookie: PHPSESSID= value that is not 32 lowercase hexadecimal characters, or that is unusually long, is a possible sign of a memory read in progress (Wiz). It is a web-tier signal rather than an endpoint one, so it belongs in proxy or WAF logging alongside the request-shape rules, and it pairs with the endpoint behavior hunt in the companion post.

What we did not test

The HTTP-only result covers mod_php on a single prefork worker, x86-64, one pinned PHP 8.5.11 image, a 16 MiB memory limit, and session upload progress on. The addresses it derives are specific to that image, so the chain does not transfer to another build, architecture, server interface, or worker configuration without new research. We did not drive the out-of-memory branch over HTTP, we did not test PHP-FPM, FrankenPHP or LiteSpeed for the remote chain, and we did not exhaust parser states or transfer encodings. The patch testing is covered separately and attacked no 8.5.12 target in this focused run. A reliable remote chain on a configuration we did not cover, or a future bypass of the patch, would not contradict what we found; it would extend it. We will update this post if our own follow-up work or credible public research changes the picture.

References

About HuntIQ

HuntIQ is Tanium's threat hunting practice. Our hunters go hands-on-keyboard in customer environments, running hunt campaigns against live telemetry, triaging what surfaces, pivoting from one endpoint to the whole estate, and escalating with the evidence already attached. Alongside that we build the durable content behind it, the Signals, hunt packages, and recurring hunts your own analysts can run without us.