Keep in mind that this is a fictional example and should not be used for actual exploitation. Always ensure you have permission to test and exploit vulnerabilities.
| Factor | Explanation | |--------|-------------| | | 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. |
Upgrade to the latest stable version.
The safest and most straightforward remediation is upgrading to a patched version:
— PHPUnit-GoScan provides multithreaded scanning across multiple domains, automatically detecting the vulnerable endpoint and confirming RCE.
The exposure is not limited to applications that explicitly require PHPUnit. Because PHPUnit is often installed as a dependency for other plugins or modules, many third-party platforms have been affected, including:
: Multiple modules historically included vulnerable copies of PHPUnit within their own directories.
// Vulnerable code structure inside eval-stdin.php eval(file_get_contents('php://stdin')); Use code with caution.
The exploitation process is alarmingly simple. The vulnerable code in eval-stdin.php performs the following action:
This public link is valid for 7 days and shares a thread, including any personal information you added. This link or copies made by others cannot be deleted. If you share with third parties, their policies apply. Can’t copy the link right now. Try again later.
In affected versions (specifically PHPUnit < 4.8.28 and < 5.6.3), this file is designed to facilitate the execution of code sent via standard input, primarily used by the testing framework to run isolated tests. The core logic of the file is simple and dangerous:
If you cannot immediately update the framework or change server configurations, delete the vulnerable file manually from your server as a temporary workaround. rm vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php Use code with caution.
Now, the attacker can simply visit https://target.com/shell.php?cmd=whoami and maintain access indefinitely, even after the original eval-stdin.php is removed.
This article provides a comprehensive overview of the eval-stdin.php exploit, how it works, how it is used by malicious actors, and how to protect your applications. What is the eval-stdin.php Exploit?