Quantum Secular Labs / Blog / Advisories

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

CVE-2012-1823 is rated critical with a CVSS v3.1 base score of 9.8 and affects PHP PHP, along with 16 other products in NVD’s configuration data. Per its scoring, it can be exploited over the network, without authentication, without any user interaction. The scored impact on confidentiality, integrity and availability is the highest available. CISA added it to its Known Exploited Vulnerabilities catalog on 2022-03-25, which means exploitation in the wild has been observed.

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

Severity breakdown

CVSS v3.1 9.8: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

  • Attack vector: Network. Exploitable remotely over the network, with no need for local or physical access.
  • Attack complexity: Low. No special conditions; the attack can be repeated reliably.
  • Privileges required: None. No account or prior access is needed.
  • User interaction: None. No action from any user is needed.
  • Scope: Unchanged. Impact stays within the vulnerable component.
  • Confidentiality impact: High. Total loss of confidentiality; sensitive data can be fully disclosed.
  • Integrity impact: High. Total loss of integrity; data or system state can be fully modified.
  • Availability impact: High. Total loss of availability; the component can be shut down.

Underlying weakness

CWE-77: 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.

Affected products

  • PHP: before 5.3.12; from 5.4.0 before 5.4.2
  • Fedoraproject: 39; 40
  • Debian Linux: 6.0
  • HP Ux: b.11.23; b.11.31
  • Opensuse: 11.4; 12.1
  • Suse Linux Enterprise Server: 10 sp4; 11 sp2
  • Suse Linux Enterprise Software Development Kit: 10 sp4; 11 sp2
  • Apple Mac OS X: from 10.6.8 before 10.7.5; from 10.8.0 before 10.8.2
  • Red Hat Application Stack: 2.0
  • Red Hat Gluster Storage Server For On Premise: 2.0
  • Red Hat Storage: 2.0
  • Red Hat Storage For Public Cloud: 2.0
  • Red Hat Enterprise Linux Desktop: 6.0
  • Red Hat Enterprise Linux Eus: 5.6; 6.1; 6.2
  • Red Hat Enterprise Linux Server: 5.0; 6.0

References