Skip to content

Defender Daily

PHP session and FPM flaws can let attackers run code without a login

Affected
PHP 8.2 through 8.5 before the Nov 19 releases, and older versions, which get no fix. All versions and fixes

PHP’s Nov 19 security releases fix 17 flaws across its four supported branches, and seven of them have a CVSS 4.0 score of 9.2. The worst can let an unauthenticated attacker run code on the server, though Wiz says most need settings that aren’t the default. No exploitation has been reported, and Wiz says the mitigations for October’s PHP2Shell flaws don’t cover all of the new ones.

The flaw depthfirst calls “phpAfterShell”, , is in PHP’s default file-based session storage. PHP doesn’t write session files in one step. A worker stopped midway, for example by a memory or time limit while recording upload progress, can leave a file mixing old and new data. The next request that opens the session deserializes it, and a gadget chain in the application can turn that into code execution, Wiz says.

In , PHP-FPM leaves unread request-body bytes on a connection the web server keeps open. When nginx or Apache reuses FastCGI connections, an unauthenticated attacker can hide a second request inside the body. Wiz says it then runs with the FPM worker’s rights and skips the web server’s routing rules.

Wiz says the other critical flaws need uncommon setups. needs mixed session serializers on a shared store, and needs startup warnings logged to a file on non-thread-safe builds. needs exception arguments turned on in PHP 8.5. Two more, and , are use-after-free flaws related to October’s PHP2Shell flaws, and the first is an incomplete fix for one of them.

lets a local user escalate from an FPM worker to the FPM master process, which often runs as root. Wiz says it has seen no exploitation and no public mention of any, and depthfirst says it reported phpAfterShell privately in late October. PHP 8.1 and older get no fixes, Wiz says.

CVE
Vendor
PHP

What to do

6 steps

Affected and fixed versions

  • Product
    PHP 8.5
    Affected
    Before 8.5.13
    Fixed
    8.5.13, or 8.6.0
  • Product
    PHP 8.4
    Affected
    Before 8.4.28
    Fixed
    8.4.28
  • Product
    PHP 8.3
    Affected
    Before 8.3.37
    Fixed
    8.3.37
  • Product
    PHP 8.2
    Affected
    Before 8.2.36
    Fixed
    8.2.36
  • Product
    PHP 8.1 and older
    Affected
    Affected, with no official fix, Wiz says
    Fixed
    None

Sources

Tags

Subscribe

Get the Daily Brief by email

Weekdays at 7am ET.

We’ll email you a link to confirm. Unsubscribe from any email.