phpunit/phpunit security advisory
CVE-2026-24765: Unsafe Deserialization in PHPT Code Coverage Handling in phpunit/phpunit
CVE-2026-24765 is a high-severity PHP object injection vulnerability in the PHP package phpunit/phpunit (CVSS 7.8), published 27 January 2026. It is fixed in 8.5.52, 9.6.33, 10.5.62, 11.5.50 and 12.5.8, one per release line; earlier versions on each line are affected. Exploiting it needs a low-privilege user account.
high 7.8 published 2026-01-27 · updated 2026-06-17
- Affected versions
- >= 0, < 8.5.52
>= 9.0.0, < 9.6.33
>= 10.0.0, < 10.5.62
>= 11.0.0, < 11.5.50
>= 12.0.0, < 12.5.8 - Fixed in
- 8.5.52, 9.6.33, 10.5.62, 11.5.50, 12.5.8
- Newest release
- 13.4.6
- Severity
- High · CVSS 7.8
- Type
- PHP object injection
CWE-502 - Exploited in the wild
- Not on the CISA KEV list
checked 2026-11-04
Is your phpunit/phpunit version affected?
Who can exploit CVE-2026-24765
- Access: A normal, low-privilege user account in the app.
- Position: The attacker needs local access to the server.
CVSS vector (scored by GitHub): CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
How to fix CVE-2026-24765 in phpunit/phpunit
- Find the installed version:
composer show phpunit/phpunit. If you never required it yourself,composer why phpunit/phpunitshows which package pulls it in. - Update it:
composer update phpunit/phpunit --with-all-dependencies. You need the fixed version for your release line (8.5.52, 9.6.33, 10.5.62, 11.5.50 and 12.5.8). - If Composer will not go that high, your composer.json constraint is holding it back. Widen it (for example
"phpunit/phpunit": "^12.5.8"if you can take that version), or upgrade the package that requires it. - Run
composer audit. It reads the same advisory data and should no longer list CVE-2026-24765. - Commit composer.lock and deploy it. On the server, run
composer install --no-devfrom the lock file, notcomposer update.
If you cannot upgrade yet
- Never pass user-controlled data to unserialize() or to template rendering, and restrict who can edit templates or settings.
- Put a web application firewall in front of the app and watch for new PHP files or admin users.
- If your app does not use the affected feature, note that in your audit, but still plan the upgrade.
The CVE-2026-24765 advisory
PHPUnit is a testing framework for PHP. A vulnerability has been discovered in versions prior to 12.5.8, 11.5.50, 10.5.62, 9.6.33, and 8.5.52 involving unsafe deserialization of code coverage data in PHPT test execution. The vulnerability exists in the `cleanupForCoverage()` method, which deserializes code coverage files without validation, potentially allowing remote code execution if malicious `.coverage` files are present prior to the execution of the PHPT test. The vulnerability occurs when a `.coverage` file, which should not exist before test execution, is deserialized without the `allowed_classes` parameter restriction. An attacker with local file write access can place a malicious serialized object with a `__wakeup()` method into the file system, leading to arbitrary code execution during test runs with code coverage instrumentation enabled. This vulnerability requires local file write access to the location where PHPUnit stores or expects code coverage files for PHPT tests. This can occur through CI/CD pipeline attacks, the local development environment, and/or compromised dependencies. Rather than just silently sanitizing the input via `['allowed_classes' => false]`, the maintainer has chosen to make the anomalous state explicit by treating pre-existing `.coverage` files for PHPT tests as an error condition. Starting in versions in versions 12.5.8, 11.5.50, 10.5.62, 9.6.33, when a `.coverage` file is detected for a PHPT test prior to execution, PHPUnit will emit a clear error message identifying the anomalous state. Organizations can reduce the effective risk of this vulnerability through proper CI/CD configuration, including ephemeral runners, code review enforcement, branch protection, artifact isolation, and access control.
References
- GitHub security advisory GHSA-vvj3-c3rp-c85p github.com
- Fix commit 3141742 github.com
- Release 10.5.63 github.com
- Release 11.5.50 github.com
- Release 12.5.8 github.com
- Release 8.5.52 github.com
- Release 9.6.33 github.com
- lists.debian.org lists.debian.org
Other phpunit/phpunit advisories
- medium CVE-2026-119193: PHPUnit vulnerable to code execution by other local users via shared temporary directory in PHPT code coverage handling 2026-10-27
- high PHPUnit: Argument injection via newline in PHP INI values forwarded to child processes 2026-04-22
- high CVE-2026-41570: Argument injection via newline in PHP INI values forwarded to child processes 2026-04-17
- critical CVE-2017-9841: RCE vulnerability in phpunit 2016-11-13
Related
Need help patching or upgrading? Laskyr does PHP and Laravel security fixes and upgrades. Tell us what you run and we reply with a plan and a price.
Ask about a fixWhere this data comes from
- Affected and fixed versions: the Packagist security advisories API (GitHub Advisory Database and FriendsOfPHP), the same data
composer audituses. Synced 2026-11-03. - Description, score, weakness and references: NIST National Vulnerability Database (NVD), checked 2026-11-04. This product uses data from the NVD API but is not endorsed or certified by the NVD.
- Exploited-in-the-wild status: the CISA Known Exploited Vulnerabilities catalog, checked 2026-11-04.
- Compiled by Daniel Lasek at Laskyr from the sources above. The summary, “who can exploit it”, “how to fix it” and hardening sections are our plain-English reading of the record and are generated from it. The quoted description is the record's own text. Spot an error? Tell us.