CVE-2026-24765CWE-502

PHPUnit Vulnerable to Unsafe Deserialization in PHPT Code Coverage Handling

High · published January 27, 2026

CVSS v3.1
7.8
EPSS
0%
Percentile
31.9
In the wild
Unconfirmed
What it is

🚨 A sneaky code coverage flaw in PHPUnit could let attackers execute malicious code with just the right trickery! ⚡ Picture a restaurant where the chef accidentally uses leftover ingredients from last week's meal without checking them first—this is like PHPUnit blindly deserializing a `.coverage` file that shouldn't even exist yet! If an attacker gains local file write access, they could sneak in a malicious serialized object. This means they could execute arbitrary code during your PHPT test execution, which is absolutely devastating for your application’s security! Imagine the chaos that could ensue if your tests turned into unauthorized access points!

Put simply

Picture a restaurant where the chef accidentally uses leftover ingredients from last week's meal without checking them first—this is like PHPUnit blindly deserializing a `.coverage` file that shouldn't even exist yet! This vulnerability in PHPUnit affects several versions due to the `cleanupForCoverage()` method's unsafe deserialization of code coverage data, lacking restrictions on `allowed_classes`. This allows potential remote code execution if a malicious `.coverage` file is present before PHPT test execution.

What to do

If an attacker gains local file write access, they could sneak in a malicious serialized object. This means they could execute arbitrary code during your PHPT test execution, which is absolutely devastating for your application’s security! Imagine the chaos that could ensue if your tests turned into unauthorized access points! To mitigate this risk, update PHPUnit to versions 12.5.8, 11.5.50, 10.5.62, 9.6.33, or 8.5.52. Also, tighten your CI/CD pipeline security by enforcing code reviews, using ephemeral runners, and implementing access controls to prevent unauthorized file write access. You've got this! With these steps, you can lock down your PHPUnit setup and keep your code safe. 🛡️

The record
Technical detail
CVSS v3.1
7.8 · HIGH
Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS v4.0
Not supplied
EPSS
0.00390 · 31.9th percentile
Weakness
CWE-502 · Deserialization of Untrusted Data
Published
2026-01-27T21:35Z
EPSS history
Timeline
  • 27 JAN 21:35Z
    PHPUnit Vulnerable to Unsafe Deserialization in PHPT Code Coverage Handling
    cvelistv5