PHPUnit 13.4.4/12.5.41 temporary-directory fixes and GHSA-9vw2-f4vp-x7gf
PHPUnit 13.4.4 and 12.5.41 were tagged on 27 October 2026 (about 03:15 UTC), followed about an hour later by
13.4.5 and 12.5.42. The releases change how PHPUnit uses directories below sys_get_temp_dir(), and 13.4.4 is the
patched version for a repository security advisory.
GHSA-9vw2-f4vp-x7gf (PHPT code coverage)
The advisory, published on
27 October, is rated Moderate, CVSS v4 5.4
(CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N), CWE-379. It lists no CVE ID.
- Affected:
phpunit/phpunit>= 13.4.0, < 13.4.4. Patched: 13.4.4. PHPUnit 12.5 and earlier are not affected; they write these files next to the PHPT test file. - Issue: when PHPT tests run with code coverage, 13.4.0–13.4.3 write the test code to a directory with a fixed
name (
sys_get_temp_dir() . '/phpunit-phpt', for example/tmp/phpunit-phpt) and execute it from there. The directory is reused when it already exists, without checking its owner or permissions. - Impact: another local user who creates the directory first can replace a test's code before it runs and so execute code as the developer. The advisory says the test still passes and the coverage report is complete, so the attack is not visible.
- Conditions (all required): PHPT tests with code coverage (PCOV or Xdebug); a temporary-file path shared between
users (typical for a shared
/tmpon Linux and other Unix-like systems, unless per-user temporary directories are used); an attacker account or service on the same system; and the attacker creating the directory first. macOS and Windows use per-user temporary directories by default and are not affected in their default configuration. The advisory says a single-user container or ephemeral CI runner is typically not affected. - Fix: 13.4.4 creates the directory with an unpredictable name and permissions for the current user only, and does not use a directory that already exists.
The advisory names no mitigation besides upgrading, and this page does not add one.
Static analysis cache directory (12.5 and 13.4)
Both 13.4.4 and 12.5.41 also stop using the automatically created static analysis cache directory in the temporary path (used when no cache directory is configured) when another user created it or other users can write to it. The release notes list this as a fix, and the repository's advisory list has no separate advisory for it. The follow-up releases 13.4.5 and 12.5.42 fix one thing: that cache directory was not used when the POSIX extension was not loaded.
Other fixes in 13.4.4
- The TeamCity logger wrote
testSuiteFinishedtwice when a before-first-test method errored or failed (also 12.5.41). - TestDox showed a less important outcome of a test with several outcomes (also 12.5.41).
- When a run was interrupted by a signal during a process-isolated test, the test's result was discarded and it was counted as passed (13.4.4 only).
Downstream
Pest 5.3.4, released on 27 October 2026 at about 11:10 UTC, lists "bump PHPUnit to 13.4.5 for GHSA-9vw2-f4vp-x7gf" (#1995). Pest's resulting version constraint was not checked.
Limitations: this page paraphrases the advisory and release notes and has not reproduced the issue. The severity is the maintainer's rating on the repository advisory. Related: PHPUnit 13.4.0, package signals.