On this page (7 sections)

CVE-2019-25782 is a critical code injection flaw in the ThinkPHP PHP framework, versions 5.0.0 before 5.0.24. According to the NVD record, an unauthenticated attacker can execute commands on the server by setting _method=__construct in POST data, which overwrites the Request filter property.

If you run a site, admin panel or internal tool built on ThinkPHP 5.0, or host one for a client, find out which framework version it uses and plan an upgrade. The record also says the Shadowserver Foundation first observed exploitation evidence on 2023-10-14, so this is not a purely theoretical risk.

What happened

The NVD entry was published on 2026-11-18. It describes a code injection vulnerability in ThinkPHP 5.0.0 before 5.0.24. No account is needed: the record says unauthenticated attackers can execute commands by sending POST data with _method=__construct, which overwrites the Request filter property.

The record says the requests target endpoints reached via routes such as ?s=captcha or ?s=index/index/index, combined with filter and server values that lead to execution of arbitrary system commands. We deliberately do not reproduce a full request. The point for defenders is that the vulnerable path is in the framework's own request handling, so it is not tied to one custom page you wrote.

Technical details in plain terms

The weakness is classified as CWE-470, which covers externally controlled input being used to select which code runs. Here, a field in the request body that should only express an HTTP method override is able to change an internal property of the framework's Request object. That property controls the filter applied to incoming values.

Per the NVD description, once that filter is replaced with a function that executes system commands, a normal-looking web request results in command execution. Such commands would run with the privileges of the web server or PHP process, which is why the CVSS score is so high.

The exact affected boundary is not fully confirmed. The NVD text says versions before 5.0.24 are affected. Two VulnCheck advisory URLs listed as references carry titles mentioning 5.0.0 through 5.0.23 and 5.0.0 through 5.0.24 respectively. We only had the URLs, not the advisory text, so we cannot say whether 5.0.24 itself is affected. Do not stop at exactly 5.0.24 without verifying it.

Who is affected

Any application using ThinkPHP 5.0.0 before 5.0.24 is in scope, and possibly 5.0.24 itself until verified. The framework can sit underneath software you did not write, so check what your applications and any third-party packages depend on rather than relying on memory.

Because exploitation needs no login, internet-facing instances carry the most risk. Internal-only applications are less exposed, but remain worth fixing. For broader guidance on prioritizing this kind of work, see small business website security.

How to check your exposure

First find out whether you run ThinkPHP and which version. In a Composer-based project, the lock file records the installed framework package. This read-only command, run from the project root on the server, prints the matching entry and the lines after it, where you can read the version:

Show the installed ThinkPHP framework entry in a Composer project (run from the project root)Shell
grep -A2 '"name": "topthink/framework"' composer.lock

If the project does not use Composer, ask the application's developer or vendor which ThinkPHP version it ships, or consult the framework's documentation. Treat anything from 5.0.0 up to and possibly including 5.0.24 as needing action.

To look for signs of probing, search your web server access logs for the route patterns named in the record. This read-only search prints matching lines; adjust the log path to your server (the path below is a common nginx example):

Search an access log for the routes named in the record (example nginx path; adjust to your server)Shell
grep -E 's=captcha|s=index/index/index' /var/log/nginx/access.log

Hits are not proof of compromise, since automated scanners probe known paths, but a successful response to a POST on those routes deserves a closer look. Also review recently modified PHP files and unexpected processes running as the web server user.

What to do now

  1. Inventory every application that uses ThinkPHP and record the framework version for each.
  2. Upgrade any ThinkPHP 5.0.x install to the latest maintained ThinkPHP release your application supports, and confirm against the vendor's commit and release notes that the fix is included. Do not assume 5.0.24 is safe.
  3. Test the upgrade on a staging copy first, since framework updates can change behavior in older custom code.
  4. If you cannot upgrade immediately, restrict access to the application with a firewall rule, IP allowlist or authentication in front of it.
  5. Review access logs and the web root for signs of earlier abuse, such as unfamiliar PHP files or unexpected outbound connections.
  6. If you find evidence of compromise, rotate database passwords, API keys and other secrets stored on the server, and follow an incident response process before bringing the site back.
  7. Run the web server and PHP process as a low-privilege user so any command execution has limited reach.
Caution. Upgrading a framework in production can break custom code that depends on older behavior. Back up the application and database, and test on staging before deploying.

For a Composer-based project, this command updates the ThinkPHP framework package within your version constraints. It changes files, so run it on staging first and then check the resulting version in composer.lock:

Update the ThinkPHP framework package with Composer (staging first; check version constraints)Shell
composer update topthink/framework

Detection and monitoring afterwards

Keep watching access logs for repeated POST requests to the routes above, and for unusual child processes spawned by PHP. Alert on new or modified files in the web root and on outbound connections from the web server to hosts you do not recognize.

A website firewall can filter malicious request patterns, but it is not a substitute for upgrading the framework. A read-only security scan shows what your site exposes to the outside. If you suspect a compromise, follow Website hacked: what to do.

What is and is not confirmed

  • Stated in the NVD record: affected versions 5.0.0 before 5.0.24, unauthenticated command execution via _method=__construct, and first observed exploitation evidence from the Shadowserver Foundation on 2023-10-14.
  • Listed as references in the record: a framework commit and several public proof-of-concept and scanner template pages. We have not reviewed them in detail and do not reproduce them.
  • Not established in our research: a named fixed release, the scale of real-world exploitation, named attackers, or a CISA KEV listing. Only one independent publisher covers this story so far, so details may change.

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-2019-25782: ThinkPHP 5.0.0 before 5.0.24 contains a code injection vulnerability that allows unauthenticated attackers to execute commands by setting _method=__construct…nvd.nist.gov ·
  • ThinkPHP
  • RCE
  • PHP
  • CVE-2019-25782
  • code injection