What is wrong
PHP improperly handles query strings in sapi/cgi/cgi_main.c when configured as a CGI script. This allows remote attackers to execute arbitrary code on the affected server.
Who is affected
This affects PHP configured as a CGI script in versions prior to 5.3.12 and versions 5.4.0 prior to 5.4.2.
What to do
Upgrade PHP to version 5.3.12 or 5.4.2 according to vendor instructions.
Original 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.
Known exploited (CISA KEV)
- Added to KEV
- 2022-03-25
- Remediation due (US federal)
- 2022-04-15
- Ransomware use
- Unknown
- Required action
- Apply updates per vendor instructions.
Affected software
- PHP < 5.3.12≥ 5.4.0 < 5.4.2 Fixed in: 5.3.12, 5.4.2 exact match
Details
- Published
- 2012-05-11
- Last modified
- 2025-11-05
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H- EPSS (30-day exploit probability)
- 100.00% (percentile 100)
References
- cve.org/CVE-2012-1823
- nvd.nist.gov/vuln/detail/CVE-2012-1823
- marc.info/?l=bugtraq&m=134012830914727&w=2
- lists.opensuse.org/opensuse-security-announce/2012-05/msg00011.html
- www.securitytracker.com/id?1027022
- h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c03360041
- www.mandriva.com/security/advisories?name=MDVSA-2012:068
- lists.opensuse.org/opensuse-security-announce/2012-05/msg00002.html
- rhn.redhat.com/errata/RHSA-2012-0546.html
- rhn.redhat.com/errata/RHSA-2012-0568.html
- rhn.redhat.com/errata/RHSA-2012-0569.html
- www.php.net/ChangeLog-5.php#5.4.2
- secunia.com/advisories/49014
- rhn.redhat.com/errata/RHSA-2012-0570.html
Track these versions on your own servers
InfraGuard collects installed software versions from every server and flags the ones with known vulnerabilities. Self-hosted — nothing leaves your network.
This product uses data from the NVD API but is not endorsed or certified by the NVD. CVE® is a registered trademark of The MITRE Corporation; CVE records are used under the CVE Program Terms of Use.