cve.bz

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

9.8 criticalKEVExploitEPSS >99.9%Fix available

Critical (9.8) in PHP PHP. In CISA KEV since 2022-03-25. EPSS >99.9% estimated probability of exploitation activity in the next 30 days.

On this page
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.

Severity

CVSS 3.1

9.8 critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS
>99.9% (unchanged from >99.9% a week ago; >99.9% 30 days ago) estimated probability of exploitation activity in the next 30 days; 100th percentile. Scored 2026-11-21. A forecast for this CVE across the internet, not for your own systems.
CISA KEV
listed 2022-03-25, due 2022-04-15
CISA's assessment (SSVC)
Exploitation: active · Automatable: yes · Technical impact: total, assessed 2025-02-07. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-77 Improper Neutralization of Special Elements used in a Command
OWASP Top 10
A05:2025 Injection
Published
Modified
NVD analysis
Analyzed
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2012-1823 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2012-1823?via=ask-ai-copy and https://cve.bz/cve/CVE-2012-1823?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2012-1823 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
php:phpbefore 5.3.12
php:phpfrom 5.4.0 before 5.4.2
fedoraproject:fedora39
fedoraproject:fedora40
debian:debian_linux6.0
hp:hp-uxb.11.23
hp:hp-uxb.11.31
opensuse:opensuse11.4
opensuse:opensuse12.1
suse:linux_enterprise_server10:sp4
suse:linux_enterprise_server11:sp2
suse:linux_enterprise_software_development_kit10:sp4
suse:linux_enterprise_software_development_kit11:sp2
apple:mac_os_xfrom 10.6.8 before 10.7.5
apple:mac_os_xfrom 10.8.0 before 10.8.2
redhat:application_stack2.0
redhat:gluster_storage_server_for_on-premise2.0
redhat:storage2.0
redhat:storage_for_public_cloud2.0
redhat:enterprise_linux_desktop6.0
redhat:enterprise_linux_eus5.6
redhat:enterprise_linux_eus6.1
redhat:enterprise_linux_eus6.2
redhat:enterprise_linux_server5.0
redhat:enterprise_linux_server6.0
redhat:enterprise_linux_server_aus5.3
redhat:enterprise_linux_server_aus5.6
redhat:enterprise_linux_workstation5.0
redhat:enterprise_linux_workstation6.0

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian6.0php55.3.3-7+squeeze9DSA-2465-1
Red Hatenterprise_linux:5::client_workstation, enterprise_linux:5::serverphp, php-gd, php-cli and 17 more0:5.1.6-34.el5_8RHSA-2012:0546
Red Hatenterprise_linux:5::client_workstation, enterprise_linux:5::serverphp53, php53-gd, php53-cli and 19 more0:5.3.3-7.el5_8RHSA-2012:0547
Red Hatenterprise_linux:6::client, enterprise_linux:6::computenode, enterprise_linux:6::server and 1 morephp, php-gd, php-cli and 24 more0:5.3.3-3.el6_2.8RHSA-2012:0546
Red Hatrhel_application_stack:2php, php-gd, php-cli and 17 more0:5.2.10-2.el5s2RHSA-2012:0570
Red Hatrhel_eus:5.6php, php-gd, php-cli and 17 more0:5.1.6-27.el5_6.4RHSA-2012:0568
Red Hatrhel_eus:5.6php53, php53-gd, php53-cli and 19 more0:5.3.3-1.el5_6.2RHSA-2012:0569
Red Hatrhel_eus:6.0php, php-gd, php-cli and 24 more0:5.3.2-6.el6_0.2RHSA-2012:0568
Red Hatrhel_eus:6.1php, php-gd, php-cli and 24 more0:5.3.3-3.el6_1.4RHSA-2012:0568
Red Hatrhel_mission_critical:5.3php, php-gd, php-cli and 17 more0:5.1.6-23.3.el5_3RHSA-2012:0568
openSUSETumbleweedphp55.6.28-1.1openSUSE-SU-2024:10344-1
openSUSETumbleweedphp77.0.14-1.4openSUSE-SU-2024:10290-1
openSUSETumbleweedphp88.0.11-1.1openSUSE-SU-2024:11169-1

