CyberSecBulletin
CVE-2012-1823Exploited in the wildNVD status: Analyzed

PHP-CGI Query String Parameter

CVE-2012-1823 is a high-severity improper neutralization of special elements used in a command vulnerability in PHP, with a CVSS 2.0 base score of 7.5 out of 10. It can be exploited remotely over the network by an unauthenticated attacker, without any action from a user. The record lists versions 5.3.12, 5.4.2 as the first without the flaw, so updating PHP to one of those releases or later removes the exposure. CISA added it to the Known Exploited Vulnerabilities catalogue on March 25, 2022, which means attacks have been observed in the wild.

Patch now

Attackers are already exploiting this vulnerability, according to CISA.

What to do

  1. Update PHP to 5.3.12 or 5.4.2, whichever matches your release line, or a later version.
  2. Update Mac OS X to 10.7.5 or 10.8.2, whichever matches your release line, or a later version.
  3. CISA's required action: Apply updates per vendor instructions.
  4. Until you can update, restrict network access to the affected service so it is not reachable from untrusted networks.

Affected products and versions

VendorProductAffected versionsFixed in
PHPPHPbefore 5.3.12; 5.4.0 up to, but not including, 5.4.25.3.12, 5.4.2
Fedora ProjectFedora39; 40Not stated
DebianDebian Linux6.0Not stated
HPHp-uxb.11.23; b.11.31Not stated
openSUSEOpensuse11.4; 12.1Not stated
SUSELinux Enterprise Server10; 11Not stated
SUSELinux Enterprise Software Development Kit10; 11Not stated
AppleMac OS X10.6.8 up to, but not including, 10.7.5; 10.8.0 up to, but not including, 10.8.210.7.5, 10.8.2
Red HatApplication Stack2.0Not stated
Red HatGluster Storage Server For On-premise2.0Not stated
Red HatStorage2.0Not stated
Red HatStorage For Public Cloud2.0Not stated
Red HatEnterprise Linux Desktop6.0Not stated
Red HatEnterprise Linux EUS5.6; 6.1; 6.2Not stated
Red HatEnterprise Linux Server5.0; 6.0Not stated
Red HatEnterprise Linux Server AUS5.3; 5.6Not stated
Red HatEnterprise Linux Workstation5.0; 6.0Not stated

Version data comes from NVD's product matching. Confirm against the vendor advisory before deciding you are unaffected.

How the severity score breaks down

Access vector
NetworkCan be exploited remotely over a network.
Access complexity
LowNo special conditions are needed.
Authentication
NoneNo login is needed.
Confidentiality
PartialSome data can be read.
Integrity
PartialSome data can be modified.
Availability
PartialAvailability is reduced.

Vector: AV:N/AC:L/Au:N/C:P/I:P/A:P. Scored by NVD.

Scoring systemScoreSeverityScored by
CVSS 3.19.8CriticalCISA (ADP)
CVSS 2.07.5HighNVD

Official 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.

Source: the CVE record as published by its numbering authority, via NVD and CVE.org.

The underlying weakness: Improper Neutralization of Special Elements used in a Command

The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.

How developers prevent this class of flaw

  • If at all possible, use library calls rather than external processes to recreate the desired functionality.
  • If possible, ensure that all external commands called from the program are statically created.
  • Run time: Run time policy enforcement may be used in an allowlist fashion to prevent use of any non-sanctioned commands.

More Improper Neutralization of Special Elements used in a Command vulnerabilities (CWE-77)

Timeline

  1. CVE record published.
  2. Added to CISA's Known Exploited Vulnerabilities catalogue.
  3. Deadline for US federal agencies to remediate, set by CISA.
  4. CISA published its SSVC assessment (exploitation: active, automatable: yes, technical impact: total).
  5. Record last changed materially (score, affected products, status or references).

References

Third-party and government advisories

Technical write-ups (may include proof of concept)

Other vulnerabilities in PHP

All PHP vulnerabilities

Recent Improper Neutralization of Special Elements used in a Command vulnerabilities

Spotted an error? Tell us.