Summary
CVE-2012-20007 is an eval injection vulnerability in ThinkPHP versions 2.0 through 2.2 and 3.0 Lite mode. An unauthenticated remote attacker can execute arbitrary PHP code on the server through a crafted request. The CVE record rates it CRITICAL (CVSS v4.0 9.3; CVSS v3.1 9.8).
Technical details
- Root cause: The Dispatcher’s PATH_INFO parsing uses
preg_replacewith the/emodifier and double-quoted replacement strings, so attacker-controlled input is evaluated as PHP code. - Trigger conditions: A request to
index.phpwith a craftedsparameter. No authentication or user interaction is required. - Attack vector: Network, low complexity.
- Impact: Arbitrary PHP code execution in the context of the web application, with high impact to confidentiality, integrity and availability.
- Exploitation: The CVE record cites exploitation observed by the Shadowserver Foundation on October 14, 2023. The issue was originally disclosed publicly on April 25, 2012, and public exploit and detection material exists (Vulhub, Nuclei template).
Affected software
- ThinkPHP 2.0 through 2.2
- ThinkPHP 3.0 in Lite mode
Severity
- CVSS v4.0: 9.3 (Critical) –
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N - CVSS v3.1: 9.8 (Critical) –
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Mitigation and recommended actions
- Immediate: The reviewed CVE record does not name a fixed version. Migrate affected applications to a ThinkPHP release outside the affected ranges (2.0–2.2 and 3.0 Lite), and verify the vendor’s current guidance.
- If migration is not immediately possible: restrict network access to the application, and use a WAF or reverse-proxy rule to block requests whose
sparameter contains PHP code constructs. - Review web server logs for requests to
index.phpwith unusualsparameters, and investigate any such hosts for compromise.

