CVE-2026-24765·PHP vulnerability
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.
- Severity
- high
- Software
- PHP
- Fixed in
- 12.5.8
- Published
How likely is exploitation
FIRST's Exploit Prediction Scoring System puts the probability of this CVE being exploited in the next 30 days at 0.11% — higher than 29% of all published CVEs. EPSS is an independent forecast of exploitation, not a severity rating: it says nothing about how much damage a successful attack does, which is what a CVSS score measures.
Read the two together. CVE-2026-24765 scores 7.8 on CVSS, so a successful attack would be serious — but at 0.11%, almost nobody is currently attempting it. That is a different situation from a flaw under mass exploitation, and it is usually the difference between patching on your next maintenance window and patching tonight.
Affected versions
From: 12.0.0
Until: 12.5.8
Fixed in: 12.5.8
How to fix this CVE
Update PHPUnit to version 12.5.8 or later (also applies to 11.5.50, 10.5.62, 9.6.33, and 8.5.52 for their respective branches) to prevent unsafe deserialization of code coverage files. The patched versions now treat pre-existing `.coverage` files for PHPT tests as an error condition rather than silently deserializing them, eliminating the remote code execution vector. Ensure your CI/CD pipeline uses ephemeral runners and maintains strict access controls to prevent malicious `.coverage` file injection.
sudo dnf update phpDefensia detects this vulnerability
How to check if you are affected
- Run `php -v` to check the currently installed PHP version and verify PHPUnit version with `./vendor/bin/phpunit --version`
- Examine your CI/CD pipeline configuration to identify if PHPT tests are executed with code coverage instrumentation enabled (look for `--coverage-*` flags in test commands)
- Search application logs and CI/CD runner logs for entries containing `cleanupForCoverage()`, `.coverage` file references, or `__wakeup()` method calls that occur during test execution
- Verify the patch was applied by running `./vendor/bin/phpunit --version` again and confirming the version matches or exceeds 12.5.8 (or 11.5.50/10.5.62/9.6.33/8.5.52 for older branches)
FAQ
What is CVE-2026-24765?
CVE-2026-24765 is an unsafe deserialization vulnerability in PHPUnit's code coverage handling for PHPT tests, where the `cleanupForCoverage()` method deserializes `.coverage` files without validating their contents, allowing attackers with local file write access to execute arbitrary code via malicious serialized objects.
Is CVE-2026-24765 being actively exploited?
No, there are currently no reports of active exploitation or public exploits available for this vulnerability, though the attack vector requires only local file write access, making it a risk in compromised CI/CD environments or development systems.
What versions of PHP are affected by CVE-2026-24765?
PHPUnit versions prior to 12.5.8, 11.5.50, 10.5.62, 9.6.33, and 8.5.52 are affected. This impacts any PHP installation running these vulnerable PHPUnit versions.
How do I check if my server is vulnerable to CVE-2026-24765?
Run `./vendor/bin/phpunit --version` to check your PHPUnit version; if it is below 12.5.8 (or the minimum fixed version for your branch), your installation is vulnerable. Additionally, check for the presence of `.coverage` files in your test directories with `find . -name '*.coverage' -type f`.
Does Defensia detect CVE-2026-24765?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If PHP and PHPUnit are installed on a monitored server, CVE-2026-24765 will appear in your dashboard with remediation steps.
Related PHP CVEs
References
- https://github.com/sebastianbergmann/phpunit/commit/3141742e00620e2968d3d2e732d320de76685fda
- https://github.com/sebastianbergmann/phpunit/releases/tag/10.5.63
- https://github.com/sebastianbergmann/phpunit/releases/tag/11.5.50
- https://github.com/sebastianbergmann/phpunit/releases/tag/12.5.8
- https://github.com/sebastianbergmann/phpunit/releases/tag/8.5.52
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2026-24765. Free for 1 server.
Get started free