---
id: "CVE-2017-9841"
kind: "vulnerability"
aliases: ["CVE-2017-9841"]
title: "PHPUnit PHPUnit: PHPUnit Command Injection Vulnerability"
severity: "critical"
cvss: 9.8
epss: 0.99999
exploited: true
status: "open"
category: "package"
products: [{"name": "PHPUnit PHPUnit", "fixed": [], "affected": "", "ecosystem": "vendor"}]
ecosystems: ["vendor"]
tags: ["composer", "exploited", "package", "php", "phpunit", "self-hosted", "web-apps"]
not_affected_if: ["phpunit-not-in-production", "vendor-dir-not-web-accessible"]
published_at: "2017-06-27T17:29:00+00:00"
first_seen_at: "2026-10-23T19:11:52+00:00"
updated_at: "2026-10-23T21:57:35+00:00"
sources: [{"source": "kev", "url": "https://www.cisa.gov/known-exploited-vulnerabilities-catalog?search_api_fulltext=CVE-2017-9841", "first_seen_at": "2026-10-23T19:11:52+00:00"}, {"source": "epss", "url": "https://api.first.org/data/v1/epss?cve=CVE-2017-9841", "first_seen_at": "2026-10-23T19:13:44+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2017-9841", "first_seen_at": "2026-10-23T21:57:35+00:00"}]
---

# PHPUnit PHPUnit: PHPUnit Command Injection Vulnerability

PHPUnit's eval-stdin.php script executes any PHP code sent in an HTTP POST body that starts with "<?php ". An attacker who can reach that file over the web runs arbitrary code on the server.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- vendor:PHPUnit PHPUnit affected ? fixed ?

## How to check

Check whether a web-reachable path exposes /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php, for example: curl -I https://your-site/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
Check whether phpunit is installed in production: composer show phpunit/phpunit

## Fix

Remove phpunit from production dependencies (composer install --no-dev) and block public access to the /vendor directory.
Update PHPUnit to a fixed version per vendor instructions; exact fixed version not stated in the sources.

## Timeline

- 2026-10-23T19:11:52+00:00 kev https://www.cisa.gov/known-exploited-vulnerabilities-catalog?search_api_fulltext=CVE-2017-9841
- 2026-10-23T19:13:44+00:00 epss https://api.first.org/data/v1/epss?cve=CVE-2017-9841
- 2026-10-23T21:57:35+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2017-9841

## From the sources

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.

CISA required action: Apply updates per vendor instructions.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
