PHP2Shell (CVE-2026–109618) Explained: Step-by-Step Fix Guide
The text describes two chained memory-safety flaws in the PHP runtime: an out-of-memory abort that leaves heap state uninitialised, and a use-after-free of session globals on the next request to the same worker. An attacker could send a first request to trigger the abort and a second to hijack the leftover pointer, potentially executing shell commands before application login code runs.
Published on medium.com
PHP2Shell ( CVE-2026-109618 and CVE-2026-109619) is a pair of critical, unauthenticated Remote Code Execution (RCE) vulnerabilities (CVSS 9.2) in the core PHP runtime discovered by AI-assisted code audits. The flaws let attackers trigger an out-of-memory abort on Request #1 and hijack leftover memory pointers on…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a combination of missing zero-initialisation on an out-of-memory abort path and a use-after-free of session module globals that are not reset between requests on persistent workers.
Impact
An attacker could run shell commands on the server without authentication, before any application login code executes; the text does not mention any defence that blocked the exploit.
What the attacker needed
Network access to the PHP server; persistent PHP worker (e.g. php-fpm); no authentication required
The fix
The text says to update PHP to the patched versions and restart the worker pools, and also recommends hardening legacy servers by disabling session upload progress, restricting dangerous functions, recycling workers, and applying kernel syscall filters.
How it was found
- Send a first request designed to exhaust the PHP worker's memory limit and trigger an out-of-memory abort.
- The abort skips normal cleanup, leaving uninitialised heap state on that worker.
- Send a second request to the same worker that reuses the leftover pointer.
- The second request dereferences the freed pointer and diverts execution to a shell command before the application router loads.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
PHP is software that runs many websites. The report says a bug in how PHP cleans up memory between visitors could let an attacker send two requests in a row and make the server run their commands without logging in. The fix is to update PHP and restart the running PHP processes so the old buggy version is no longer in memory.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.