Home/ Engineering Insights/ PHPUnit PHPT Coverage Temp Directory Flaw (CVE-2026-119193): Fix in 13.4.4

PHPUnit PHPT Coverage Temp Directory Flaw (CVE-2026-119193): Fix in 13.4.4

Source. This article is based on PHPUnit vulnerable to code execution by other local users via shared temporary directory in PHPT code coverage handling (GHSA-9vw2-f4vp-x7gf). Details were checked against it on November 7, 2026; check the source for later changes.

PHPUnit 13.4.0 to 13.4.3 contain a local code-execution weakness, tracked as CVE-2026-119193 (GHSA-9vw2-f4vp-x7gf). It was published as a GitHub advisory in late October 2026 and fixed in PHPUnit 13.4.4. The advisory describes how PHPT tests run with code coverage write their generated code to a predictable directory under the system temp path, and execute it from there.

The advisory is clear that the likelihood is low and that the impact is bounded to the user running the tests. It is still worth ten minutes, because the machines most likely to be exposed are shared developer servers and shared CI hosts. Those are common in older PHP shops.

What the advisory says

When PHPT tests run with code coverage, PHPUnit 13.4.0 to 13.4.3 write each test's code to a directory with a fixed name below the OS temp path, for example /tmp/phpunit-phpt on Linux. PHPUnit then executes the file from that directory. If the directory already exists, PHPUnit uses it without checking who owns it or what its permissions are.

On a system where the temp path is shared between users, another local user can create that directory first. The directory owner can rename or replace files in it, so the attacker can swap the generated test code for their own before it runs. The advisory states that the code then runs with the privileges of the developer, the test still passes, and the coverage report is complete, so nothing in the output looks wrong.

The advisory classifies this as a local privilege escalation (CWE-379) and rates it moderate. It lists source code, credentials and SSH keys as examples of what the attacker could reach through the developer's account. The listed CVSS v4 vector is local-access with user interaction required.

Who is affected

Per the advisory, all of the following must be true:

  • You run PHPUnit 13.4.0, 13.4.1, 13.4.2 or 13.4.3. PHPUnit 12.5 and earlier are stated as not affected, because they write the temporary files next to the PHPT test file.
  • You run PHPT tests (.phpt files) with code coverage, which needs a driver such as PCOV or Xdebug.
  • The temp path is shared between users. The advisory says this is the case on Linux and other Unix-like systems with a shared /tmp, unless per-user temp directories are in use (it names systemd PrivateTmp, pam_namespace or a per-user TMPDIR). macOS and Windows use per-user temp directories by default and are not affected in their default configuration.
  • The attacker has an account on the same system, or controls a process running under another account, and creates the directory before the developer first runs PHPT coverage.

The advisory adds that single-user containers and ephemeral single-user CI runners are typically not affected. A shared build server where several people, or several service accounts, can write to /tmp is the case to look at.

How to check your version

In each project that has PHPUnit as a dev dependency:

composer show phpunit/phpunit
vendor/bin/phpunit --version

Check the build servers and developer machines as well as the repositories. A globally installed PHPUnit or a PHAR can be a different version from the one in composer.lock. To see whether you use PHPT tests at all:

find . -name '*.phpt' -not -path './vendor/*' | head

If that returns nothing, you do not run PHPT tests in the project, and the trigger described in the advisory does not apply there. We would still update, since the fix is a patch release.

The fix

The advisory lists 13.4.4 as the fixed release. Per the maintainers, 13.4.4 creates the directory for PHPT temporary files with an unpredictable name and permissions that only allow the current user to access it, and it does not use a directory that already exists.

  1. Update the constraint and the lock file:
    composer require --dev "phpunit/phpunit:^13.4.4" --update-with-dependencies
  2. Commit composer.json and composer.lock, then update the shared build server and any global installs.
  3. Re-run your suite, including the coverage job.

Note that PHPUnit 13 has its own PHP version requirement, which we did not check here. If your project is on an older PHP, the 13.x line may not be installable at all. In that case you are likely on an older PHPUnit major, which the advisory lists as unaffected. Check the requirements on composer show phpunit/phpunit before changing anything.

If you cannot upgrade right now

The advisory does not give a workaround as a numbered step, but its description of the affected conditions points to the ways the exposure goes away: do not run PHPT tests with coverage on a host whose temp path is shared, or give each user a private temp directory (systemd PrivateTmp, pam_namespace or a per-user TMPDIR). We cannot vouch for how any of these fit your setup, so read the advisory and treat upgrading as the actual fix.

If you suspect the directory was created by someone else, look at who owns it. This is an inspection step of ours, not one from the advisory:

ls -ld /tmp/phpunit-phpt

A directory owned by a different user than the one running your tests is worth investigating. The advisory states that PHPUnit does not delete this directory after a run, only the files in it, so an old directory from a previous run by the same user is expected.

How to confirm the fix

  • composer show phpunit/phpunit reports 13.4.4 or later on every machine that runs the suite.
  • composer.lock in version control pins the new version, so CI does not install an older one.
  • The PHPT coverage run completes as before. Per the advisory, 13.4.4 simply stops using the fixed-name directory.

When this points to a bigger legacy problem

The PHPUnit flaw is small. What it shows is more general: test and build tooling often runs on shared servers, as a user with access to deploy keys, with versions nobody has recorded. If you cannot answer which version of each dev tool runs where, you will also struggle with the larger advisories. We cover how we approach that in our legacy PHP security audit guide, and the groundwork for staged upgrades in adding tests to legacy PHP code and upgrading from PHP 5.6 or 7.x to PHP 8. If you want help getting dependencies and tooling onto supported versions, see our PHP platform development service.

The advisory credits and full technical detail, including its proof of concept, are in the original advisory. We have not reproduced the issue ourselves, and we have not tested the 13.4.4 fix.

Frequently asked questions

Which PHPUnit versions are affected by CVE-2026-119193?

Per the advisory, 13.4.0 to 13.4.3. PHPUnit 12.5 and earlier are stated as not affected, and 13.4.4 contains the fix.

Do I need to worry if I do not use PHPT tests?

The advisory describes the attack as needing PHPT tests run with code coverage. If you have no .phpt files or never collect coverage for them, that trigger does not apply, but updating is still sensible.

Is a single-user CI container affected?

The advisory says systems where no other user can create files in the temp path, typically a single-user container or ephemeral CI runner, are not affected.

Need PHP dependencies and dev tooling brought up to date safely?

We inventory what runs where, add tests around the risky paths and move your build and application to patched, supported versions in stages.

See our PHP Platform Development
Ravi Raghav, Founder & CEO of AllScript Lab
Written by Ravi Raghav Founder & CEO