Hôm nay Chủ Nhật, 14th Tháng Mười Hai 2025
Thập Niên 60 - Thập Niên 70 - Thập Niên 80 - Thập Niên 90 - Thập Niên 2000 - Mới 2025

(Muốn thêm Idol vào thư viện tìm kiếm liên hệ clbphimxua@gmail.com)

Vendor Phpunit Phpunit Src Util Php Eval-stdin.php Exploit Today

Run this on your web servers:

find /var/www -path "*/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php" -exec ls -la {} \;

If any results appear, assume compromise.


The vulnerability exists in the file vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php. The contents of the file in vulnerable versions are minimal and look roughly like this:

<?php
/*
 * This file is part of PHPUnit.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 */
// ... license header ...
eval('?>' . file_get_contents('php://input'));

Summary

Affected component

Risk

Technical details (concise)

Indicators of compromise

Immediate mitigation steps (prioritize)

  • Restrict access:
  • Update dependencies:
  • Audit & remediate compromise:
  • Long-term remediation & best practices

    Quick detection commands (examples)

  • Webserver log search:
  • Check composer dev dependencies on prod:
  • CVE / references

    Action plan (recommended)

    If you want, I can:

    The path vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php refers to a well-known Remote Code Execution (RCE) vulnerability tracked as CVE-2017-9841. Despite being disclosed in 2017, it remains a common target for automated bots and malware like Androxgh0st due to frequent misconfigurations in production environments. The Core Vulnerability vendor phpunit phpunit src util php eval-stdin.php exploit

    The exploit targets the eval-stdin.php file, which was originally intended to help PHPUnit execute code through a command-line interface.

    The Flaw: In vulnerable versions, this script used eval() on data pulled from php://input.

    The Attack: Because php://input reads raw data from the body of an HTTP request, a remote attacker can send a POST request containing malicious PHP code.

    Result: The server executes the attacker's code, potentially allowing them to steal environment variables (like .env files), access databases, or install persistent malware. Why Is It Still Relevant?

    This vulnerability is almost exclusively found on servers where the /vendor directory is publicly accessible. In a secure setup, the /vendor folder (containing all project dependencies) should be located outside the web server's public document root. Attackers continue to scan for this path because many legacy sites and misconfigured CMS modules (such as those in older versions of WordPress or PrestaShop) still leave it exposed. How to Fix It

    If you see scans for this path in your logs, or if you suspect your site is vulnerable, take these steps:

    Restrict Access: Ensure your web server configuration (e.g., .htaccess or Nginx config) explicitly denies public access to the /vendor directory.

    Clean Production: When deploying via Composer, always use the --no-dev flag (e.g., composer install --no-dev) to ensure testing tools like PHPUnit are never installed on live servers.

    Update PHPUnit: The vulnerability was patched in PHPUnit 4.8.28 and 5.6.3. Ensure you are running a modern version.

    Audit Your Environment: Check for unauthorized files in your /vendor path or any unusual outgoing connections, which could indicate a successful breach. CVE-2017-9841 Detail - NVD

    NIST: NVD. Base Score: 7.5 HIGH. Vector: (AV:N/AC:L/Au:N/C:P/I:P/A:P) National Institute of Standards and Technology (.gov)

    The exploit targeting vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php

    refers to a critical Remote Code Execution (RCE) vulnerability tracked as CVE-2017-9841

    . It allows an unauthenticated remote attacker to execute arbitrary PHP code on a server where PHPUnit is incorrectly exposed in a public web directory. National Institute of Standards and Technology (.gov) Core Mechanism Run this on your web servers: find /var/www

    The vulnerability exists because the script was designed to facilitate unit testing by reading PHP code from standard input (stdin) and executing it. The Vulnerable Code : In affected versions, the file contained: eval('?>' . file_get_contents('php://input')); Exploitation Method php://input

    wrapper reads raw data from the body of an HTTP request. An attacker can send an HTTP POST request to the file's URI containing malicious PHP code (beginning with ) in the request body.

    : The server processes the POST data as PHP code and executes it immediately within the context of the web application user. National Institute of Standards and Technology (.gov) Affected Versions PHPUnit 4.x : Prior to PHPUnit 5.x : Prior to National Institute of Standards and Technology (.gov) Why It Happens This exploit typically occurs when the

    directory—intended only for internal server-side use—is accessible from the web server's document root. This often happens due to: Misconfigured Web Servers : Failure to restrict access to the folder via or server config. Incorrect Deployment

    : Shipping development dependencies (like PHPUnit) to production environments rather than using composer install --no-dev vulhub/phpunit/CVE-2017-9841/README.md at master - GitHub

    PHPUnit Remote Code Execution (CVE-2017-9841) ... PHPUnit is a programmer-oriented testing framework for PHP. Util/PHP/eval-stdin. PHPUnit.Eval-stdin.PHP.Remote.Code.Execution

    In the world of web security, few ghosts haunt production servers as persistently as CVE-2017-9841

    , a vulnerability tucked away in the PHPUnit testing framework. This story isn't just about a bug; it's about how a tiny utility script designed for testing became one of the most exploited backdoors on the internet. The Unintended Backdoor

    Imagine a developer building a sleek new web application. To ensure everything works perfectly, they use

    , the industry-standard testing tool. Deep within its source code sits a small file: eval-stdin.php

    This file was designed for a simple, helpful purpose: to allow the framework to run PHP code sent through "standard input". In a safe development environment, this is just a tool. But when that developer pushes their code to production—accidentally including the entire

    folder where PHPUnit lives—the utility becomes a master key for attackers. The Anatomy of the Attack

    Exploiting this flaw is almost "too easy," making it a favorite for automated botnets like Androxgh0st . The vulnerability requires zero authentication ; an attacker doesn't need a password or an account.

    : Attackers use massive scanning networks to hunt for the specific path: /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php The Payload : Once found, they send a simple HTTP POST request The Execution : If the body of that request starts with eval-stdin.php If any results appear, assume compromise

    script blindly takes whatever follows and executes it directly on the server.

    The specific file path you mentioned ( vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php ) is associated with a famous Remote Code Execution (RCE) vulnerability tracked as CVE-2017-9841 The Vulnerability Explained This security flaw exists because the eval-stdin.php

    script was designed to receive PHP code via the standard input (stdin) and execute it using the function [2, 3]. The Intent:

    It was originally intended to help PHPUnit run tests in separate processes [2]. The Exploit:

    If this file is left accessible in a web-accessible directory (like a public folder), an attacker can send a

    request containing arbitrary PHP code to that URL. The server will then execute that code with the same permissions as the web server [1, 3]. How to Mitigate It If you are managing a project where this file exists: Restrict Access: Ensure your

    directory is not publicly accessible via your web server configuration (e.g., move it outside the public_html root) [1]. Update PHPUnit:

    This issue was patched in 2017. Ensure you are using a supported, up-to-date version of PHPUnit (versions 4.8.28, 5.6.3, and newer are safe) [2]. Delete Development Tools:

    Never deploy development dependencies (like PHPUnit) to a production environment. Use composer install --no-dev when deploying [1]. web server configuration to ensure your vendor folder is properly protected?

    Let's look at a simplified version of the vulnerable code present in PHPUnit versions before 4.8.28 and 5.6.3:

    <?php
    // vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
    while (($input = file_get_contents('php://input')) !== '') 
        eval('?>' . $input);
    

    The Disaster Logic:

    In essence, this file says: "Dear internet, please send me any PHP code you like. I promise to run it immediately."


    | Factor | Explanation | |--------|-------------| | No authentication | The script requires no login, token, or special header. | | Trivial to find | Attackers use automated scanners to crawl for /vendor/phpunit/.../eval-stdin.php. | | Low attack complexity | Any network-level attacker can exploit it; no user interaction needed. | | Full RCE | Attackers can execute arbitrary system commands, not just PHP functions. | | Privilege context | The script runs with the web server user’s privileges (e.g., www-data), often with read access to files and write access to certain directories. |

    The impact is severe. Successful exploitation grants the attacker the ability to execute arbitrary code with the privileges of the web server user (often www-data or apache). This can lead to:

    You might think a vulnerability from 2017 would be extinct. Yet, scanners still find thousands of exposed instances. Reasons include:

    2
    0
    Rất thích suy nghĩ của bạn, hãy bình luận.x