PHP2Shell: how two PHP vulnerabilities happened and how they were fixed
What happened next
Early on 21 October (Japan time), PHP developers announced fixes for two vulnerabilities rated 9.2 out of 10, together called PHP2Shell. Part of the information leaked early, so the release came one day earlier than planned. Without logging in, an attacker could make the server run commands sent from outside.
The first flaw is the use of uninitialized memory[1]. When a request reached the limit on the number of items, the code jumped out of the operation with longjmp[2], leaving a table with unfilled entries. The second flaw is use-after-free[3]: internal state left over from one request was carried into the next and pointed to memory that had already been freed.
The fix changes what happens when the limit is reached: the code now records the overflow and finishes cleanly, and the worker is replaced when usage reaches twice the limit. Fixed versions were released only for PHP 8.2 and later, so older versions got no fix and their users had to upgrade or stop the service. On 21 October, games, online shops and municipal sites in Japan entered emergency maintenance, and the fixed version was released at 23:00. Two games ended: World Quest on 21 October, and Boku no Makai wo Sukutte! (announced on 22 October), and on 24 October a successful takeover was observed on a decoy server.
Sources
-
JPZenn JA
わかった気になれるPHP脆弱性の原因






