TL;DR
TL;DR
- PHP2Shell (CVE-2026-109618 and CVE-2026-109619, both CVSS v4.0 9.2) is a pair of memory-corruption flaws in PHP’s core engine that can allow unauthenticated remote code execution.
- Patching PHP (8.5.12, 8.4.27, 8.3.36, or 8.2.35) is the only complete fix. Prioritize internet-facing systems and apply PHP’s interim mitigations while you update.
- Signature-based WAFs struggle because the attack spans a producer request and a consumer request, and neither looks malicious on its own.
- Stateful, programmable Layer 7 rules can correlate behavior across requests and responses to reduce exposure while you patch, but they don’t replace the upgrade.
- Ask your WAF vendor whether you can run custom logic, correlate across requests, test against your own traffic, and deploy safely.
PHP2Shell (CVE-2026-109618 and CVE-2026-109619) has security teams racing to assess exposure, patch systems, and deploy mitigations. Discovered by Wiz, the vulnerabilities affect PHP’s core engine and can allow unauthenticated remote code execution. Both carry a CVSS v4.0 score of 9.2.
The bugs sit inside PHP, in memory handling and internal state. That puts them below the application and outside the injection patterns WAFs were built to recognize. An application can follow secure coding practices, run OWASP Top 10 protections, and still be vulnerable.
Key facts for CVE-2026-109619, the stale-state flaw:
- Severity: Critical, CVSS 4.0 score 9.2
- Weakness: CWE-416, CWE-755, CWE-824, CWE-1325, CWE-1419
- Affected: PHP before 8.2.35, 8.3.36, 8.4.27, and 8.5.12
- Impact: Unauthenticated use-after-free, memory disclosure, RCE as the web worker
- Related: CVE-2026-109618, the sibling flaw
Frontier AI models also helped researchers find the vulnerabilities and build exploit chains in software that has been deployed widely for years. Discovery is getting faster. Can application defenses keep pace?
If you run PHP, start here
PHP has shipped fixes, and patching comes first. Teams running hundreds or thousands of applications need time to update every affected runtime, so the plan has four parts.
- Upgrade: Move to PHP 8.5.12, 8.4.27, 8.3.36, or 8.2.35, or obtain a vendor-supported backport. Restart affected PHP workers after updating.
- Reduce exposure: Apply PHP’s published interim mitigations and prioritize internet-facing systems.
- Monitor: Watch for unusual server errors, suspicious multipart requests, abnormal PHP session cookies, and unexpected PHP worker behavior. Some indicators require host-level monitoring.
- Validate virtual patches: Ask vendors for evidence of coverage, testing, and known limitations.
Why signature-based WAFs struggle with PHP2Shell
WAFs are effective at blocking known attack patterns such as SQL injection and cross-site scripting. But coverage of known categories doesn’t guarantee protection against newly discovered vulnerabilities.
PHP2Shell demonstrates why.
The vulnerabilities involve two distinct forms of memory corruption:
- CVE-2026-109618: Memory corruption during out-of-memory handling, potentially leading to unauthenticated remote code execution.
- CVE-2026-109619: Stale internal state surviving across requests, potentially allowing memory disclosure or code execution.
How the stale-state flaw works
PHP’s advisory (GHSA-6wmf-4rv5-p3rp) describes a producer request and a consumer request handled by the same worker. The producer leaves reachable state behind after its memory is released. The consumer reads that state before PHP resets it, which is a use-after-free.
The two requests play different roles:
- Producer: Fatal errors (parse or compile failures, uncaught errors, a failed require, “maximum execution time exceeded”) and out-of-memory conditions after state was published.
- Consumer: Early configuration diagnostics before request initialization, and the session upload-progress path.
Three reasons a request-at-a-time rule can’t see it
- One request is never enough. The attack is a relationship between a producer request and a consumer request, and a stateless rule has no way to represent that.
- The trigger is normal traffic. PHP_SESSION_UPLOAD_PROGRESS is a documented, default-on PHP feature. It is one consumer route and not the bug, so a rule that blocks on the field blocks real upload forms.
- The payload doesn’t look malicious. There is no injection string to match. The danger sits in PHP’s memory lifecycle, not in the request’s content.
Upload progress can sit on either side. Running many workers and recycling them lowers the odds on any one request. It doesn’t remove the condition.
Wiz describes exploitation through unusual multipart requests, memory exhaustion, and corruption of internal PHP state. None of those signals is malicious on its own. Large uploads are legitimate. Applications return errors. Session cookies vary.
Cloudflare and other vendors have developed PHP2Shell-specific mitigations, demonstrating that Layer 7 protection can reduce exposure. But a rule that blocks one exploit technique doesn’t necessarily cover every path to the underlying vulnerability.
The challenge is developing protection that can adapt to new attack behaviors without breaking legitimate applications.
How stateful Layer 7 rules can detect PHP2Shell
When a critical vulnerability is disclosed, the two most important jobs for security teams are to patch affected systems and reduce exposure in the meantime.
Patching can take days or weeks, especially across legacy applications, complex dependencies, and vendor-managed infrastructure. Attackers move faster than the patching process.
Security teams need the ability to respond without depending entirely on predefined signatures or waiting for a vendor to release a new rule.
A WAF that inspects requests independently has limited context. It may see an unusual upload but not recognize that the same client subsequently triggered repeated server errors.
Impart rules are small programs compiled to WebAssembly. Beyond matching a single request, they can keep state across requests and correlate a client’s behavior over time, within the inspector’s latency budget. That is the capability this class of bug needs.
For PHP2Shell, that gives a rule several things it can do:
- Close the upload-progress route at the edge for customers who don’t use it.
- Correlate an unusual upload with the server errors the same client triggers moments afterward.
- Surface abnormal session-cookie patterns in responses.
- Track two different things at once: how many times a single client has probed the route (is one client working at it?) and how many distinct clients are probing it together (is a coordinated campaign underway?). The first is a per-client counter; the second is a distributed sketch of distinct sources. They answer different questions, and a stateless rule can express neither.
The per-client counter is keyed on a session identifier where the request carries one, falling back to client IP. That reduces the chance that ordinary users behind one shared NAT are mistaken for a single determined attacker. A programmable, stateful engine can express “this client is grooming a worker,” and “this route is lighting up across many sources.” A signature can’t.
HTTP inspection has limits. It can’t observe PHP’s internal memory operations, and the edge can’t prove that two requests reached the same PHP worker, so a match is a strong suspicion, not proof. Combining these signals still gives teams far more ways to reduce exposure than a single payload signature does.
The same technology helping researchers uncover complex vulnerabilities can also help defenders generate protection logic, test potential bypasses, and validate mitigations faster.
As vulnerability discovery accelerates, the time between disclosure and protection needs to shrink.
How we built virtual patches for PHP2Shell in under 60 minutes
When PHP2Shell was disclosed, our security research team began evaluating what could be observed and enforced at Layer 7.
Using Impart’s Runtime Defense Harness, we worked to develop, test, and deploy targeted virtual patches designed to reduce exposure while customers applied PHP’s security updates.
Step 1: Understand the attack
Our initial analysis found that no single request signature could reliably identify every PHP2Shell exploit without risking false positives.
That shaped our mitigation strategy. Rather than attempting to match every possible exploit payload, we focused on identifying vulnerable behaviors that could be restricted and additional signals that could provide context.
Step 2: Generate protection logic
A real attack sends the producer-and-consumer sequence many times to land on the same worker, so a single pair is weak evidence. A rule keeps two kinds of cross-request state: a per-client counter of how many times an individual client has probed the route over a window, and a distributed sketch of how many distinct clients are probing it at once. The per-client counter uses Impart’s cross-request counters, which are shared across every inspector so the view holds even when traffic is spread across machines. The distinct-client sketch is what distinguishes a one-off from a coordinated campaign.
Keying the per-client counter on a session identifier where one is present, and falling back to client IP, keeps ordinary users behind a shared NAT from being counted as one attacker. When a single client’s own probing crosses the line, the rule can place it in a penalty box so its later requests are blocked. The result is a high-value signal and a block on repeat offenders. It does not claim to stop the first request, and because the edge can’t prove two requests hit the same worker, it remains a strong suspicion rather than proof.
The Runtime Defense Harness generated candidate virtual patches targeting specific PHP2Shell exploitation paths.
Programmable enforcement allows us to define precise blocking conditions using request characteristics and, where supported, behavioral context.
The goal is to reduce exposure without interfering with legitimate application functionality.
Step 3: Test it. Break it. Make it better.
Generating a rule is only the beginning.
The Runtime Defense Harness evaluates candidate protections against labeled malicious and legitimate traffic using the same enforcement engine that runs in production.
Adversarial testing helps identify bypasses, while independent engineering review evaluates effectiveness, false-positive risks, and known coverage gaps.
Real upload forms that use upload progress, and many users behind one shared IP, are the two cases a careless rule would misclassify. The tests have to cover both, and the per-client counter is keyed on session identity where available precisely to keep that shared-IP case from looking like one attacker.
Step 4: Deploy with human sign-off
Before deployment, a security engineer reviews the testing evidence and approves the protection.
Once deployed, validated rules execute deterministically in the traffic path, without requiring AI inference on every request.
Our PHP2Shell response includes vulnerability-specific CVE Pack rules and custom emergency rules for customers requiring additional mitigations.
No WAF can fully prevent this at the HTTP layer, and patching PHP is the only complete fix. What a stateful rule adds is early visibility and a way to shut down a campaign after the first probes, before the exploit lands.
The Runtime Defense Harness is designed to accelerate that process by combining AI-assisted security engineering with programmable, deterministic Layer 7 enforcement.
Four questions to ask your WAF vendor about virtual patching
PHP2Shell will fade from the headlines. The challenge it exposes won’t. The next critical vulnerability may look nothing like the attacks your WAF already recognizes.
Security teams should be asking their WAF vendors:
- Can our WAF enforce custom security logic beyond predefined signatures?
- Can it correlate behavior across requests and responses?
- Can we develop and test virtual patches against our own traffic?
- Can we deploy protection quickly without introducing unacceptable false positives?
As AI accelerates vulnerability discovery, application defenses need to become more adaptable.
The question is how quickly you can understand a new threat, build protection, and safely enforce it.
Explore Impart’s Runtime Defense Harness →
References
PHP2Shell Research and Remediation Guidance

