PoC Monitor
← All CVEs
CVE-2017-9841published 27 Jun 2017 17:00 UTCData: JSON · API

PHPUnit

PHPUnit Command Injection Vulnerability

Util/PHP/eval-stdin.php in PHPUnit before 4.8.28 and 5.x before 5.6.3 allows remote attackers to execute arbitrary PHP code via HTTP POST data beginning with a "<?php " substring, as demonstrated by an attack on a site with an exposed /vendor folder, i.e., external access to the /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php URI.

First public PoC 2.5 yearsafter publication · 6 Jan 2020
Public PoCs2220 on GitHub · 2 Exploit-DB, Metasploit or nuclei
CVSS9.8critical · scored by CISA ADP · CWE-94
CISA KEV 15 Feb 20224.6 years after publication

Affected versions and mitigation

From the CVE record, GitHub Security Advisories and the vendor's references.

Affected

phpunit/phpunit (Packagist)
  • >= 4.8.19, < 4.8.28

Fixed in 4.8.28

from GitHub Security Advisory GHSA-r7c9-c69m-rph8

phpunit/phpunit (Packagist)
  • >= 5.0.10, < 5.6.3

Fixed in 5.6.3

from GitHub Security Advisory GHSA-r7c9-c69m-rph8

Mitigation

Upgrade phpunit/phpunit to 4.8.28 or later.

Upgrade phpunit/phpunit to 5.6.3 or later.

Timeline

Days relative to CVE publication
t=0+1 y+2 y+3 y+4 yCVE published27 Jun 2017 · t = 0First public PoC6 Jan 2020 · t+2.5yAdded to CISA KEV15 Feb 2022 · t+4.6y

First public PoC 2.5 years after publication; added to CISA KEV 4.6 years after publication. First PoC: mbrasile/CVE-2017-9841 (created 6 Jan 2020, found by us: backfilled).

PoC repositories

Found on GitHub.

20 PoCs · 3 pending · 2 informational · 1 suspicious or fake

PoCs 20
RepositoryCreatedFound by usStarsAssessment
mbrasile/CVE-2017-9841 6 Jan 2020 +2.5 y backfilled 0 PoC via PoC Index
RandomRobbieBF/phpunit-brute 18 May 2020 +2.9 y backfilled 28 PoC
cyberharsh/Php-unit-CVE-2017-9841 24 Jun 2020 +3.0 y backfilled 0 PoC
ludy-dev/PHPUnit_eval-stdin_RCE 14 Sep 2020 +3.2 y backfilled 6 PoC
Flags · score 15
  • owner account created less than 30 days before the repo

Below the suspicion threshold (50); does not change the assessment.

incogbyte/laravel-phpunit-rce-masscaner 4 Jul 2021 +4.0 y backfilled 23 PoC
akr3ch/CVE-2017-9841 20 Mar 2022 +4.7 y backfilled 3 PoC
jax7sec/CVE-2017-9841 20 Apr 2022 +4.8 y backfilled 0 PoC
Flags · score 15
  • owner account created less than 30 days before the repo

Below the suspicion threshold (50); does not change the assessment.

Jhonsonwannaa/CVE-2017-9841- 21 Nov 2022 +5.4 y backfilled 1 PoC
dream434/CVE-2017-9841 21 Nov 2022 +5.4 y backfilled 1 PoC
dream434/CVE-2017-9841- 21 Nov 2022 +5.4 y backfilled 1 PoC
MadExploits/PHPunit-Exploit 7 Dec 2022 +5.4 y backfilled 5 PoC via PoC Index
MrG3P5/CVE-2017-9841 13 Mar 2023 +5.7 y backfilled 4 PoC
Chocapikk/CVE-2017-9841 27 Aug 2023 +6.2 y backfilled 7 PoC
Mariam-kabu/cybersec-labs 22 Apr 2024 +6.8 y backfilled 1 PoC
moonwayy/hindicybersec 22 Apr 2024 +6.8 y backfilled 1 PoC
marvinoon/P1BG3-ExploitScan 25 Feb 2025 +7.7 y backfilled 0 PoC
drcrypterdotru/PHPUnit-GoScan 30 Aug 2025 +8.2 y backfilled 5 Scanner
Flags · score 35
  • README asks to download a release/binary/archive

