vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php (CVE-2017-9841)Check for the file:
find /var/www/html -name "eval-stdin.php" -type f
Check web server logs for suspicious POST requests:
grep "eval-stdin.php" /var/log/nginx/access.log | grep "POST"
grep "eval-stdin.php" /var/log/apache2/access.log
Look for anomalies:
cmd.php, x.php)curl, wget, nc, bash)This is the primary vulnerability associated with that file path.
vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.phpcomposer install --no-dev incorrectly or not at all, leaving development tools in production.vendor directory: Many developers expose the entire vendor/ directory in the web root without proper .htaccess or web server rules to block access.The vulnerability exists because the eval-stdin.php file allows execution of arbitrary PHP code via the HTTP POST body. vendor phpunit phpunit src util php eval-stdin.php cve
php://stdin (standard input) and passes it directly to the eval() function.http://target.com/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php in a browser), the server will execute any code sent in the body of the HTTP POST request.www-data or apache). This allows them to take control of the system, steal data, or deface the website.Update PHPUnit (if used in production – which it shouldn’t be):
composer require --dev phpunit/phpunit:^5.6.3
Remove PHPUnit from production entirely: Check for the file : find /var/www/html -name "eval-stdin
composer install --no-dev
Block access to /vendor/ via web server configuration:
.htaccess):
<Directory "vendor">
Require all denied
</Directory>
location ~ /vendor/
deny all;
return 403;
Scan for backdoors if the server was previously vulnerable. Check web server logs for suspicious POST requests: