What is phpunit/src/Util/PHP/eval-stdin.php ?

Created 23rd January 2024
Updated 20th May 2024

CVE-2017-9841

A remote code execution vulnerability exists in older versions of PHPUnit (4.8.28 to 5.x < 5.6.3), specifically in the eval-stdin.php file. Searches for this file allow an attacker to abuse the RCE using a POST request with a payload in the body.

The RCE abuses an unchecked and unsanitized use of eval, where the contents of php://input are appended to a string.

In normal situations, this file is used by PHPUnit to execute code passed through standard input into the process. The file itself is not malicious but if uploaded to production or publicly accessible hosts, it can be used in an exploitative manner.

Check if your PHPUnit installation has been uploaded to a production or public environment, and determine if it should be there. Consider removing PHPUnit from production or restricting access.


References

  1. https://support.alertlogic.com/hc/en-us/articles/115005711043-PHPUnit-eval-stdin-php-Unauthenticated-RCE
  2. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9841
  3. https://github.com/sebastianbergmann/phpunit/commit/284a69fb88a2d0845d23f42974a583d8f59bf5a5

Other known request paths

  1. PHP/eval-stdin.php