CVE-2017-9841 is a critical-severity (CVSS 9.8) Code Injection vulnerability in phpunit/phpunit. It is in CISA's Known Exploited Vulnerabilities catalog (added 2022-02-15) — treat it as actively exploited and patch now. A fix is available for phpunit/phpunit — see the affected versions and patch details below.
Code Injection in PHPUnit
Exploitation Status
Actively exploited in the wild
- Confirmed by CISA's Known Exploited Vulnerabilities catalog on 2022-02-15. Federal agencies were required to remediate by 2022-08-15.
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- A successful exploit gives an attacker total control of the affected component, not partial access.
Exploitation and automatability from CISA (KEV catalog and SSVC triage) for CVE-2017-9841.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2017-9841 by exploitation likelihood (EPSS) against impact (CVSS). In the shaded patch-first corner (EPSS 50%+, CVSS 7.0+).
Where this sits among everything scored
Of 395,492 CVEs with a current EPSS score, this one falls in the ≥ 90% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
phpunit/phpunit🐘phpunit/phpunitReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
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.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | phpunit/phpunit | ≥ 4.8.19&&< 4.8.28 | 4.8.28composer require phpunit/phpunit:^4.8.28 |
| 🐘Packagist | phpunit/phpunit | ≥ 5.0.10&&< 5.6.3 | 5.6.3composer require phpunit/phpunit:^5.6.3 |
Affected Products
communications diameter signaling routeroraclephpunitphpunit_projectResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
PHP Unit 4.8.28 - Remote Code Execution (RCE) (Unauthenticated)
by souzo · Feb 2, 2022
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for phpunit/phpunit, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update phpunit/phpunit to 4.8.28 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2017-9841 is resolved across your whole dependency graph.
Workarounds
Stop passing untrusted input into the interpreter or shell: call the affected binary with an argument array rather than a composed command string, reject anything outside a strict allowlist of expected values, and run the component under an account that cannot reach beyond the work it legitimately does.
How to detect CVE-2017-9841
A community-maintained Nuclei template exists for this CVE. You can scan for it directly:
nuclei -id cve-2017-9841 -u https://target- Template
- PHPUnit - Remote Code Execution
- Severity
- critical
- Impact
- Remote attackers can execute arbitrary PHP code on the server, leading to full system compromise.
- Remediation
- Upgrade to PHPUnit version 5.7.21 or 6.1.6 or later.
Template by ProjectDiscovery nuclei-templates (Random_Robbie, pikpikcu), MIT licensed. View the full template. Scan only systems you are authorised to test.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
Frequently Asked Questions
Is CVE-2017-9841 in your dependencies?
Find it across Packagist, including transitive dependencies.