On this page (7 sections)

CVE-2012-20007 describes an eval injection flaw in the ThinkPHP PHP framework. According to the NVD record, ThinkPHP 2.0 through 2.2 and 3.0 in Lite mode parse the request path in a way that lets unauthenticated attackers execute arbitrary PHP code on the server. The record was published on 2026-11-18 and carries a CVSS score of 9.3 (critical).

If you maintain an old PHP application, inherit a legacy site from a client, or run hosting where abandoned apps tend to linger, this is worth a quick check. The affected releases are very old, so the realistic risk sits with forgotten installs rather than new projects.

What happened

The NVD entry describes a code execution flaw in how ThinkPHP's Dispatcher handles PATH_INFO, the part of the URL that follows the script name. An unauthenticated attacker can send a crafted request to the application's index.php and have PHP expressions evaluated by the server. No login, user interaction or special privileges are mentioned as prerequisites.

The record was published on 2026-11-18, but the CVE identifier carries a 2012 year and the affected versions are old. The same record states that the Shadowserver Foundation first observed exploitation evidence on 2023-10-14. The research available to us is limited: it consists of the NVD text plus references to a VulnCheck advisory, public scanner templates and a lab environment write-up. Only one independent publisher covers this so far, so details such as the number of exposed servers or the actors involved are not confirmed.

Technical details in plain terms

The NVD description says the Dispatcher parses PATH_INFO using PHP's preg_replace with the /e modifier and a double-quoted replacement string. The /e modifier tells PHP to treat the replacement as PHP code and evaluate it after substitution. When any part of that code comes from the request, the attacker's input can end up being run as PHP. This weakness class is eval injection (CWE-95).

Two details matter for understanding the risk:

  • The vulnerable behavior sits in the framework's routing code, so the application itself does not need a bug of its own. Any site built on an affected version and reachable over HTTP is a candidate.
  • Because the code runs with the privileges of the web server or PHP process, an attacker can typically read configuration files, database credentials and uploaded content, and write files. The exact impact depends on how the server is set up.
The /e modifier was deprecated in later PHP releases and removed in PHP 7. That is general PHP history rather than a statement from the advisory, but it is a useful hint: a ThinkPHP 2.x app that still works is probably running on a very old PHP runtime, which carries its own risks.

Who is affected

Per the NVD record, the affected scope is ThinkPHP 2.0 through 2.2, and 3.0 when running in Lite mode. Other ThinkPHP lines are not named in the research, so do not assume they are or are not affected without checking the advisory yourself.

Realistic exposure is concentrated in a few places:

  • Legacy business sites, intranets and admin panels built years ago and never migrated.
  • Agency-delivered projects whose original developer is no longer involved.
  • Shared or reseller hosting accounts with old applications nobody owns.
  • Bundled third-party products that embed an old copy of the framework, where the version is not obvious from the outside.

How to check whether you are exposed

Start with an inventory. You need to know whether any application on your servers includes ThinkPHP, which version it is, and whether it runs in Lite mode. The framework is often copied into a project folder rather than installed through a package manager, so searching the filesystem is more reliable than looking at a package list.

This read-only command, run on the web server, lists files named ThinkPHP.php under your web root (adjust the path to your layout). Any hit means a ThinkPHP copy is present and its version should be checked:

Find ThinkPHP framework files under a web root (Linux, read-only)Shell
find /var/www -type f \( -name 'ThinkPHP.php' -o -name 'ThinkPHP.class.php' \) 2>/dev/null

If a project uses Composer, this read-only search looks for a ThinkPHP dependency in lock files. It will not find copies that were pasted into the project by hand, so use it alongside the command above:

Search Composer lock files for ThinkPHP (Linux, read-only)Shell
grep -rl --include=composer.lock -i 'thinkphp' /var/www 2>/dev/null

Next, review your access logs for signs of probing. The NVD text says exploitation uses requests to index.php with an 's' parameter. This grep prints matching log lines so you can look for unexpected requests. It is only a heuristic: legitimate routing can also use such URLs, and an attacker may encode requests differently, so a clean result does not prove safety.

Look for requests to index.php with an s parameter in an access log (read-only; adjust the log path)Shell
grep -E 'index\.php\?(.*&)?s=' /var/log/nginx/access.log | head -n 50
Tip. If you cannot tell which version a site runs, treat it as affected until the code owner confirms otherwise. A framework this old has probably not received maintenance for years.

What to do now

The research does not name a patched release, so do not rely on a simple version bump being available. The safest long-term answer for an affected app is to move off these ThinkPHP versions or retire the app. In the meantime, reduce exposure.

  1. Inventory every site and app on your servers and identify any that use ThinkPHP 2.0 to 2.2 or 3.0 in Lite mode.
  2. Take internet-facing instances that are not needed offline, or restrict access to trusted IP addresses or a VPN.
  3. Check the VulnCheck advisory and the ThinkPHP project for any fix or vendor guidance before deciding on a path.
  4. Plan a migration to a currently maintained framework version and a supported PHP release; do not rely on the old code long term.
  5. Review access logs for unexpected requests to index.php and look for new or modified PHP files in web-writable directories.
  6. If you find signs of compromise, rotate database passwords, API keys and any secrets stored in the app's configuration, and restore from a known-good backup.
  7. Run the web server and PHP as a low-privilege user, and make code directories read-only to that user where possible.
Caution. Restoring from backup or rebuilding a server will not help if the vulnerable app is put back unchanged. Close the hole first, or the same request can compromise the new copy.

A web application firewall can add a layer of filtering in front of an old app, but it is a stopgap and not a replacement for removing or upgrading the vulnerable code. See what a WAF is and what it can do for the trade-offs.

Detection and monitoring afterwards

Because exploitation evidence dates back to 2023-10-14 according to the NVD record, an exposed server may have been probed or compromised well before today. Check for compromise rather than assuming a fresh start.

  • Compare the files on the server with a known-good copy or version control, and look for PHP files you did not create, especially in upload and cache folders.
  • Watch for unusual outbound connections, new scheduled jobs and unexpected admin or database users.
  • Keep access logs long enough to look back and alert on spikes of requests to index.php with odd query strings.
  • Use an outside-in scan to spot visible signs of compromise, and read about what outside-in malware detection can and cannot see to set expectations.

If you suspect a break-in, follow the steps in Website hacked: what to do. For a broader routine, the small business website security guide covers ownership of old sites and update habits. Webforta's uptime, certificate and change monitoring can also help you notice unexpected changes on sites you are responsible for.

What we do not know yet

Be cautious about claims beyond the record. The research does not confirm a fixed version, the scale of exploitation, who is behind it, or whether the issue appears in CISA's Known Exploited Vulnerabilities catalog. The NVD entry and the VulnCheck advisory are the key references; a Nuclei detection template and a Vulhub lab environment for this issue are also listed in the references. We will not describe how those tools work, and defenders should use them only against systems they own.

Sources

This article is based on the public sources below. Details can change as vendors and researchers publish more; check the original advisories before acting on version numbers.

  1. CVE-2012-20007: ThinkPHP 2.0 through 2.2 and 3.0 Lite mode contains an eval injection vulnerability in the Dispatcher PATH_INFO parsing, which uses preg_replace with the /e…nvd.nist.gov ·
  • ThinkPHP
  • CVE-2012-20007
  • PHP
  • remote code execution
  • legacy software