Index Of Vendor Phpunit Phpunit Src Util Php Eval-stdin.php -
Use the --no-dev flag when deploying to production to prevent development tools (like PHPUnit) from being installed in the production environment.
composer install --no-dev --optimize-autoloader
Modern PHP development relies heavily on dependency managers like Composer. When developers install libraries such as PHPUnit, a vendor directory is created containing the framework's source code. A common architectural mistake is the exposure of this vendor directory to the public internet.
Inside this directory structure lies a specific file: src/Util/PHP/eval-stdin.php. This file was designed to facilitate PHPUnit's built-in code coverage and testing features. However, its design assumes it is being executed in a trusted, local environment. When exposed to the web, it becomes a critical security liability.
If an attacker can reach eval-stdin.php via HTTP, they can POST arbitrary PHP code to it. The script will evaluate that code, executing it with the privileges of the web server user. index of vendor phpunit phpunit src util php eval-stdin.php
Example exploit:
curl -X POST --data "<?php system('id'); ?>" http://target.com/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
Result: The server executes id and returns the output.
Why it works:
Apache (.htaccess or httpd.conf):
<Directory "/path/to/project/vendor">
Require all denied
</Directory>
Nginx:
location ~ /vendor/
deny all;
return 403;
The problem is not what the script does, but where it lives. This file resides inside the vendor/ directory, which in many misconfigured production environments is still accessible via the web root. Use the --no-dev flag when deploying to production
Consider a server where the document root points to /var/www/html/public, but the developer mistakenly set the root to /var/www/html/. An attacker could potentially request:
https://example.com/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
While the script itself expects input from stdin, the danger is often amplified by other server configurations or by combining it with PHP wrappers (e.g., php://input). In vulnerable versions, an attacker could POST raw PHP code directly to this endpoint and have it executed.
In essence, leaving eval-stdin.php in a web-accessible directory is equivalent to leaving a sign on your server that says: "Run any code you want here." Result: The server executes id and returns the output
