CVE-2017-9841 — Code Injection in phpunit/phpunit — CVE Details
Code Injection in PHPUnit
What Should I Do?
Patch Immediately
This vulnerability is confirmed under active exploitation (CISA KEV). Patch within 24-48 hours if possible.
Does your project use an affected phpunit/phpunit version?
Paste your composer.lock to check it for CVE-2017-9841 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
Util/PHP/eval-stdin.php in PHPUnit starting with 4.8.19 and before 4.8.28, as well as 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.
Advisory Timeline
- First published March 26, 2022 (1706 days ago).
- Last revised October 22, 2025 — 1307 days after initial publication.
- Added to CISA's Known Exploited Vulnerabilities catalog 39 days before publication.
Remediation
Upgrade to the fixed version using your package manager.
composer require "phpunit/phpunit:^5.6.3"
composer require "phpunit/phpunit:^4.8.28"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (2)
Affects 1 ecosystem: Packagist (1).
| Package | Fixed In |
|---|---|
| phpunit/phpunit Packagist · Affected: 5.0.10, 5.1.0, 5.1.1, 5.1.2 (+44 more) | 5.6.3 |
| phpunit/phpunit Packagist · Affected: 4.8.19, 4.8.20, 4.8.21, 4.8.22 (+5 more) | 4.8.28 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-94Code InjectionMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/E:H
References
- https://nvd.nist.gov/vuln/detail/CVE-2017-9841ADVISORY
- https://github.com/sebastianbergmann/phpunit/pull/1955WEB
- https://github.com/sebastianbergmann/phpunit/pull/1956WEB
- https://github.com/sebastianbergmann/phpunit/commit/284a69fb88a2d0845d23f42974a583d8f59bf5a5WEB
- https://github.com/sebastianbergmann/phpunit/commit/3aaddb1c5bd9b9b8d070b4cf120e71c36fd08412WEB
- https://github.com/FriendsOfPHP/security-advisories/blob/master/phpunit/phpunit/CVE-2017-9841.yamlWEB
- https://github.com/sebastianbergmann/phpunitPACKAGE
- https://security.gentoo.org/glsa/201711-15WEB
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2017-9841WEB
- https://www.oracle.com/security-alerts/cpuoct2021.htmlWEB
- https://web.archive.org/web/20170701212357/http://phpunit.vulnbusters.comWEB
- https://www.securityfocus.com/bid/101798WEB
- https://www.securitytracker.com/id/1039812WEB
Frequently Asked Questions
- What is CVE-2017-9841?
- Code Injection in PHPUnit. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
- How do I check if my project is affected by CVE-2017-9841?
- CVE-2017-9841 affects phpunit/phpunit. It has a 100.0% probability of exploitation within 30 days (EPSS score). This vulnerability is listed in CISA's Known Exploited Vulnerabilities (KEV) catalog, meaning it is being actively exploited in the wild. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2017-9841 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Maximum impact if exploited, often with little effort or access required.
This places it in the top 5% of EPSS-scored vulnerabilities — 100% of tracked vulnerabilities score at or below it, so it is far more likely to be exploited than nearly all other tracked vulnerabilities.
This vulnerability is in CISA's Known Exploited Vulnerabilities (KEV) catalog, indicating active exploitation in the wild.
Added to KEV catalog: February 15, 2022
Remediation deadline: August 15, 2022
Also Known As
Related CVEs
- CVE-2026-63412CRITICAL
Jane: Instantiation RCE via query parameter name -> raw PHPDoc */ breakout (jane-php/open-api-3)
- CVE-2026-63413CRITICAL
Jane: Instantiation RCE via header parameter name -> raw PHPDoc */ breakout (jane-php/open-api-3)
- CVE-2026-24765HIGH
PHPUnit Vulnerable to Unsafe Deserialization in PHPT Code Coverage Handling