Below the suspicion threshold (50); does not change the assessment.

krisdewa/CVE-2017-9841-PHPUnit-Remote-Code-Execution-PoC 11 Jun 2026 +9.0 y backfilled 0 PoC
CyberCTF/vulhub-phpunit-cve-2017-9841 8 Oct 2026 +9.3 y backfilled 0 PoC
lnlight05/Information-Security-Work1 20 Oct 2026 +9.3 y 14 Nov 2026 0 PoC
Pending 3
RepositoryCreatedStarsAssessment
K3ysTr0K3R/CVE-2017-9841-EXPLOIT unknown 0 Pending · repository unavailable (HTTP 404)
Pwdnx1337/CVE-2017-9841 unknown 0 Pending · repository unavailable (HTTP 404)
yoloskr/CVE-2017-9841-Scan unknown 0 Pending · repository unavailable (HTTP 404)
Informational 2
RepositoryCreatedStarsAssessment
p1ckzi/CVE-2017-9841 9 Apr 2022 +4.8 y 3 Informational · write-up
joelindra/CVE-2017-9841 22 Apr 2025 +7.8 y 1 Informational · list
Suspicious or fake 1
RepositoryCreatedStarsAssessment
mileticluka1/eval-stdin 20 Oct 2022 +5.3 y 0 Fake

Only PoCs count toward the first-PoC date and the characteristics below. "Backfilled" means we found the repository more than 30 days after it was created. Do not run PoC code from unknown sources.

Other public exploits

Exploit-DB, Metasploit and nuclei count as public PoCs. Exploit-tagged references from the CVE record and NVD are links only. None of these are analysed by us.
SourceTitlePublishedFound by us
Exploit-DBPHP Unit 4.8.28 - Remote Code Execution (RCE) (Unauthenticated)2 Feb 202214 Nov 2026
nuclei templatenuclei template: PHPUnit - Remote Code Execution27 Apr 202314 Nov 2026

PoC characteristics

What to hunt for in your logs · from 20 PoC repos

POST /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php

