Vendor Phpunit Phpunit Src Util Php Eval-stdin.php Cve [ 2026 Release ]
The vulnerability, identified as CVE-2022-0847, affects PHPUnit versions prior to 9.5.0. It resides in the util.php file within the src directory of PHPUnit, specifically in the eval-stdin.php script. This script is used to evaluate PHP code from standard input.
There are three primary ways to address this vulnerability:
The critical flaw in this script stems from a single line of code: eval('?>' . file_get_contents('php://input')); Use code with caution. Why This Is Dangerous
A proof-of-concept exploit has been publicly disclosed, demonstrating how an attacker can execute arbitrary code on a vulnerable system. The exploit involves providing malicious input to the eval-stdin.php script, which is then executed by the vulnerable PHPUnit instance. vendor phpunit phpunit src util php eval-stdin.php cve
To obtain the patch, update your PHPUnit installation to version 9.5.0 or later using Composer:
Many developers leave the vendor folder exposed to the public through improper web server configurations (e.g., pointing the document root to the project root instead of the /public folder).
Full server compromise, data theft, and malware installation, such as the Androxgh0st malware often seen targeting this exploit in 2024 and 2025. Affected Versions PHPUnit 4.x: Versions before 4.8.28. PHPUnit 5.x: Versions before 5.6.3. PHPUnit.Eval-stdin.PHP.Remote.Code.Execution There are three primary ways to address this
Development tools (like PHPUnit) were included in the production build rather than being limited to development. 3. How to Remediate
is a critical remote code execution (RCE) vulnerability in the PHPUnit testing framework. It allows unauthenticated attackers to execute arbitrary PHP code on a server if the PHPUnit source files are publicly accessible. Vulnerability Breakdown Path: vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php .
A successful exploitation of this PHPUnit RCE flaw leads to full system compromise. Consequences include: The exploit involves providing malicious input to the
if (isset($GLOBALS['__PHPUNIT_EVAL_STDIN__']) && $GLOBALS['__PHPUNIT_EVAL_STDIN__'] === true) $code = trim(stream_get_contents(STDIN)); if (empty($code)) exit;
By taking these steps, you can help protect your applications against the CVE-2022-24847 vulnerability and ensure the security and integrity of your data.
: PHPUnit versions before 4.8.28 and all 5.x versions before 5.6.3 . Why This Happens