# CVE-2017-9841: PHPUnit Command Injection

> Remote attackers can execute arbitrary PHP code if the PHPUnit eval-stdin.php file is exposed via HTTP POST requests.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Yes, since 15 Feb 2022 (CISA KEV)
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 27 Jun 2017
- **Updated:** 21 Oct 2025
- **Also known as:** DEBIAN-CVE-2017-9841, GHSA-r7c9-c69m-rph8, UBUNTU-CVE-2017-9841, USN-7171-1

## What is CVE-2017-9841?

CVE-2017-9841 is a critical code injection vulnerability in Oracle Communications Diameter Signaling Router, published on 27 Jun 2017. An attacker can exploit it over the internet without logging in, with no action from the victim.

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

Weakness: CWE-94 (Improper Control of Generation of Code)

## Which versions are affected by CVE-2017-9841?

4 open source packages ship an affected version, including phpunit/phpunit. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `phpunit/phpunit` | Packagist | From 4.8.19 | 4.8.28 |
| `phpunit/phpunit` | Packagist | From 4.8.19 | 4.8.28 |
| `phpunit/phpunit` | Packagist | From 5.0.10 | 5.6.3 |
| `phpunit/phpunit` | Packagist | From 5.0.10 | 5.6.3 |

Products: Oracle Communications Diameter Signaling Router, Phpunit Project Phpunit.

## How do I fix CVE-2017-9841?

Upgrade phpunit/phpunit to a fixed version for your release line: 4.8.28 or 5.6.3. US federal agencies must fix it by 15 Aug 2022.

## Is CVE-2017-9841 being exploited?

Yes. Attackers have exploited CVE-2017-9841 in the wild since at least 15 Feb 2022.

Public exploit code:

- Tool to try multiple paths for PHPunit RCE CVE-2017-9841 (github_poc): https://github.com/RandomRobbieBF/phpunit-brute
- Masscanner for Laravel phpunit  RCE CVE-2017-9841 (github_poc): https://github.com/incogbyte/laravel-phpunit-rce-masscaner
- PHPUnit RCE (github_poc): https://github.com/Chocapikk/CVE-2017-9841
- (CVE-2017-9841) PHPUnit_eval-stdin_php Remote Code Execution (github_poc): https://github.com/ludy-dev/PHPUnit_eval-stdin_RCE
- PHPunit Checker CVE-2017-9841 By MrMad (github_poc): https://github.com/MadExploits/PHPunit-Exploit
- PHPUnit CVE-2017-9841 Scanner in Go  clean and fire. (github_poc): https://github.com/drcrypterdotru/PHPUnit-GoScan

## Other vulnerabilities in Oracle Communications Diameter Signaling Router

- [CVE-2019-2729](https://insights.sbomify.com/CVE-2019-2729/): Auth bypass in WebLogic Server (critical 9.8)
- [CVE-2019-2399](https://insights.sbomify.com/CVE-2019-2399/): Information disclosure in Communications Diameter Signaling Router (DSR) (medium 6.5)
- [CVE-2020-14788](https://insights.sbomify.com/CVE-2020-14788/): Cross-site scripting in Communications Diameter Signaling Router (DSR) (medium 6.1)
- [CVE-2020-14787](https://insights.sbomify.com/CVE-2020-14787/): Cross-site scripting in Communications Diameter Signaling Router (DSR) (medium 5.4)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2017-9841 and fix it if it is affected.

What it is: CVE-2017-9841 is a critical code injection vulnerability in Oracle Communications Diameter Signaling Router, published on 27 Jun 2017. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: Yes. Attackers have exploited CVE-2017-9841 in the wild since at least 15 Feb 2022.

Affected packages and fixed versions:
- phpunit/phpunit (Packagist): affected from 4.8.19; fixed in 4.8.28
- phpunit/phpunit (Packagist): affected from 4.8.19; fixed in 4.8.28
- phpunit/phpunit (Packagist): affected from 5.0.10; fixed in 5.6.3
- phpunit/phpunit (Packagist): affected from 5.0.10; fixed in 5.6.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2017-9841/ (Markdown: https://insights.sbomify.com/CVE-2017-9841/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2017-9841
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2017-9841
- OSV: https://osv.dev/vulnerability/CVE-2017-9841

---
From sbomify Insights: https://insights.sbomify.com/CVE-2017-9841/
Summaries are generated and may contain mistakes; the official description above is the record.
