# CVE-2017-9841: Code Injection in PHPUnit

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** CRITICAL 9.8
- **CVSS:** 9.8 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- **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
- **Exploited in the wild:** Yes: in CISA KEV since 2022-02-15; federal due date 2022-08-15
- **Public exploit / PoC:** Yes (see exploit references)
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 100.00% (percentile 100, 2026-11-26)
- **CWE:** CWE-94
- **Aliases:** EDB-50702, GHSA-r7c9-c69m-rph8
- **Published:** 2017-06-27T17:00:00.000Z
- **Modified:** 2026-06-17T01:29:01.517Z

## 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)

## 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

- Packagist `phpunit/phpunit`: affected \>= 4.8.19, \< 4.8.28; fixed 4.8.28, 5.6.3 (osv)
- n/a: see vendor advisory (nvd)

## Mitigation

- Upgrade phpunit/phpunit to one of 4.8.28, 5.6.3 (or later in the same release line).

## 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 a coding agent:

```text
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.
```

## 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.

## References

- vendor: <https://security.gentoo.org/glsa/201711-15>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2017-9841>
- patch: <https://www.oracle.com/security-alerts/cpuoct2021.html>
- patch: <https://github.com/sebastianbergmann/phpunit/commit/284a69fb88a2d0845d23f42974a583d8f59bf5a5>
- patch: <https://github.com/sebastianbergmann/phpunit/pull/1956>
- patch: <https://github.com/sebastianbergmann/phpunit/pull/1955>
- patch: <https://github.com/sebastianbergmann/phpunit/commit/3aaddb1c5bd9b9b8d070b4cf120e71c36fd08412>
- exploit: <https://www.exploit-db.com/exploits/50702>
- other: <http://www.securityfocus.com/bid/101798>
- other: <http://www.securitytracker.com/id/1039812>
- other: <http://web.archive.org/web/20170701212357/http://phpunit.vulnbusters.com/>
- other: <https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2017-9841>
- other: <https://github.com/FriendsOfPHP/security-advisories/blob/master/phpunit/phpunit/CVE-2017-9841.yaml>
- other: <https://github.com/sebastianbergmann/phpunit>
- other: <http://web.archive.org/web/20170701212357/http://phpunit.vulnbusters.com>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2017-9841>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-r7c9-c69m-rph8> (license: <https://creativecommons.org/licenses/by/4.0/>)
- Exploit-DB: Exploit metadata (ID and link only) from the Exploit Database <https://www.exploit-db.com/exploits/50702>
- CISA KEV: CISA Known Exploited Vulnerabilities Catalog <https://www.cisa.gov/known-exploited-vulnerabilities-catalog>

HTML: <https://flawdb.com/CVE-2017-9841> · JSON: <https://flawdb.com/api/v1/entries/CVE-2017-9841>