Body markers
<?php echo '[S]'; echo(shell_exec(' <?php system('id'); ?> <?php echo 'PWNED-'.(7*7); ?>= in application/x-www-form-urlencoded
Ports
5000, 8080
Seen in
5 repos: Chocapikk/CVE-2017-9841, Jhonsonwannaa/CVE-2017-9841-, dream434/CVE-2017-9841, dream434/CVE-2017-9841-, lnlight05/Information-Security-Work1
Evidence
Chocapikk/CVE-2017-9841/exploit.py:28 Jhonsonwannaa/CVE-2017-9841-/app.py:23 dream434/CVE-2017-9841/app.py:23 dream434/CVE-2017-9841-/app.py:23 lnlight05/Information-Security-Work1/README.md:170 lnlight05/Information-Security-Work1/README.md:244

GET /

Query
q= file=../../../../etc/passwd cmd=whoami
Body markers
<?php echo md5(phpunit_rce); ?> in text/html
PoC User-Agent
Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0
Seen in
2 repos: MrG3P5/CVE-2017-9841, marvinoon/P1BG3-ExploitScan
Evidence
MrG3P5/CVE-2017-9841/main.py:35 marvinoon/P1BG3-ExploitScan/background.js:45 marvinoon/P1BG3-ExploitScan/background.js:71 marvinoon/P1BG3-ExploitScan/background.js:150 marvinoon/P1BG3-ExploitScan/background.js:167

GET /dashboard

Key headers
Cookie: data={var}
Ports
32409
Seen in
2 repos: Mariam-kabu/cybersec-labs, moonwayy/hindicybersec
Evidence
Mariam-kabu/cybersec-labs/Payload.py:12 moonwayy/hindicybersec/Payload.py:12

GET /fetch/https://nginx.org/en/download.html";

Seen in
1 repo: marvinoon/P1BG3-ExploitScan
Evidence
marvinoon/P1BG3-ExploitScan/background.js:17

GET /vendor/phpunit/phpunit/ChangeLog-5.6.md

Ports
8080
Seen in
1 repo: CyberCTF/vulhub-phpunit-cve-2017-9841
Evidence
CyberCTF/vulhub-phpunit-cve-2017-9841/checks/phpunit.sh:4

GET /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php

Body markers
<?php system("
Ports
80
Seen in
1 repo: akr3ch/CVE-2017-9841
Evidence
akr3ch/CVE-2017-9841/cve-2017-9841.py:31

POST /

Body markers
<?=die(@md5(Apri1));?>
Seen in
1 repo: ludy-dev/PHPUnit_eval-stdin_RCE
Evidence
ludy-dev/PHPUnit_eval-stdin_RCE/PHPUnit_eval-stdin_RCE.py:27

POST /api/posts

Key headers
Authorization: Bearer {var}
Body markers
"content":"hello" "content":"no token here" "content":"{var}alert('xss')</script>" in application/json
Ports
5000, 8080
Seen in
1 repo: lnlight05/Information-Security-Work1
Evidence
lnlight05/Information-Security-Work1/README.md:39 lnlight05/Information-Security-Work1/selfcheck.py:71 lnlight05/Information-Security-Work1/selfcheck.py:76

POST /auth/login

Body markers
"login":"alice" "password":"secret123" "password":"wrong" "login":"nobody" "password":"x" "login":"{var}alert('xss')</script>" in application/json
Ports
5000, 8080
Seen in
1 repo: lnlight05/Information-Security-Work1
Evidence
lnlight05/Information-Security-Work1/README.md:25 lnlight05/Information-Security-Work1/selfcheck.py:26 lnlight05/Information-Security-Work1/selfcheck.py:31 lnlight05/Information-Security-Work1/selfcheck.py:35 lnlight05/Information-Security-Work1/selfcheck.py:40

Regex

Generated from PoC characteristics; not yet reviewed. Matches the request path and query.

POST /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
(?i)^/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin\.php(?:[?#].*)?$
GET /
(?i)^/\?(?:.*&)?q=.*file=\.\./\.\./\.\./\.\./etc/passwd.*cmd=whoami
GET /dashboard
(?i)^/dashboard(?:[?#].*)?$
GET /api/data
(?i)^/api/data(?:[?#].*)?$
GET /composer.json
(?i)^/composer\.json(?:[?#].*)?$

Suricata

Template generated from PoC characteristics. Review before deploying.

POST /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
alert http any any -> $HOME_NET [5000,8080] (msg:"GG PoC-Monitor CVE-2017-9841 PHPUnit PHPUnit exploit attempt"; flow:established,to_server; http.method; content:"POST"; http.uri; content:"/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php"; http.request_body; content:"<?php echo '[S]'|3b| echo(shell_exec('"; http.request_body; content:"<?php system('id')|3b| ?>"; http.request_body; content:"<?php echo 'PWNED-'.(7*7)|3b| ?>="; reference:url,poc.griffinguard.io/cve/CVE-2017-9841; classtype:web-application-attack; sid:9048239; rev:1;)
GET /
alert http any any -> $HOME_NET any (msg:"GG PoC-Monitor CVE-2017-9841 PHPUnit PHPUnit exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"q="; http.uri; content:"file=../../../../etc/passwd"; http.uri; content:"cmd=whoami"; http.request_body; content:"<?php echo md5(phpunit_rce)|3b| ?>"; reference:url,poc.griffinguard.io/cve/CVE-2017-9841; classtype:web-application-attack; sid:9850624; rev:1;)
GET /dashboard
alert http any any -> $HOME_NET [32409] (msg:"GG PoC-Monitor CVE-2017-9841 PHPUnit PHPUnit exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/dashboard"; http.header; content:"Cookie: data="; nocase; reference:url,poc.griffinguard.io/cve/CVE-2017-9841; classtype:web-application-attack; sid:9538932; rev:1;)
GET /api/data
alert http any any -> $HOME_NET [5000,8080] (msg:"GG PoC-Monitor CVE-2017-9841 PHPUnit PHPUnit exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/api/data"; http.header; content:"Authorization: Bearer "; nocase; http.header; content:"Authorization: Bearer not-a-real-token"; nocase; reference:url,poc.griffinguard.io/cve/CVE-2017-9841; classtype:web-application-attack; sid:9792141; rev:1;)
GET /composer.json
alert http any any -> $HOME_NET [8080] (msg:"GG PoC-Monitor CVE-2017-9841 PHPUnit PHPUnit exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/composer.json"; reference:url,poc.griffinguard.io/cve/CVE-2017-9841; classtype:web-application-attack; sid:9772958; rev:1;)

Sigma

Template generated from PoC characteristics. Review before deploying.

POST /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
title: PHPUnit PHPUnit exploit attempt (CVE-2017-9841)
id: gg-pocmon-cve-2017-9841-9048239
status: experimental
description: Request pattern taken from public PoCs for CVE-2017-9841. Generated, not reviewed.
references:
  - https://poc.griffinguard.io/cve/CVE-2017-9841
logsource:
  category: webserver
detection:
  selection:
    cs-method: POST
    cs-uri-stem|contains|all:
      - '/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php'
  condition: selection
falsepositives:
  - Authorized vulnerability scanning
level: critical
tags:
  - attack.initial_access
  - attack.t1190
  - cve.2017.9841
GET /
title: PHPUnit PHPUnit exploit attempt (CVE-2017-9841)
id: gg-pocmon-cve-2017-9841-9850624
status: experimental
description: Request pattern taken from public PoCs for CVE-2017-9841. Generated, not reviewed.
references:
  - https://poc.griffinguard.io/cve/CVE-2017-9841
logsource:
  category: webserver
detection:
  selection:
    cs-method: GET
    cs-uri-query|contains|all:
      - 'q='
      - 'file=../../../../etc/passwd'
      - 'cmd=whoami'
  condition: selection
falsepositives:
  - Authorized vulnerability scanning
level: critical
tags:
  - attack.initial_access
  - attack.t1190
  - cve.2017.9841
GET /dashboard
title: PHPUnit PHPUnit exploit attempt (CVE-2017-9841)
id: gg-pocmon-cve-2017-9841-9538932
status: experimental
description: Request pattern taken from public PoCs for CVE-2017-9841. Generated, not reviewed.
references:
  - https://poc.griffinguard.io/cve/CVE-2017-9841
logsource:
  category: webserver
detection:
  selection:
    cs-method: GET
    cs-uri-stem|contains|all:
      - '/dashboard'
  condition: selection
falsepositives:
  - Authorized vulnerability scanning
level: critical
tags:
  - attack.initial_access
  - attack.t1190
  - cve.2017.9841
GET /api/data
title: PHPUnit PHPUnit exploit attempt (CVE-2017-9841)
id: gg-pocmon-cve-2017-9841-9792141
status: experimental
description: Request pattern taken from public PoCs for CVE-2017-9841. Generated, not reviewed.
references:
  - https://poc.griffinguard.io/cve/CVE-2017-9841
logsource:
  category: webserver
detection:
  selection:
    cs-method: GET
    cs-uri-stem|contains|all:
      - '/api/data'
  condition: selection
falsepositives:
  - Authorized vulnerability scanning
level: critical
tags:
  - attack.initial_access
  - attack.t1190
  - cve.2017.9841
GET /composer.json
title: PHPUnit PHPUnit exploit attempt (CVE-2017-9841)
id: gg-pocmon-cve-2017-9841-9772958
status: experimental
description: Request pattern taken from public PoCs for CVE-2017-9841. Generated, not reviewed.
references:
  - https://poc.griffinguard.io/cve/CVE-2017-9841
logsource:
  category: webserver
detection:
  selection:
    cs-method: GET
    cs-uri-stem|contains|all:
      - '/composer.json'
  condition: selection
falsepositives:
  - Authorized vulnerability scanning
level: critical
tags:
  - attack.initial_access
  - attack.t1190
  - cve.2017.9841