LiveBreach Intelligence: data breaches, leaks & ransomware, tracked as they surfaceOngoing protection: GalaxyWarden →
Recent BreachesData breach tracker

CVE-2012-1823: PHP-CGI Query String Parameter Vulnerability

RBRecent Breaches Vulnerability Intelligence·Mar 25, 2022
CVSS 9.8 · Critical⚠ Actively exploited (CISA KEV)
9.8
CVSS score
Critical
Severity
Active
CISA KEV
No
Ransomware use
Apr 15, 2022
Patch deadline
⚠ Exploited in the wild. CISA added CVE-2012-1823 to its Known Exploited Vulnerabilities catalog on Mar 25, 2022, with a federal patch deadline of Apr 15, 2022 — meaning attackers are actively using it. If you run the affected software, patch it immediately.

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.

CVE-2012-1823 is a vulnerability in PHP when it is run in CGI mode. Improper handling of query strings in the CGI front end can let a remote attacker reach code-execution paths that should not be exposed. For IT and security teams, this matters because PHP-CGI is still found on legacy web stacks, shared hosting, and appliances; successful abuse can lead to full compromise of the web tier and anything it can reach.

Public detail is limited to the CISA description and the CWE classification. Confirm exact affected builds, fixed releases, and configuration prerequisites against the vendor advisory before you act.

How it works

The weakness is CWE-20 (Improper Input Validation). In the PHP CGI SAPI (sapi/cgi/cgi_main.c), query-string data is not validated tightly enough when PHP is configured as a CGI script. An attacker who can send crafted HTTP requests can influence how the CGI process interprets those parameters, ultimately causing the interpreter to execute attacker-controlled code or options.

At a high level, the abuse path is: remote HTTP request containing a specially formed query string → CGI layer mishandles the input → PHP process runs with unintended arguments or code. No further exploit mechanics are provided in the given facts; treat any public proof-of-concept material as untrusted until you have validated it in a lab and cross-checked the vendor write-up.

Am I affected? How to find it in your systems

PHP configured as CGI (as opposed to mod_php, php-fpm, or other SAPIs) is the configuration class in scope. Typical locations include older Apache/nginx setups that invoke php-cgi or php.cgi via ScriptAlias, Action/AddHandler, or wrapper scripts; some appliance and shared-hosting images still ship this layout.

If you cannot determine the SAPI or version with certainty, assume the service needs review until the advisory clears it.

How to remediate

Patch first. Apply the updates specified by the PHP vendor (or your OS/distribution packager) exactly as directed in the advisory. CISA’s required action is to apply updates per vendor instructions; do not rely on partial back-ports unless your vendor explicitly supports them.

If you can't patch immediately

Reduce exposure until the vendor update can be installed:

These steps only buy time; they are not a substitute for the vendor patch.

If your data may have been exposed

Actively exploited remote-code-execution flaws on web tiers frequently precede broader intrusion and data theft. If you have evidence of exploitation—or simply cannot rule it out—treat the host as potentially compromised: isolate it, preserve volatile evidence, rotate credentials that the web application could access, and begin incident-response triage. Known ransomware use is not documented for this CVE in the supplied facts, but that does not mean post-exploitation activity is impossible. As a quick additional check, you can run a free exposure scan of your email addresses against known breach data sets to see whether related accounts have already appeared in public dumps.

AICompiled with AI assistance from public sources and published under our editorial standards.

Details

AffectedPHP · PHP
WeaknessCWE-77
CVSS base score9.8 (Critical)
CVSS vectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
PublishedMay 11, 2012
Added to CISA KEVMar 25, 2022
Federal patch deadlineApr 15, 2022
Known ransomware useNot documented
Check if your data is exposed →

References

Official records: NVD · CISA KEV

← All actively-exploited vulnerabilities