# CVE-2026-24765: PHPUnit Vulnerable to Unsafe Deserialization in PHPT Code Coverage Handling

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.90% (percentile 58, 2026-11-26)
- **CWE:** CWE-502
- **Aliases:** GHSA-vvj3-c3rp-c85p
- **Published:** 2026-01-27T21:35:54.292Z
- **Modified:** 2026-06-17T10:23:33.267Z

## Who should check

- Projects that depend on Packagist package phpunit/phpunit (\< 8.5.52)
- Anyone running sebastianbergmann phpunit \< 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

## Description

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.

## Affected and fixed versions

- Packagist `phpunit/phpunit`: affected \< 8.5.52; fixed 8.5.52, 9.6.33, 10.5.62, 11.5.50, 12.5.8 (osv)
- sebastianbergmann phpunit: \< 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 (cvelist)

## Mitigation

- Upgrade phpunit/phpunit to one of 8.5.52, 9.6.33, 10.5.62, 11.5.50, 12.5.8 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-24765. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-24765.md
Affected: phpunit/phpunit < 8.5.52
Fixed in: 8.5.52, 9.6.33, 10.5.62, 11.5.50, 12.5.8

Steps:
1. Search this machine and project for phpunit/phpunit (Packagist), sebastianbergmann phpunit: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-24765 being exploited?

There is no confirmed exploitation: CVE-2026-24765 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.90% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2026-24765?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2026-24765?

phpunit/phpunit \< 8.5.52.

### Is there a fix for CVE-2026-24765?

Yes. Fixed in 8.5.52, 9.6.33, 10.5.62, 11.5.50, 12.5.8. Upgrade phpunit/phpunit to one of 8.5.52, 9.6.33, 10.5.62, 11.5.50, 12.5.8 (or later in the same release line).

### How do I check if I'm affected by CVE-2026-24765?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/sebastianbergmann/phpunit/security/advisories/GHSA-vvj3-c3rp-c85p>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2026-24765>
- patch: <https://github.com/sebastianbergmann/phpunit/commit/3141742e00620e2968d3d2e732d320de76685fda>
- patch: <https://github.com/sebastianbergmann/phpunit/commit/613d142f5a8471ca71623ce5ca2795f79248329e>
- other: <https://github.com/sebastianbergmann/phpunit/releases/tag/10.5.63>
- other: <https://github.com/sebastianbergmann/phpunit/releases/tag/11.5.50>
- other: <https://github.com/sebastianbergmann/phpunit/releases/tag/12.5.8>
- other: <https://github.com/sebastianbergmann/phpunit/releases/tag/8.5.52>
- other: <https://github.com/sebastianbergmann/phpunit/releases/tag/9.6.33>
- other: <https://lists.debian.org/debian-lts-announce/2026/02/msg00009.html>
- other: <https://github.com/FriendsOfPHP/security-advisories/blob/master/phpunit/phpunit/CVE-2026-24765.yaml>
- other: <https://github.com/sebastianbergmann/phpunit>
- other: <https://owasp.org/www-project-top-10-ci-cd-security-risks/CICD-SEC-04-Poisoned-Pipeline-Execution>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-24765>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-vvj3-c3rp-c85p> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2026-24765> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-24765>
