CVE-2012-1823 — Red Hat
CRITICALCVE-2012-1823 is a critical-severity (CVSS 9.8) CWE-77 vulnerability. It is in CISA's Known Exploited Vulnerabilities catalog (added 2022-03-25) — treat it as actively exploited and patch now. No vendor fix is recorded yet; mitigation options are listed below.
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,…
Exploitation Status
Actively exploited in the wild
- Confirmed by CISA's Known Exploited Vulnerabilities catalog on 2022-03-25. Federal agencies were required to remediate by 2022-04-15.
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- A successful exploit gives an attacker total control of the affected component, not partial access.
Exploitation and automatability from CISA (KEV catalog and SSVC triage) for CVE-2012-1823.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2012-1823 by exploitation likelihood (EPSS) against impact (CVSS). In the shaded patch-first corner (EPSS 50%+, CVSS 7.0+).
Where this sits among everything scored
Of 395,249 CVEs with a current EPSS score, this one falls in the ≥ 90% band (highlighted). Counts from FIRST.org, log-scaled.
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.
Affected Products
mac os xappledebian linuxdebianfedorafedoraprojecthp-uxhpopensuseopensusephpphpResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Apache + PHP < 5.3.12 / < 5.4.2 - cgi-bin Remote Code Execution
by kingcope · Oct 29, 2013
Apache + PHP < 5.3.12 / < 5.4.2 - Remote Code Execution + Scanner
by noptrix · Oct 31, 2013
PHP < 5.3.12 / < 5.4.2 - CGI Argument Injection
by rayh4c · May 5, 2012
PHP 5.3.12/5.4.2 - CGI Argument Injection (Metasploit)
by Metasploit · May 4, 2012
Detection & mitigation playbook
VulnerabilityDetect
Identify every host running the affected component and compare the installed build against the fixed version below — for source-built or distro-packaged software the version string, not a lockfile, is the source of truth (`dpkg -l`, `rpm -q`, or the binary's own `--version`).
Remediation status
No fixed release is recorded for CVE-2012-1823 yet. Track the upstream advisory, and apply the exposure-reduction steps below in the meantime.
Mitigate without a patch
Stop passing untrusted input into the interpreter or shell: call the affected binary with an argument array rather than a composed command string, reject anything outside a strict allowlist of expected values, and run the component under an account that cannot reach beyond the work it legitimately does.
How to detect CVE-2012-1823
A community-maintained Nuclei template exists for this CVE. You can scan for it directly:
nuclei -id cve-2012-1823 -u https://target- Template
- PHP CGI v5.3.12/5.4.2 Remote Code Execution
- Severity
- high
- Impact
- Remote code execution
- Remediation
- Upgrade to a patched version of PHP or apply the necessary security patches.
Template by ProjectDiscovery nuclei-templates (pikpikcu), MIT licensed. View the full template. Scan only systems you are authorised to test.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
This flaw did not affect the versions of PHP in Red Hat Enterprise Linux 3 or 4. Updates were released for Red Hat Enterprise Linux 5 and 6 (RHSA-2012:0546, RHSA-2012:0547), Red Hat Enterprise Linux 5.3 Long Life (RHSA-2012:0568), Red Hat Enterprise Linux 5.6, 6.0, and 6.1 Extended Update Support (RHSA-2012:0568,…
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat Enterprise Linux 5 | php-0:5.1.6-34.el5_8 | RHSA-2012:0546 |
| Red Hat Enterprise Linux 5 | php53-0:5.3.3-7.el5_8 | RHSA-2012:0547 |
| Red Hat Enterprise Linux 5.3 Long Life | php-0:5.1.6-23.3.el5_3 | RHSA-2012:0568 |
| Red Hat Enterprise Linux 5.6 EUS - Server Only | php53-0:5.3.3-1.el5_6.2 | RHSA-2012:0569 |
Frequently Asked Questions
Is CVE-2012-1823 in your dependencies?
Find it across , including transitive dependencies.