CVE-2026-24765 — Vulnerability in phpunit/phpunit — CVE Details
PHPUnit Vulnerable to Unsafe Deserialization in PHPT Code Coverage Handling
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.90%). Schedule for your next planned update.
Does your project use an affected phpunit/phpunit version?
Paste your composer.lock to check it for CVE-2026-24765 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Overview
A vulnerability has been discovered 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.
Technical Details
Affected Component: PHPT test runner, method cleanupForCoverage()
Affected Versions: <= 8.5.51, <= 9.6.32, <= 10.5.61, <= 11.5.49, <= 12.5.7
Vulnerable Code Pattern
if ($buffer !== false) {
// Unsafe call without restrictions
$coverage = @unserialize($buffer);
}
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.
Attack Prerequisites and Constraints
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: A malicious pull request that places a
.coveragefile alongside test files, executed when the CI system runs tests using PHPUnit and collects code coverage information - Local Development Environment: An attacker with shell access or ability to write files to the project directory
- Compromised Dependencies: A supply chain attack inserting malicious files into a package or monorepo
Critical Context: Running test suites from unreviewed pull requests without isolated execution is inherently a code execution risk, independent of this specific vulnerability. This represents a broader class of Poisoned Pipeline Execution (PPE) attacks affecting CI/CD systems.
Proposed Remediation Approach
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.
Rationale for Error-Based Approach:
- Visibility Over Silence: When an invariant is violated (a
.coveragefile existing before test execution), the error must be visible in CI/CD output, alerting operators to investigate the root cause rather than proceeding with sanitized input - Operational Security: A
.coveragefile should never exist before tests run, coverage data is generated by executing tests, not sourced from artifacts. Its presence indicates:- A malicious actor placed it intentionally
- Build artifacts from a previous run contaminated the environment
- An unexpected filesystem state requiring investigation
- Defense-in-Depth Principle: Protecting a single deserialization call does not address the fundamental attack surface. Proper mitigations for PPE attacks lie outside PHPUnit's scope:
- Isolate CI/CD runners (ephemeral, containerized environments)
- Restrict code execution on protected branches
- Scan pull requests and artifacts for tampering
- Use branch protection rules to prevent unreviewed code execution
Severity Classification
- Attack Vector (AV): Local (L) — requires write access to the file system where tests execute
- Attack Complexity (AC): Low (L) — exploitation is straightforward once the malicious file is placed
- Privileges Required (PR): Low (L) — PR submitter status or contributor role provides sufficient access
- User Interaction (UI): None (N) — automatic execution during standard test execution
- Scope (S): Unchanged (U) — impact remains within the affected test execution context
- Confidentiality Impact (C): High (H) — full remote code execution enables complete system compromise
- Integrity Impact (I): High (H) — arbitrary code execution allows malicious modifications
- Availability Impact (A): High (H) — full code execution permits denial-of-service actions
Mitigating Factors (Environmental Context)
Organizations can reduce the effective risk of this vulnerability through proper CI/CD configuration:
- Ephemeral Runners: Use containerized, single-use CI/CD runners that discard filesystem state between runs
- Code Review Enforcement: Require human review and approval before executing code from pull requests
- Branch Protection: Enforce branch protection rules that block unreviewed code execution
- Artifact Isolation: Separate build artifacts from source; never reuse artifacts across independent builds
- Access Control: Limit file write permissions in CI environments to authenticated, trusted actors
Fixed Behaviour
When a .coverage file is detected for a PHPT test prior to execution, PHPUnit will emit a clear error message identifying the anomalous state. This ensures:
- Visibility: The error appears prominently in CI/CD output and test logs
- Investigation: Operations teams can investigate the root cause (potential tampering, environment contamination)
- Fail-Fast Semantics: Test execution stops rather than proceeding with an unexpected state
Recommendation
Update to the patched version immediately if a project runs PHPT tests using PHPUnit with coverage instrumentation in any CI/CD environment that executes code from external contributors. Additionally, audit the project's CI/CD configuration to ensure:
- Pull requests from forks or untrusted sources execute in isolated environments
- Branch protection rules require human review before code execution
- CI/CD runners are ephemeral and discarded after each build
- Build artifacts are not reused across independent runs without validation
Advisory Timeline
- First published January 27, 2026 (303 days ago).
- Last revised May 5, 2026 — 98 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
composer require "phpunit/phpunit:^10.5.62"
composer require "phpunit/phpunit:^11.5.50"
composer require "phpunit/phpunit:^8.5.52"
composer require "phpunit/phpunit:^12.5.8"
composer require "phpunit/phpunit:^9.6.33"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (5)
Affects 1 ecosystem: Packagist (1).
| Package | Fixed In |
|---|---|
| phpunit/phpunit Packagist · Affected: 10.0.0, 10.0.1, 10.0.10, 10.0.11 (+99 more) | 10.5.62 |
| phpunit/phpunit Packagist · Affected: 11.0.0, 11.0.1, 11.0.10, 11.0.2 (+83 more) | 11.5.50 |
| phpunit/phpunit Packagist · Affected: 3.7.0, 3.7.1, 3.7.10, 3.7.11 (+411 more) | 8.5.52 |
| phpunit/phpunit Packagist · Affected: 12.0.0, 12.0.1, 12.0.10, 12.0.2 (+54 more) | 12.5.8 |
| phpunit/phpunit Packagist · Affected: 9.0.0, 9.0.1, 9.0.2, 9.1.0 (+90 more) | 9.6.33 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-502Deserialization of Untrusted DataMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 7.8 score means for each attack dimension.
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
References
- https://github.com/sebastianbergmann/phpunit/security/advisories/GHSA-vvj3-c3rp-c85pWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-24765ADVISORY
- https://github.com/sebastianbergmann/phpunit/commit/3141742e00620e2968d3d2e732d320de76685fdaWEB
- https://github.com/sebastianbergmann/phpunit/commit/613d142f5a8471ca71623ce5ca2795f79248329eWEB
- https://github.com/FriendsOfPHP/security-advisories/blob/master/phpunit/phpunit/CVE-2026-24765.yamlWEB
- https://github.com/sebastianbergmann/phpunitPACKAGE
- https://github.com/sebastianbergmann/phpunit/releases/tag/10.5.63WEB
- https://github.com/sebastianbergmann/phpunit/releases/tag/11.5.50WEB
- https://github.com/sebastianbergmann/phpunit/releases/tag/12.5.8WEB
- https://github.com/sebastianbergmann/phpunit/releases/tag/8.5.52WEB
- https://github.com/sebastianbergmann/phpunit/releases/tag/9.6.33WEB
- https://lists.debian.org/debian-lts-announce/2026/02/msg00009.htmlWEB
- https://owasp.org/www-project-top-10-ci-cd-security-risks/CICD-SEC-04-Poisoned-Pipeline-ExecutionWEB
Frequently Asked Questions
- What is CVE-2026-24765?
- PHPUnit Vulnerable to Unsafe Deserialization in PHPT Code Coverage Handling. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 7.8/10).
- How do I check if my project is affected by CVE-2026-24765?
- CVE-2026-24765 affects phpunit/phpunit. It has a 0.9% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-24765 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is an above-median EPSS score — 57.6% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.
Also Known As
Related CVEs
- CVE-2017-9841CRITICAL
Code Injection in PHPUnit
- CVE-2026-103035HIGH
TeamPass folder re-parenting authorization bypass
- CVE-2026-110782HIGH
SAML2: Incomplete fix of CVE-2026-49283: unsigned embedded Response bypasses HTTP-Artifact signature verification (no embedded-Issuer binding)