Description

A critical vulnerability (CVE-2026-24765, CVSS 7.8) has been disclosed in PHPUnit, the widely-used PHP testing framework. The flaw enables remote code execution (RCE) during automated test runs by exploiting unsafe deserialization of code coverage data — turning test environments and CI/CD pipelines into potential attack vectors. The vulnerability arises in PHPUnit’s PHPT test runner, specifically within the cleanupForCoverage() function that processes code coverage artifacts. During test execution, PHPUnit may deserialize .coverage files using PHP’s built-in unserialize() without validating or restricting class types. Unsafe deserialization of crafted serialized objects that include a malicious __wakeup() method can trigger unintended code execution. A practical exploitation path involves injecting a malicious .coverage file into a project — e.g., via a malicious pull request in a CI/CD pipeline — which then gets processed during automated test runs. Since code coverage files should not exist before test execution, their presence is anomalous, but PHPUnit’s pre-patch behavior allowed blind deserialization to proceed. To succeed, an attacker needs local file write access to the directory where PHPUnit stores or expects these coverage files — a scenario possible in poorly isolated CI/CD runners, compromised build agents, or via other supply-chain mechanisms.