From the distributions' data via OSV.dev: the Debian Security Tracker; Red Hat Security Data © Red Hat, Inc., CC BY 4.0; SUSE security data, CC BY 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Red Hat · openSUSE.

Red Hat

Red Hat rates this Critical.

Red Hat's statement

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, RHSA-2012:0569), and Red Hat Application Stack v2 (RHSA-2012:0570).

This flaw only affected PHP CGI configurations and it did not affect the default configuration in Red Hat Enterprise Linux 5 and 6 using the PHP module for Apache httpd to handle PHP scripts.

Note that this issue was not fixed completely the first time, which resulted in the assignment of additional related CVE identifiers - CVE-2012-2311, CVE-2012-2335, and CVE-2012-2336. Refer to the Red Hat CVE Database and the Red Hat Bugzilla for additional information on how those CVEs affect Red Hat products.

ProductPackageStateAdvisory
Red Hat Enterprise Linux 5php-0:5.1.6-34.el5_8Fixed 2012-05-07RHSA-2012:0546
Red Hat Enterprise Linux 5php53-0:5.3.3-7.el5_8Fixed 2012-05-07RHSA-2012:0547
Red Hat Enterprise Linux 5.3 Long Lifephp-0:5.1.6-23.3.el5_3Fixed 2012-05-10RHSA-2012:0568
Red Hat Enterprise Linux 5.6 EUS - Server Onlyphp-0:5.1.6-27.el5_6.4Fixed 2012-05-10RHSA-2012:0568
Red Hat Enterprise Linux 5.6 EUS - Server Onlyphp53-0:5.3.3-1.el5_6.2Fixed 2012-05-10RHSA-2012:0569
Red Hat Enterprise Linux 6php-0:5.3.3-3.el6_2.8Fixed 2012-05-07RHSA-2012:0546
Red Hat Enterprise Linux 6.0 EUS - Server Onlyphp-0:5.3.2-6.el6_0.2Fixed 2012-05-10RHSA-2012:0568
Red Hat Enterprise Linux 6.1 EUS - Server Onlyphp-0:5.3.3-3.el6_1.4Fixed 2012-05-10RHSA-2012:0568
Red Hat Enterprise Linux 4phpNot affected

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2012-1823.

Public exploits

GitHub PoC

Repositories on GitHub named after this CVE or listed for it by the PoC-in-GitHub index. For those marked Harbor Check: matches CVE, Flawharbor read the code and found it implements this CVE's exploitation technique: read, not run, and its dependencies only checked for warning signs, so a pointer and no guarantee. The rest are unverified: some hold a working proof of concept, some nothing useful, and some malware made to look like one. Read the code before you run any of it. How Harbor Check reads them, and what it found.

Detection rules

Ways to detect this CVE, not exploit code: the nuclei template that checks a system for it, and the Suricata and Snort rules that name it. A rule set may ship a rule turned off, so check yours by its sid.

Attack patterns (CAPEC)

  • CAPEC-15 Command Delimiters Likelihood: High · Severity: High
  • CAPEC-40 Manipulating Writeable Terminal Devices Likelihood: High · Severity: Very High
  • CAPEC-43 Exploiting Multiple Input Interpretation Layers Likelihood: Medium · Severity: High
  • CAPEC-75 Manipulating Writeable Configuration Files Likelihood: High · Severity: Very High
  • CAPEC-76 Manipulating Web Input to File System Calls Likelihood: High · Severity: Very High
  • CAPEC-136 LDAP Injection Likelihood: High · Severity: High
  • CAPEC-183 IMAP/SMTP Command Injection Severity: Medium
  • CAPEC-248 Command Injection Likelihood: Medium · Severity: High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON