Skip to main content
Mallory
CriticalExploited in the wildCISA KEVPublic exploitVulnerability

CVE-2017-9841: Unauthenticated Remote Code Execution in PHPUnit

Published Jun 27, 2017 · Updated 2 days ago
Trending this weekNot trendingOutside this week’s top 100
Mention activity · 30 days6 mentions · peak 1 in a dayToday
CVSS9.8Critical · v3.1
EPSS100.0%100th percentile
CISA KEVYesAdded Feb 15, 2022
In the wildActivePer CISA KEV
Vendors
Oracle CorporationPhpunit Project
IdentifiersCVE-2017-9841CWE-94 · Improper Control of Generation of…

CVE-2017-9841 is a code injection vulnerability affecting PHPUnit versions before 4.8.28 and 5.x before 5.6.3. PHPUnit's standard-input evaluation utility passes attacker-controlled input to eval(). When this utility is exposed through a PHP-enabled web server, a remote attacker can execute arbitrary PHP code by sending an HTTP POST body beginning with the substring "<?php ". Vulnerable copies bundled with applications, plugins, or modules can expose production servers even when PHPUnit is not intentionally deployed as a public service.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Analyst brief

Impact, mitigation & remediation

What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

Successful exploitation compromises the affected application's confidentiality, integrity, and availability within the permissions of the PHP execution context. Attackers can execute commands, read accessible application secrets, modify files, deploy web shells or other malware, and consume server resources for cryptocurrency mining. Stolen credentials or existing trust relationships may enable subsequent cloud-account compromise or lateral movement. Exploitation does not inherently grant root privileges.

Mitigation

If you can’t patch tonight, do this now.

Deny external HTTP access to dependency directories and the vulnerable PHPUnit evaluation utility using web-server access controls. Keep development and testing components outside publicly served directories. Use IDS/IPS controls to detect and block exploitation attempts, and monitor for unexpected PHP files, command execution, outbound payload downloads, and persistence changes. Apply least privilege and network segmentation to limit post-exploitation impact.

Remediation

Patch, then assume compromise.

Upgrade phpunit/phpunit to version 4.8.28 or later in the 4.8 branch, or version 5.6.3 or later in the 5.x branch. Inventory and update copies bundled with applications, plugins, modules, and container images. Remove obsolete vulnerable copies and residual eval-stdin.php files, which may remain after an update or uninstallation. Exclude unnecessary development dependencies from production deployments.

Public exploits

Exploits

11 exploits validated by Mallory's analysis. Hidden: 4 rejected by Mallory's analysis as not a working exploit; 3 not yet analyzed, such as Exploit-DB entries.

View more in app →
laravel-phpunit-rce-masscanerThis repository is a mass-scanner and exploit tool targeting CVE-2017-9841, a remote code execution vulnerability in the phpunit component commonly found in Laravel installations. The tool is written in Python and is structured with a main entry point (main.py) that accepts input as a file of hostnames, a range of IP addresses, or a single hostname. It uses multi-threading to scan multiple targets in parallel. The core exploit logic is in modules/executor.py and modules/request_module.py, where it constructs requests to the known vulnerable endpoint (/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php) and sends a PHP payload (<?php system('id');?>) to test for code execution. If the response contains evidence of command execution (such as 'uid='), the target is logged as vulnerable. The repository also includes a dorks.txt file with search queries to help find potentially vulnerable targets. The tool is operational and automates both scanning and exploitation, providing clear output logs for vulnerable and error cases.incogbyte · Disclosed Jul 4, 2021 · python · networkOperationalCVE-2017-9841This repository contains a single Python script (cve-2017-9841.py) that exploits CVE-2017-9841, a remote code execution vulnerability in PHPUnit 5.6.2. The script targets a specific URL (http://store.djewelry.htb:80) and attempts to access the eval-stdin.php file within the PHPUnit vendor directory. It provides an interactive shell-like interface, allowing the user to input arbitrary system commands, which are then sent to the vulnerable PHP file for execution. The output of the command is displayed to the user. The exploit is unauthenticated and leverages a PHP payload to execute commands. The repository is straightforward, containing only the exploit script, and is operational for attacking vulnerable PHPUnit installations where the eval-stdin.php file is exposed.akr3ch · Disclosed Mar 20, 2022 · python · networkOperationalCVE-2017-9841This repository contains a Python3 script ('phpunit-shell') that exploits CVE-2017-9841, a remote code execution vulnerability in PHPUnit (versions before 4.8.28 and 5.x before 5.6.3). The exploit works by sending a POST request to the exposed 'eval-stdin.php' file on the target server, injecting a PHP payload that executes arbitrary system commands provided by the attacker. The script provides an interactive shell-like interface, allowing the user to enter commands that are executed on the remote server. The README.md provides detailed usage instructions, prerequisites, and notes on accessibility features. The main fingerprintable endpoint is the path to 'eval-stdin.php', which must be accessible on the target for exploitation. The exploit is operational, providing a basic but functional command execution capability, and is intended as a gateway to further exploitation such as privilege escalation or obtaining a full shell.p1ckzi · Disclosed Apr 9, 2022 · python · networkOperationalPHPunit-ExploitThis repository contains a Python-based exploit and checker for CVE-2017-9841, a remote code execution vulnerability in PHPUnit. The main file, 'phpunit.py', is heavily obfuscated but is designed to scan for and exploit vulnerable PHPUnit installations accessible over the network. The exploit works by sending crafted requests to web servers hosting the vulnerable PHPUnit test script, allowing the attacker to execute arbitrary PHP code remotely. The repository includes a requirements.txt for dependencies (requests, colorama, pycryptodome) and a README.md with usage instructions and an overview. No hardcoded endpoints or IP addresses are present in the code; targets are likely specified by the user at runtime. The exploit is operational and can be used to both check for and exploit the vulnerability.MadExploits · Disclosed Dec 7, 2022 · python · networkOperationalCVE-2017-9841This repository provides an operational exploit and scanner for the Remote Code Execution (RCE) vulnerability in PHPUnit's eval-stdin.php (affecting versions before 4.8.28 and 5.x before 5.6.3). The main file, exploit.py, implements both mass scanning (from a list of URLs) and an interactive shell for single-target exploitation. The exploit works by sending a specially crafted PHP payload via HTTP POST to the /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php endpoint, which executes arbitrary system commands on the server and returns their output. The tool uses multi-threading for efficient scanning and provides colorized output and export features. The requirements.txt lists necessary Python dependencies. The README.md gives detailed usage instructions and describes the vulnerability. The exploit is not part of a framework and is a standalone operational tool for both detection and exploitation of the vulnerability.Chocapikk · Disclosed Aug 27, 2023 · python · text · networkOperationalCVE-2017-9841-EXPLOITThis repository contains a Go-based exploit for CVE-2017-9841, a remote code execution vulnerability in PHPUnit (versions <4.8.28 and 5.x <5.6.3). The exploit targets web servers with publicly accessible PHPUnit installations, specifically the eval-stdin.php file, which allows arbitrary PHP code execution via HTTP POST requests. The main file, CVE-2017-9841.go, first checks for vulnerability by sending a PHP payload that echoes an MD5 hash, confirming code execution if the hash is returned. If vulnerable, it provides an interactive shell interface, allowing the attacker to execute arbitrary system commands on the target server. The exploit scans for several common paths where eval-stdin.php may be located, covering various PHP frameworks (Laravel, Yii, Zend, etc.). The repository also includes a README.md with background, impact, affected versions, and remediation advice. The exploit is operational, providing a working shell but requiring manual command input.K3ysTr0K3R · Disclosed Jun 10, 2025 · go · networkOperationalabyss-c2This repository is a multi-module Python offensive framework centered on exploiting HiSilicon DVR/NVR/IP camera devices via CVE-2020-25078, then managing compromised hosts through a Flask/SocketIO web panel. It is not a simple single-file PoC: it includes a control server (server.py), persistence and post-exploitation tooling, credential attacks, recon modules, web vulnerability scanners, network service checks, pivoting, reverse shell support, and a SQLite-backed datastore. Core exploit logic is in exploit.py and scanner.py. exploit.py probes numerous traversal/disclosure paths such as /../../.../mnt/mtd/Config/Account1 and related config/system files, parses returned content with multiple regex patterns to recover credentials, fingerprints device families, and falls back to known default credentials when disclosure succeeds but parsing does not. scanner.py operationalizes this by scanning IPs/CIDRs and common ports, checking liveness, fingerprinting likely cameras, invoking the CVE-2020-25078 checks, and storing recovered credentials in cameras.db. Post-exploitation capability is substantial. telnet_client.py provides raw Telnet login and command execution. botnet.py fans out commands across stored hosts. persistence.py installs SSH authorized_keys, cron, rc.local, init.d, systemd, inittab telnetd, and bind-shell style persistence. reverse_shell.py generates many Linux/IoT reverse shell one-liners and runs listeners. pivot_chain.py and socks_pivot.py support chained execution and local SOCKS5 pivoting through compromised hosts. Additional modules broaden scope beyond the HiSilicon exploit: brute.py and cred_spray.py perform credential attacks across Telnet, SSH, FTP, HTTP, SMB, databases, VNC, LDAP, WinRM, and more; network_exploit.py checks for exposed/misconfigured services and some well-known vulnerabilities such as MS17-010 and BlueKeep; web_exploit.py, web_cves.py, web_bugs.py, and web_brute.py scan websites for exposed files, CMS fingerprints, generic bug classes, and multiple CVE signatures. Recon/intel support includes ASN, DNS, GeoIP, JARM, WAF detection, proxy/Tor rotation, screenshot grabbing from camera snapshot endpoints, and Telegram/Discord/AbuseIPDB integrations. The repository structure is coherent and functional, with many CLI-capable modules and a central web UI in templates/index.html. Overall, this is an operational exploit-and-post-exploitation toolkit focused on HiSilicon IoT devices but expanded into a broader C2-style offensive platform.flags-alt · Disclosed May 20, 2026 · python · html · network · web · localOperationaledu-reconedu-recon is a Python 3.10+ reconnaissance, vulnerability-triage, and active assessment orchestrator aimed at education-sector engagements. It has 38 files, primarily Python modules, with `recon.py` as the CLI entry point and `run.sh` as a one-command launcher. Its stdlib web UI (`edurecon/webui.py`) exposes scan submission, live logs, findings, report/reproduction generation, and dump functions; it defaults to localhost but can be bound to all interfaces without authentication. The engine expands CIDRs through nmap ping sweeps and domains through subdomain enumeration, then concurrently runs Shodan enrichment, nmap service/version scanning, dirsearch web discovery, exposure checks, secret/API-key scanning, Moodle auditing, reflected-XSS and SQLi checks, Hydra credential attacks, and WordPress wp2shell processing. Full intensity actively invokes sqlmap and Hydra; recon mode lists those candidates instead. It uses external repositories installed by `setup` for PHP-CGI, React2Shell, WordPress, and directory-scanning capabilities. Built-in CVE probes target PHPUnit eval-stdin RCE (CVE-2017-9841), Apache traversal/LFI (CVE-2021-41773), Struts S2-045 (CVE-2017-5638), Confluence OGNL RCE (CVE-2022-26134), Drupalgeddon2 (CVE-2018-7600), Next.js middleware bypass (CVE-2025-29927), PHP-CGI (CVE-2024-4577/CVE-2024-8926), and React Server Components RCE (CVE-2025-55182). Several internal checks use benign confirmation markers/arithmetic oracles, but the overall repository is an active exploitation platform: full mode can perform credential guessing and injection, external wp2shell can pursue SQLi-to-shell, and React2Shell can be configured away from safe-check mode to run a command. Notable collection functionality includes downloading exposed files and backups, scanning their contents for cloud/VCS/payment/API credentials, and `gitdump.py`, which mirrors an exposed `.git` directory, retrieves reachable loose Git objects, and reconstructs source files. Artifacts, reports, findings, and potentially sensitive material are stored under `runs/<run-id>/`; report code serializes evidence and can therefore retain sensitive values. ScopeGuard supports target/CIDR and subdomain allowlisting, but supplied documentation/configuration describe scope enforcement as disabled by default, materially increasing operator-supplied target risk.yeee3642 · Disclosed Aug 26, 2026 · python · bash · network · webOperationalCVE-2017-9841This four-file repository is a standalone Python 3 proof of concept for CVE-2017-9841, not a framework module. Its sole executable, CVE-2017-9841.py, uses the requests library to POST a generated PHP payload to a user-supplied base URL plus the default PHPUnit eval-stdin.php path. The payload embeds a base64-encoded, user-selected command, decodes it on the target, and executes it through system(). The tool supports a custom endpoint path, a configurable HTTP timeout, disables redirect following, displays response status/output, and returns success only for HTTP 200. README.md documents affected and fixed PHPUnit ranges, examples, authorization guidance, and the intended impact; requirements.txt pins requests to >=2.31,<3; LICENSE is GPLv3. The README's examples refer to exploit.py, while the actual script is named CVE-2017-9841.py.CheLover86 · Disclosed Oct 1, 2026 · python · webOperationalCVE-2017-9841This repository is a proof-of-concept exploit for CVE-2017-9841, a remote code execution vulnerability in PHPUnit. The exploit is implemented as a Python Flask web application (app.py) that provides a web interface (templates/index.html) for users to test remote servers for the vulnerability. The user supplies a target domain, and the application sends a POST request to the target's /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php endpoint with a PHP payload that executes the 'id' command. If the target is vulnerable, the output of the command is displayed in the web interface. The README provides setup instructions, including running a local vulnerable Docker container for testing. The repository contains three files: a README, the main Flask application, and an HTML template for the web interface. The exploit demonstrates remote code execution but does not provide a weaponized or customizable payload beyond the 'id' command.dream434 · Disclosed Nov 21, 2022 · python · html · networkPoCCVE-2017-9841This repository contains a Python-based scanner and exploit for CVE-2017-9841, a remote code execution vulnerability in PHPUnit's eval-stdin.php file. The main script, CVE-2017-9841.py, is a multi-threaded tool that takes a list of target URLs/domains and attempts to access several common paths where the vulnerable eval-stdin.php file may be exposed. For each accessible path, it sends a PHP payload (<?php echo md5('phpunit_rce'); ?>) and checks the response for the expected MD5 hash, confirming code execution. Vulnerable sites are logged to a timestamped file, and errors are similarly logged. The tool is designed for efficient mass scanning and validation, with configurable threading and robust output. The repository also includes a README.md with usage instructions and a requirements.txt listing Python dependencies. The exploit is a proof-of-concept scanner that demonstrates the vulnerability and identifies targets for potential further exploitation.joelindra · Disclosed Apr 22, 2025 · python · networkPoC
Exposure surface

Affected products & vendors

Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.

VendorProductType
Oracle CorporationCommunications Diameter Signaling Routerapplication
Phpunit ProjectPhpunitapplication
FAQ

Frequently asked questions

Is CVE-2017-9841 exploited in the wild?
Yes. As of Nov 26, 2026, Mallory has reports of exploitation in the wild, and CISA added it to KEV on Feb 15, 2022.
Is there a public exploit for CVE-2017-9841?
Yes. Mallory tracks 11 public exploits or proofs of concept for CVE-2017-9841, the earliest disclosed Jul 4, 2021.
Is there a patch for CVE-2017-9841?
Upgrade phpunit/phpunit to version 4.8.28 or later in the 4.8 branch, or version 5.6.3 or later in the 5.x branch. Inventory and update copies bundled with applications, plugins, modules, and container images.
What products are affected by CVE-2017-9841?
Phpunit Project Phpunit and Oracle Corporation Communications Diameter Signaling Router.
How severe is CVE-2017-9841?
CVE-2017-9841 has a CVSS v3.1 score of 9.8 (Critical) and an EPSS score of 100.0% (100th percentile) as of Nov 26, 2026.
Activity feed

Recent activity

147 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.

View more in app →
shadowserver newsNews · Nov 25, 2026Agentic AI Attack Frameworks in the Wild: What Our Scans and Honeypots Show | The Shadowserver FoundationA PHPUnit vulnerability targeted by exploit or injection payloads from IP addresses running agentic AI attack frameworks. The report documents exploitation attempts against honeypots but does not establish successful compromise or describe the vulnerability's technical mechanism.Read more ↗thor collective dispatchNews · Nov 12, 2026I leaked credentials on purpose for four months. Here’s who took them, and what they did next.A PHPUnit vulnerability targeted by 188 distinct IPs probing the honeypot. Payload analysis also linked the PHPUnit exploitation route to a self-spreading botnet installer. The honeypot simulated vulnerability, so these observations demonstrate attack attempts rather than successful compromise of the monitored server.Read more ↗malwaremustdie blogNews · Nov 11, 2026Malware Must Die!: MMD-071-2026 - Linux/KinsingBot a "bad-bad"-designed botnet a while ago.. until recent.A PHPUnit remote code execution vulnerability listed among vulnerabilities exploited by Kinsing in later or other campaigns.Read more ↗vulncheck blogNews · Oct 13, 2026Expanding Visibility Into Chinese Government-linked Cyber Threat Actors | Blog | VulnCheckA PHPUnit vulnerability probed through eval-stdin.php using PHP code that returns a validation hash. The Hong Kong source tested dozens of installation locations in connections also carrying RedTail-family exploitation payloads.Read more ↗
+40 more in the timeline. Sign up to see them
Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Mallory platform

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, and which detections to deploy tonight.
Exposure mappingQuery your assets running an affected version, and investigate the blast radius.
Threat actor evidence5Every report linking this CVE to a named adversary.
Associated malware38Malware families linked to this CVE, with evidence and IOCs.
Detection signatures2YARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Vendor-by-vendor mappingCross-references every affected SKU, including bundled OEM variants.
Social activity100Community discussion across Reddit, Mastodon, and other social sources.