eval-stdin.php for Remote Code Execution (RCE)CVE IDs: CVE-2017-9841 (Primary), related to component usage.
Affected Component: <phpunit>/src/Util/PHP/eval-stdin.php
Severity: Critical (CVSS 9.8)
Affected Versions: PHPUnit before 4.8.28 and 5.x before 5.6.3.
Sometimes, a 200 OK response might come from a custom error handler or a dummy file. To confirm, send a benign mathematical operation: vendor phpunit phpunit src util php eval-stdin.php exploit
curl -X POST https://target.com/eval-stdin.php -d "<?php echo 5*5; ?>"
If the response contains 25, it is 100% vulnerable. Title: Exploiting PHPUnit's eval-stdin
| Factor | Explanation |
|--------|-------------|
| No authentication | The script requires no login, token, or special header. |
| Trivial to find | Attackers use automated scanners to crawl for /vendor/phpunit/.../eval-stdin.php. |
| Low attack complexity | Any network-level attacker can exploit it; no user interaction needed. |
| Full RCE | Attackers can execute arbitrary system commands, not just PHP functions. |
| Privilege context | The script runs with the web server user’s privileges (e.g., www-data), often with read access to files and write access to certain directories. | References
Run this command from your project root to see if you are vulnerable:
find . -path "*/phpunit/src/Util/PHP/eval-stdin.php" -exec ls -la {} \;
If the file exists and you are in a production environment, assume compromise.
The vulnerability exists in the file vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php. The contents of the file in vulnerable versions are minimal and look roughly like this:
<?php
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*/
// ... license header ...
eval('?>' . file_get_contents('php://input'));