Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Jan 28, 2026

This PR contains the following updates:

Package Change Age Confidence
phpunit/phpunit (source) 9.5.49.6.33 age confidence

GitHub Vulnerability Alerts

CVE-2026-24765

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 = @&#8203;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 .coverage file 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:

  1. Visibility Over Silence: When an invariant is violated (a .coverage file 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
  2. Operational Security: A .coverage file 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
  3. 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

Release Notes

sebastianbergmann/phpunit (phpunit/phpunit)

v9.6.33: PHPUnit 9.6.33

Compare Source

Changed
  • To prevent Poisoned Pipeline Execution (PPE) attacks using prepared .coverage files in pull requests, a PHPT test will no longer be run if the temporary file for writing code coverage information already exists before the test runs

Learn how to install or update PHPUnit 9.6 in the documentation.

Keep up to date with PHPUnit:

v9.6.32: PHPUnit 9.6.32

Compare Source

Changed
  • PHPUnit\Framework\MockObject exceptions are now subtypes of PHPUnit\Exception

Learn how to install or update PHPUnit 9.6 in the documentation.

Keep up to date with PHPUnit:

v9.6.31: PHPUnit 9.6.31

Compare Source

  • No changes; phpunit.phar rebuilt with PHP 8.4 to work around PHP-Scoper issue #​1139

Learn how to install or update PHPUnit 9.6 in the documentation.

Keep up to date with PHPUnit:

v9.6.30: PHPUnit 9.6.30

Compare Source

Changed
  • Updated list of deprecated PHP configuration settings for PHP 8.4, PHP 8.5, and PHP 8.6

Learn how to install or update PHPUnit 9.6 in the documentation.

Keep up to date with PHPUnit:

v9.6.29: PHPUnit 9.6.29

Compare Source

  • No changes; phpunit.phar rebuilt with updated dependencies

Learn how to install or update PHPUnit 9.6 in the documentation.

Keep up to date with PHPUnit:

v9.6.28: PHPUnit 9.6.28

Compare Source

  • No changes; phpunit.phar rebuilt with updated dependencies

Learn how to install or update PHPUnit 9.6 in the documentation.

Keep up to date with PHPUnit:

v9.6.27: PHPUnit 9.6.27

Compare Source

Changed
  • #​6366: Exclude __sleep() and __wakeup() from test double code generation on PHP >= 8.5

Learn how to install or update PHPUnit 9.6 in the documentation.

Keep up to date with PHPUnit:

v9.6.26: PHPUnit 9.6.26

Compare Source

Changed
  • Implement __serialize() in addition to __sleep() (which will be deprecated in PHP 8.5)

Learn how to install or update PHPUnit 9.6 in the documentation.

Keep up to date with PHPUnit:

v9.6.25

Compare Source

v9.6.24: PHPUnit 9.6.24

Compare Source

Changed
  • Do not use ReflectionProperty::setAccessible() with PHP >= 8.1
  • Do not use SplObjectStorage methods that will be deprecated in PHP 8.5

Learn how to install or update PHPUnit 9.6 in the documentation.

Keep up to date with PHPUnit:

v9.6.23: PHPUnit 9.6.23

Compare Source

Changed
  • #​5956: Improved handling of deprecated E_STRICT constant
  • Improved message when test is considered risky for printing unexpected output

How to install or update PHPUnit

v9.6.22: PHPUnit 9.6.22

Compare Source

Fixed
  • #​6071: PHP Archives (PHARs) of PHPUnit 8.5 and PHPUnit 9.6 bundle outdated versions of Prophecy

How to install or update PHPUnit

v9.6.21: PHPUnit 9.6.21

Compare Source

Changed
  • #​5956: Deprecation of the E_STRICT constant in PHP 8.4
  • Removed .phpstorm.meta.php file as methods such as TestCase::createStub() use generics / template types for their return types and PhpStorm, for example, uses that information

How to install or update PHPUnit

v9.6.20: PHPUnit 9.6.20

Compare Source

Changed
  • Updated dependencies (so that users that install using Composer's --prefer-lowest CLI option also get recent versions)

How to install or update PHPUnit

v9.6.19: PHPUnit 9.6.19

Compare Source

Changed
  • The namespaces of dependencies are now prefixed with PHPUnitPHAR instead of just PHPUnit for the PHAR distribution of PHPUnit

How to install or update PHPUnit

v9.6.18: PHPUnit 9.6.18

Compare Source

Changed
  • #​5763: Release nullable type changes for PHPUnit 9.6

How to install or update PHPUnit

v9.6.17

Compare Source

v9.6.16

Compare Source

v9.6.15

Compare Source

v9.6.14

Compare Source

v9.6.13

Compare Source

v9.6.12

Compare Source

v9.6.11

Compare Source

v9.6.10

Compare Source

v9.6.9

Compare Source

v9.6.8

Compare Source

v9.6.7

Compare Source

v9.6.6

Compare Source

v9.6.5

Compare Source

v9.6.4

Compare Source

v9.6.3

Compare Source

v9.6.2

Compare Source

v9.6.1

Compare Source

v9.6.0

Compare Source

v9.5.28

Compare Source

v9.5.27

Compare Source

v9.5.26

Compare Source

v9.5.25

Compare Source

v9.5.24

Compare Source

v9.5.23

Compare Source

v9.5.22

Compare Source

v9.5.21

Compare Source

v9.5.20

Compare Source

v9.5.19

Compare Source

v9.5.18

Compare Source

v9.5.17

Compare Source

v9.5.16

Compare Source

v9.5.14

Compare Source

v9.5.13

Compare Source

v9.5.12

Compare Source

v9.5.11

Compare Source

v9.5.10

Compare Source

v9.5.9

Compare Source

v9.5.8

Compare Source

v9.5.7

Compare Source

v9.5.6

Compare Source

v9.5.5

Compare Source


Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants