CVE-2017-9841
Code Injection in PHPUnit
Also known as EDB-50702, GHSA-r7c9-c69m-rph8
Mitigation
- Upgrade phpunit/phpunit to one of 4.8.28, 5.6.3 (or later in the same release line).
Who should check
- Projects that depend on Packagist package phpunit/phpunit (>= 4.8.19, < 4.8.28)
- Anyone running n/a (versions: see the vendor advisory)
Vulnerability facts
- Affected
- phpunit/phpunit >= 4.8.19, < 4.8.28
- Fixed in
- 4.8.28, 5.6.3
- Exploited in the wild
- Yes: in CISA KEV since 2022-02-15; federal due date 2022-08-15
- Public exploit / PoC
- Yes: see the exploit references below
- Remote exploitation
- Remote, no login needed
- CVSS
- 9.8 (v3.1, CNA)CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: Low
- Privileges required: None
- User interaction: None
- Scope: Unchanged
- Confidentiality impact: High
- Integrity impact: High
- Availability impact: High
- EPSS
- 100.00% chance of exploitation in 30 days (percentile 100, 2026-11-26)
- CWE
- CWE-94
- Modified
Description
Util/PHP/eval-stdin.php in PHPUnit before 4.8.28 and 5.x before 5.6.3 allows remote attackers to execute arbitrary PHP code via HTTP POST data beginning with a "<?php " substring, as demonstrated by an attack on a site with an exposed /vendor folder, i.e., external access to the /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php URI.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| Packagist phpunit/phpunit | >= 4.8.19, < 4.8.28 | 4.8.28, 5.6.3 | osv |
| n/a | — | — | nvd |
Timeline
- 2017-06-27 Published
- 2022-02-15 Added to CISA KEV (exploited in the wild)
- 2022-08-15 CISA remediation due date for US federal agencies
- 2026-06-17 Last modified
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2017-9841. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2017-9841.md Affected: phpunit/phpunit >= 4.8.19, < 4.8.28 Fixed in: 4.8.28, 5.6.3 Steps: 1. Search this machine and project for phpunit/phpunit (Packagist), n/a: 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.
References
Vendor advisories
Patches
- https://www.oracle.com/security-alerts/cpuoct2021.html
- https://github.com/sebastianbergmann/phpunit/commit/284a69fb88a2d0845d23f42974a583d8f59bf5a5
- https://github.com/sebastianbergmann/phpunit/pull/1956
- https://github.com/sebastianbergmann/phpunit/pull/1955
- https://github.com/sebastianbergmann/phpunit/commit/3aaddb1c5bd9b9b8d070b4cf120e71c36fd08412
Exploits and PoCs
Other
- http://www.securityfocus.com/bid/101798
- http://www.securitytracker.com/id/1039812
- http://web.archive.org/web/20170701212357/http://phpunit.vulnbusters.com/
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2017-9841
- https://github.com/FriendsOfPHP/security-advisories/blob/master/phpunit/phpunit/CVE-2017-9841.yaml
- https://github.com/sebastianbergmann/phpunit
- http://web.archive.org/web/20170701212357/http://phpunit.vulnbusters.com
FAQ
Is CVE-2017-9841 being exploited?
Yes. CISA lists CVE-2017-9841 in its Known Exploited Vulnerabilities catalog since 2022-02-15, which means attacks have been seen. Public exploit code or a proof of concept is available. EPSS estimates a 100.00% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2017-9841?
Critical: CVSS 9.8 (v3.1, scored by CNA). Remote, no login needed.
Which versions are affected by CVE-2017-9841?
phpunit/phpunit >= 4.8.19, < 4.8.28.
Is there a fix for CVE-2017-9841?
Yes. Fixed in 4.8.28, 5.6.3. Upgrade phpunit/phpunit to one of 4.8.28, 5.6.3 (or later in the same release line).
How do I check if I'm affected by CVE-2017-9841?
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.