PHP2Shell: How a Progress Bar Became Unauthenticated RCE on 14 Ye
PHP's session upload-progress feature could be abused to trigger a memory corruption (dangling pointer) during request parsing, before application code runs. An unauthenticated attacker could send ordinary HTTP requests to achieve remote code execution or leak secrets from other users on the same server.
Published on timiphil9.medium.com
Prefer the hands-on walkthrough? https://medium.com/@timiphil9/php2shell-tryhackme-walkthrough-85ff69628b39?sharedUserId=timiphil9
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 dangling pointer left behind when a memory-limit bailout (longjmp) occurs after a block is freed but before the pointer to it is cleared, during session upload-progress handling.
Impact
An unauthenticated attacker could achieve remote code execution or leak secrets belonging to other users on the same server; an in-process WAF would not help because the attack completes during request parsing.
What the attacker needed
Target runs vulnerable PHP; any URL accepting POST; no authentication needed
The fix
The vulnerability was fixed in PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35; until patching, disabling session.upload_progress and opcache (and fatal_error_backtraces on 8.5) are incomplete stopgaps.
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 a programming language used to build websites. A feature that shows upload progress bars had a memory bug: when a request ran out of memory at the wrong moment, the server kept a pointer to memory it had already freed. An attacker could send a crafted request to any page that accepts a POST, and the next request handled by the same server process could be tricked into running the attacker's commands, without needing to log in.
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.