CVE-2017-9841
PHPUnit Command Injection Vulnerability
Description
CVE-2017-9841 is a CRITICAL improper control of generation of code ('code injection') vulnerability affecting PHPUnit PHPUnit, carrying a CVSS 3.1 score of 9.8. PHPUnit 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 products include Phpunit Project Phpunit (<= 4.8.27; >= 5.0.0, < 5.6.3), Oracle Communications Diameter Signaling Router (>= 8.0.0, <= 8.5.0). This CVE is listed in CISA's Known Exploited Vulnerabilities (KEV) catalog with a remediation deadline of 2022-08-15. With an EPSS score of 0.94210 (99.92th percentile), this vulnerability demonstrates significant real-world exploitation activity and should be prioritized for immediate remediation.
KEV Information
CVSS Score
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HOpen in CalculatorAffected Products
| Vendor | Product | Version |
|---|---|---|
| phpunit project | phpunit | <= 4.8.27; >= 5.0.0, < 5.6.3 |
| oracle | communications diameter signaling router | >= 8.0.0, <= 8.5.0 |
Multiple CVSS Assessments
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
References
- http://web.archive.org/web/20170701212357/http://phpunit.vulnbusters.com/(Third Party Advisory)
- http://www.securityfocus.com/bid/101798(Broken Link)
- http://www.securitytracker.com/id/1039812(Broken Link)
- https://github.com/sebastianbergmann/phpunit/commit/284a69fb88a2d0845d23f42974a583d8f59bf5a5(Patch, Third Party Advisory)
- https://github.com/sebastianbergmann/phpunit/pull/1956(Patch, Third Party Advisory)
- https://security.gentoo.org/glsa/201711-15(Third Party Advisory)
- https://www.oracle.com/security-alerts/cpuoct2021.html(Patch, Third Party Advisory)
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2017-9841(US Government Resource)
Weakness Type
CWE-94: Improper Control of Generation of Code ('Code Injection')
CVE-2017-9841 is classified under CWE-94 — Improper Control of Generation of Code ('Code Injection'). Code Injection is a vulnerability that occurs when software constructs all or part of a code segment using externally-influenced input from an upstream component, but does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. Unlike command injection which targets operating system shells, code injection targets the programming language interpreter itself (e.g., Python's eval(), PHP's eval(), JavaScript's eval(), or compiled code generation). Successful exploitation allows attackers to execute arbitrary code within the application's context, potentially leading to complete system compromise with the full privileges of the application process.
In the context of PHPUnit PHPUnit, this weakness is particularly concerning because Code injection represents one of the most severe vulnerability classes, enabling attackers to execute arbitrary code with application privileges. Modern web applications using server-side scripting languages are particularly vulnerable when they dynamically generate or interpret code from user input. Attackers can steal sensitive data, modify application behavior, establish persistent backdoors, pivot to internal systems, or use the compromised application for further attacks. Organizations using affected versions should understand that this vulnerability class has historically enabled severe compromises across enterprise environments.
Impact Analysis
CVE-2017-9841 carries a CVSS 3.1 score of 9.8 (CRITICAL) with Unchanged Scope.
Confidentiality (HIGH): Successful exploitation grants the attacker extensive access to sensitive data processed by PHPUnit PHPUnit, including configuration files, credentials, and potentially data from connected systems.
Integrity (HIGH): Attackers can modify critical system files, install backdoors, alter configurations, or deploy malware on affected systems running PHPUnit PHPUnit.
Availability (HIGH): Complete disruption of the affected service or system is possible, including denial of service, system crashes, or rendering the product inoperable.
Scope Unchanged: The vulnerability's scope is Unchanged (U), meaning exploitation is contained within the vulnerable component. The impact, while significant, is limited to the PHPUnit PHPUnit environment itself.
With an EPSS score of 0.94210 (99.92th percentile), this vulnerability ranks among the most likely to be exploited in real-world attacks, underscoring the urgency of remediation.
Exploit Maturity
CVE-2017-9841 has confirmed active exploitation in the wild and is listed in CISA's Known Exploited Vulnerabilities catalog.
Exploit status: This vulnerability has been actively exploited, as confirmed by its inclusion in the KEV catalog. The EPSS score of 0.94210 (99.92th percentile) places it among the most exploited vulnerabilities tracked.
Ransomware association: As of the latest KEV data, no direct ransomware association has been confirmed for CVE-2017-9841. However, the confirmed exploitation in the wild means threat actors are actively using this vulnerability in attacks.
Attack surface: While specific public exploit code may not be readily available, the vulnerability's high EPSS score and KEV listing confirm that threat actors have developed and used working exploits. Organizations should assume exploitation tools exist in underground markets and private threat actor toolkits.
KEV deadline: CISA required federal agencies to remediate this vulnerability by 2022-08-15. All organizations should treat this deadline as a strong recommendation for their own remediation timelines.
Remediation
- Apply vendor patches immediately. Apply updates per vendor instructions. Consult the vendor advisory at github.com for specific patch guidance.
- Verify affected product versions in your environment. Identify all instances of PHPUnit PHPUnit in your infrastructure (affected versions: Phpunit Project Phpunit (<= 4.8.27; >= 5.0.0, < 5.6.3), Oracle Communications Diameter Signaling Router (>= 8.0.0, <= 8.5.0)). Use asset inventory and vulnerability scanning tools to ensure no instances are missed.
- Implement interim mitigations if patching is delayed. If immediate patching is not feasible, apply network-level controls such as restricting access to the affected component, enabling enhanced logging, and monitoring for indicators of compromise.
- Scan for signs of prior exploitation. Given the confirmed active exploitation of this vulnerability, review system logs and security monitoring data for evidence of compromise. Conduct a thorough investigation if any suspicious activity is detected.
- Update detection signatures and monitoring rules. Ensure intrusion detection and prevention systems, endpoint detection tools, and SIEM rules are updated to detect exploitation attempts targeting CVE-2017-9841.
- Conduct a post-remediation review. After patching, verify the fix is effective and document the remediation actions taken. Update your vulnerability management records and assess whether any additional hardening measures are warranted.
Technical Details
CVE-2017-9841 is a CRITICAL-severity vulnerability in PHPUnit PHPUnit that can be exploited remotely over the network without physical access. The attack complexity is low, meaning no specialized conditions or preparation are required beyond the attack prerequisites. No prior authentication or privileges are needed to initiate the attack. No user interaction is required, allowing fully automated exploitation once the target is accessible.
Technical mechanism: PHPUnit 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. The underlying flaw relates to improper control of generation of code ('code injection'), where Code Injection is a vulnerability that occurs when software constructs all or part of a code segment using externally-influenced input from an upstream component, but does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. Unlike command injection which targets operating system shells, code injection targets the programming language interpreter itself (e.g., Python's eval(), PHP's eval(), JavaScript's eval(), or compiled code generation).
CVSS 3.1 vector analysis: The vector reflects an Attack Vector of NETWORK, Attack Complexity of LOW, Privileges Required of NONE, User Interaction of NONE, Scope UNCHANGED, and impact ratings of HIGH/HIGH/HIGH for Confidentiality/Integrity/Availability respectively. The Unchanged scope means impact is contained within the vulnerable component itself.
Frequently Asked Questions
What is CVE-2017-9841?
CVE-2017-9841 is a CRITICAL-severity vulnerability (CVSS 9.8) in PHPUnit PHPUnit that pHPUnit 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. It is listed in CISA's Known Exploited Vulnerabilities catalog, confirming real-world exploitation.
Which products are affected by CVE-2017-9841?
The affected products include Phpunit Project Phpunit (<= 4.8.27; >= 5.0.0, < 5.6.3), Oracle Communications Diameter Signaling Router (>= 8.0.0, <= 8.5.0). Organizations running any of these versions should verify their exposure and prioritize remediation. Check vendor advisories for the complete and most current list of affected versions.
How do I fix CVE-2017-9841?
Apply updates per vendor instructions. Ensure all affected instances of PHPUnit PHPUnit are identified using vulnerability scanning and asset management tools. If immediate patching is not possible, implement network-level mitigations and enhanced monitoring. After patching, verify the fix and scan for indicators of prior compromise.
How severe is CVE-2017-9841?
CVE-2017-9841 is rated CRITICAL with a CVSS 3.1 score of 9.8. Its EPSS score of 0.94210 places it in the 99.92th percentile for exploitation likelihood. The vulnerability has confirmed active exploitation in the wild and was required to be remediated by federal agencies by 2022-08-15 per CISA's KEV directive.
Need Help With Vulnerability Management?
Our security experts can help you prioritize and remediate vulnerabilities effectively.