PHP
PHP-CGI Query String Parameter Vulnerability
sapi/cgi/cgi_main.c in PHP before 5.3.12 and 5.4.x before 5.4.2, when configured as a CGI script (aka php-cgi), does not properly handle query strings that lack an = (equals sign) character, which allows remote attackers to execute arbitrary code by placing command-line options in the query string, related to lack of skipping a certain php_getopt for the 'd' case.
Timeline
Days relative to CVE publicationFirst public PoC 7.4 days before publication; added to CISA KEV 9.9 years after publication. First PoC: PHP 5.3.12/5.4.2 - CGI Argument Injection (Metasploit) (Exploit-DB, 4 May 2012).
PoC repositories
Found on GitHub.8 PoCs · 9 pending · 9 informational · 2 not a PoC
PoCs 8
| Repository | Created | Stars | Assessment |
|---|---|---|---|
| infodox/exploits | 30 Jun 2013 +1.1 y | 153 | PoC |
| drone789/CVE-2012-1823 | 8 Sep 2015 +3.3 y | 1 | PoC |
| Unix13/metasploitable2 | 5 Jul 2019 +7.1 y | 5 | PoC
Flags · score 30
Below the suspicion threshold (50); does not change the assessment. |
| cyberharsh/PHP_CVE-2012-1823 | 17 Aug 2020 +8.3 y | 1 | PoC |
| 0xl0k1/CVE-2012-1823 | 24 Aug 2023 +11.3 y | 12 | PoC
Flags · score 15
Below the suspicion threshold (50); does not change the assessment. |
| Dmitri131313/CVE-2012-1823-exploit-for-https-user-password-web | 20 Mar 2025 +12.9 y | 1 | PoC
Flags · score 25
Below the suspicion threshold (50); does not change the assessment. |
| tryj/CVE-2012-1823---PHP-CGI---RCE | 3 Apr 2026 +13.9 y | 0 | PoC |
| CyberCTF/vulhub-php-cve-2012-1823 | 8 Oct 2026 +14.4 y | 0 | PoC |
Pending 9
| Repository | Created | Stars | Assessment |
|---|---|---|---|
| tardummy01/oscp_scripts-1 | 1 Oct 2017 +5.4 y | 3 | Pending |
| Jimmy01240397/CVE-2012-1823-Analyze | 9 Dec 2024 +12.6 y | 0 | Pending
Flags · score 15
Below the suspicion threshold (50); does not change the assessment. |
| KBlackMeow/Matrix | 9 Mar 2026 +13.8 y | 2 | Pending · repository exceeds size limit |
| 0xFatality/CVE-2012-1823 | unknown | 0 | Pending · repository unavailable (HTTP 404) |
| Fatalitysec/CVE-2012-1823 | unknown | 0 | Pending · repository unavailable (HTTP 404) |
| Fatalityx84/CVE-2012-1823 | unknown | 0 | Pending · repository unavailable (HTTP 404) |
| JasonHobs/CVE-2012-1823-exploit-for-https-user-password-web | unknown | 0 | Pending · repository unavailable (HTTP 404) |
| daai1/CVE-2012-1823 | unknown | 0 | Pending · repository unavailable (HTTP 404) |
| theykillmeslowly/CVE-2012-1823 | unknown | 0 | Pending · repository unavailable (HTTP 404) |
Informational 9
| Repository | Created | Found by us | Stars | Assessment |
|---|---|---|---|---|
| nulltrace1336/PHP-CGI-Argument-Injection-Exploit | 24 Dec 2025 +13.6 y | backfilled | 0 | Informational · write-up |
| waburig/Open-Worldwide-Application-Security-Project-OWASP- | 2 Jan 2026 +13.6 y | backfilled | 0 | Informational · write-up |
| hackherMind-Pixel/Vulnerable-Lab-Exploitation | 22 Jan 2026 +13.7 y | backfilled | 1 | Informational · write-up |
| mehedi-hasan-sami98/DVWA-ZAP-PENTEST | 11 Jul 2026 +14.2 y | backfilled | 0 | Informational · detection |
| tanasescualexandrugabriel/Vulnerability-Assessment-and-OSINT-CVE-2012-1823 | 22 Jul 2026 +14.2 y | backfilled | 0 | Informational · detection |
| mujtaba815/metasploitable2-php-cgi-exploit | 2 Oct 2026 +14.4 y | backfilled | 3 | Informational · write-up |
| yilmaz8596/metasploitable-vulnerability-assessment | 3 Oct 2026 +14.4 y | backfilled | 0 | Informational · write-up |
| mujtaba815/metasploitable2-privilege-escalation | 4 Oct 2026 +14.4 y | backfilled | 2 | Informational · write-up
Flags · score 25
Below the suspicion threshold (50); does not change the assessment. |
| javvadivijayprasad/blackboxAISecurityTesting | 27 Oct 2026 +14.5 y | 14 Nov 2026 | 1 | Informational · list |
Not a PoC 2
| Repository | Created | Stars | Assessment |
|---|---|---|---|
| zomasec/CVE-2024-4577 | 8 Jun 2024 +12.1 y | 4 | Not a PoC · unrelated |
| BTtea/CVE-2024-4577-RCE-PoC | 6 Nov 2024 +12.5 y | 25 | Not a PoC · unrelated
Flags · score 35
Below the suspicion threshold (50); does not change the assessment. |
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.| Source | Title | Published | Found by us |
|---|---|---|---|
| Exploit-DB | PHP 5.3.12/5.4.2 - CGI Argument Injection (Metasploit) | 4 May 2012 | 14 Nov 2026 |
| Exploit-DB | PHP < 5.3.12 / < 5.4.2 - CGI Argument Injection | 5 May 2012 | 14 Nov 2026 |
| Exploit-DB | Apache + PHP < 5.3.12 / < 5.4.2 - cgi-bin Remote Code Execution | 29 Oct 2013 | 14 Nov 2026 |
| Exploit-DB | Apache + PHP < 5.3.12 / < 5.4.2 - Remote Code Execution + Scanner | 31 Oct 2013 | 14 Nov 2026 |
| Metasploit | Metasploit exploit: PHP CGI Argument Injection (exploit/multi/http/php_cgi_arg_injection) | 4 May 2012 | 14 Nov 2026 |
| nuclei template | nuclei template: PHP CGI v5.3.12/5.4.2 Remote Code Execution | 27 Apr 2023 | 14 Nov 2026 |
PoC characteristics
What to hunt for in your logs · from 8 PoC reposPOST /
- Query
-d allow_url_include=on-d safe_mode=off-d suhosin.simulation=on-d auto_prepend_file=php://input-d+allow_url_include%-7d1+-d+auto_prepend_file%3dphp://input=-d+allow_url_include%-7d1-d+auto_prepend_file%3dphp://input- Body markers
$payload=<?php eval(base64_decode('system(shell_exec(w00tw00tw00tinapplication/x-www-form-urlencoded- Ports
- 80
- Seen in
- 3 repos: 0xl0k1/CVE-2012-1823, Unix13/metasploitable2, infodox/exploits
- Evidence
- 0xl0k1/CVE-2012-1823/php_cgi.sh:23 Unix13/metasploitable2/PHP-CGI-REMOTE_CVE-2012-1823/CVE-2012-1823_REVERSE_SHELL_WITHOUT_METASPLOIT.txt:5 Unix13/metasploitable2/PHP-CGI-REMOTE_CVE-2012-1823/CVE-2012-1823_REVERSE_SHELL_WITHOUT_METASPLOIT.txt:25 infodox/exploits/php-cgi.py:82 infodox/exploits/php-cgi.py:92 infodox/exploits/php-cgi.py:102
POST /index.php
- Query
-d allow_url_include=on -d auto_prepend_file=php://input={var}=- Key headers
Accept: */*Accept-Language: en- Body markers
<?php echo shell_exec("id"); ?>=<?php system('inapplication/x-www-form-urlencoded- Ports
- 8080
- PoC User-Agent
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)- Seen in
- 3 repos: CyberCTF/vulhub-php-cve-2012-1823, cyberharsh/PHP_CVE-2012-1823, tryj/CVE-2012-1823---PHP-CGI---RCE
- Evidence
- CyberCTF/vulhub-php-cve-2012-1823/build/php/app/README.md:29 CyberCTF/vulhub-php-cve-2012-1823/build/php/app/README.zh-cn.md:27 cyberharsh/PHP_CVE-2012-1823/README.md:22 tryj/CVE-2012-1823---PHP-CGI---RCE/exploit.py:22
GET /cgi-bin/test-cgi
- Query
{var}=- PoC User-Agent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36- Seen in
- 1 repo: Dmitri131313/CVE-2012-1823-exploit-for-https-user-password-web
- Evidence
- Dmitri131313/CVE-2012-1823-exploit-for-https-user-password-web/CVE-2012-1823.py:21
GET /drawimage.php
- Query
pfilez=xxx;/bin/bash >& /dev/tcp/pdf=make- Seen in
- 1 repo: infodox/exploits
- Evidence
- infodox/exploits/phptax_rce.py:35
GET /info.php)
- Ports
- 8080
- Seen in
- 1 repo: CyberCTF/vulhub-php-cve-2012-1823
- Evidence
- CyberCTF/vulhub-php-cve-2012-1823/checks/php.sh:5
POST /%70%68%70%70%61%74%68/%70%68%70
POST //http://{var}{var}index.php{var}index.php{var}index.php
- Body markers
id=BOTNETCHECKUPDATER0-WD8Sju5VR1HU8jlVdata=- Seen in
- 1 repo: infodox/exploits
- Evidence
- infodox/exploits/carpwned.py:35
POST /command.php
- Seen in
- 1 repo: infodox/exploits
- Evidence
- infodox/exploits/dir600-root.py:29 infodox/exploits/dir600-root.py:40
POST /end-user/index.php
- Query
c=blockedaction=continue- Body markers
url=aHR0cDovL3d3dy5leGFtcGxlLmNvbQ==- Seen in
- 1 repo: infodox/exploits
- Evidence
- infodox/exploits/sophail.py:40
POST /{var}/php
Regex
Generated from PoC characteristics; not yet reviewed. Matches the request path and query.
(?i)^/\?(?:.*&)?-d allow_url_include=on.*-d safe_mode=off.*-d suhosin\.simulation=on.*-d auto_prepend_file=php://input.*-d\+allow_url_include%-7d1\+-d\+auto_prepend_file%3dphp://input=.*-d\+allow_url_include%-7d1.*-d\+auto_prepend_file%3dphp://input
(?i)^/index\.php\?(?:.*&)?-d allow_url_include=on -d auto_prepend_file=php://input=.*\{var\}=
(?i)^/cgi-bin/test-cgi\?(?:.*&)?\{var\}=
(?i)^/drawimage\.php\?(?:.*&)?pfilez=xxx;/bin/bash >& /dev/tcp/.*pdf=make
(?i)^/info\.php\)(?:[?#].*)?$
Suricata
Template generated from PoC characteristics. Review before deploying.
alert http any any -> $HOME_NET [80] (msg:"GG PoC-Monitor CVE-2012-1823 PHP PHP exploit attempt"; flow:established,to_server; http.method; content:"POST"; http.uri; content:"-d allow_url_include=on"; http.uri; content:"-d safe_mode=off"; http.uri; content:"-d suhosin.simulation=on"; http.uri; content:"-d auto_prepend_file=php://input"; http.uri; content:"-d+allow_url_include%-7d1+-d+auto_prepend_file%3dphp://input="; http.uri; content:"-d+allow_url_include%-7d1"; http.uri; content:"-d+auto_prepend_file%3dphp://input"; http.request_body; content:"$payload="; http.request_body; content:"<?php eval(base64_decode('"; http.request_body; content:"system("; http.request_body; content:"shell_exec("; http.request_body; content:"w00tw00tw00t"; reference:url,poc.griffinguard.io/cve/CVE-2012-1823; classtype:web-application-attack; sid:9171755; rev:1;)
alert http any any -> $HOME_NET [8080] (msg:"GG PoC-Monitor CVE-2012-1823 PHP PHP exploit attempt"; flow:established,to_server; http.method; content:"POST"; http.uri; content:"/index.php"; http.uri; content:"-d allow_url_include=on -d auto_prepend_file=php://input="; http.uri; content:"{var}="; http.header; content:"Accept: */*"; nocase; http.header; content:"Accept-Language: en"; nocase; http.request_body; content:"<?php echo shell_exec(|22|id|22|)|3b| ?>="; http.request_body; content:"<?php system('"; reference:url,poc.griffinguard.io/cve/CVE-2012-1823; classtype:web-application-attack; sid:9573223; rev:1;)
alert http any any -> $HOME_NET any (msg:"GG PoC-Monitor CVE-2012-1823 PHP PHP exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/cgi-bin/test-cgi"; http.uri; content:"{var}="; reference:url,poc.griffinguard.io/cve/CVE-2012-1823; classtype:web-application-attack; sid:9478351; rev:1;)
alert http any any -> $HOME_NET any (msg:"GG PoC-Monitor CVE-2012-1823 PHP PHP exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/drawimage.php"; http.uri; content:"pfilez=xxx|3b|/bin/bash >& /dev/tcp/"; http.uri; content:"pdf=make"; reference:url,poc.griffinguard.io/cve/CVE-2012-1823; classtype:web-application-attack; sid:9261354; rev:1;)
alert http any any -> $HOME_NET [8080] (msg:"GG PoC-Monitor CVE-2012-1823 PHP PHP exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/info.php)"; reference:url,poc.griffinguard.io/cve/CVE-2012-1823; classtype:web-application-attack; sid:9140634; rev:1;)
Sigma
Template generated from PoC characteristics. Review before deploying.
title: PHP PHP exploit attempt (CVE-2012-1823)
id: gg-pocmon-cve-2012-1823-9171755
status: experimental
description: Request pattern taken from public PoCs for CVE-2012-1823. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2012-1823
logsource:
category: webserver
detection:
selection:
cs-method: POST
cs-uri-query|contains|all:
- '-d allow_url_include=on'
- '-d safe_mode=off'
- '-d suhosin.simulation=on'
- '-d auto_prepend_file=php://input'
- '-d+allow_url_include%-7d1+-d+auto_prepend_file%3dphp://input='
- '-d+allow_url_include%-7d1'
- '-d+auto_prepend_file%3dphp://input'
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: critical
tags:
- attack.initial_access
- attack.t1190
- cve.2012.1823
title: PHP PHP exploit attempt (CVE-2012-1823)
id: gg-pocmon-cve-2012-1823-9573223
status: experimental
description: Request pattern taken from public PoCs for CVE-2012-1823. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2012-1823
logsource:
category: webserver
detection:
selection:
cs-method: POST
cs-uri-stem|contains|all:
- '/index.php'
cs-uri-query|contains|all:
- '-d allow_url_include=on -d auto_prepend_file=php://input='
- '{var}='
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: critical
tags:
- attack.initial_access
- attack.t1190
- cve.2012.1823
title: PHP PHP exploit attempt (CVE-2012-1823)
id: gg-pocmon-cve-2012-1823-9478351
status: experimental
description: Request pattern taken from public PoCs for CVE-2012-1823. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2012-1823
logsource:
category: webserver
detection:
selection:
cs-method: GET
cs-uri-stem|contains|all:
- '/cgi-bin/test-cgi'
cs-uri-query|contains|all:
- '{var}='
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: critical
tags:
- attack.initial_access
- attack.t1190
- cve.2012.1823
title: PHP PHP exploit attempt (CVE-2012-1823)
id: gg-pocmon-cve-2012-1823-9261354
status: experimental
description: Request pattern taken from public PoCs for CVE-2012-1823. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2012-1823
logsource:
category: webserver
detection:
selection:
cs-method: GET
cs-uri-stem|contains|all:
- '/drawimage.php'
cs-uri-query|contains|all:
- 'pfilez=xxx;/bin/bash >& /dev/tcp/'
- 'pdf=make'
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: critical
tags:
- attack.initial_access
- attack.t1190
- cve.2012.1823
title: PHP PHP exploit attempt (CVE-2012-1823)
id: gg-pocmon-cve-2012-1823-9140634
status: experimental
description: Request pattern taken from public PoCs for CVE-2012-1823. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2012-1823
logsource:
category: webserver
detection:
selection:
cs-method: GET
cs-uri-stem|contains|all:
- '/info.php)'
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: critical
tags:
- attack.initial_access
- attack.t1190
- cve.2012.1823