Automated Threat Modeling

ThinkPHP 5.0.23 CVE-2018-25270: Brief Summary of a Critical Unauthenticated RCE via invokeFunction Routing

A brief summary of CVE-2018-25270, a critical unauthenticated remote code execution vulnerability in ThinkPHP 5.0.23 that lets attackers invoke arbitrary PHP functions through the framework's routing parameter. The flaw has a CVSS score of 9.8. Attackers have exploited it in the wild since 2018, and campaigns continued into 2024.

CVE Analysis

5 min read

ZeroPath CVE Analysis
ZeroPath CVE Analysis

2026-04-22

ThinkPHP 5.0.23 CVE-2018-25270: Brief Summary of a Critical Unauthenticated RCE via invokeFunction Routing
Experimental AI-Generated Content

This CVE analysis is an experimental publication that is completely AI-generated. The content may contain errors or inaccuracies and is subject to change as more information becomes available. We are continuously refining our process.

If you have feedback, questions, or notice any errors, please reach out to us.

[email protected]

Introduction

Threat actors have exploited a critical unauthenticated remote code execution flaw in ThinkPHP 5.0.23 since December 2018, and campaigns using it were still observed as recently as June 2024. CVE-2018-25270 has a CVSS score of 9.8. It lets an attacker execute arbitrary system commands on the server by crafting a malicious HTTP request to the application's index.php endpoint.

ThinkPHP is an open-source PHP web application framework, created in 2006 and released under the Apache2 license. It is very widely used in China, which makes it a significant target for attackers in that region. Shanghai Topthink Information Technology Company develops and maintains the framework and distributes it through GitHub and Packagist.

Technical information

CVE-2018-25270 comes from how ThinkPHP's routing mechanism processes controller names and function invocations. The framework exposes an invokeFunction method that URL routing parameters can reach. When a request arrives at the index.php endpoint, the framework parses the routing parameters to decide which controller and method to invoke. This parsing logic does not properly validate or restrict which functions the routing parameter can call.

An attacker exploits this by building an HTTP request that passes arbitrary PHP function names and their arguments through the URL routing structure. Because the framework does not sanitize the controller name, it treats the attacker-supplied input as a legitimate function invocation. The invokeFunction method then executes the specified PHP function directly on the server.

Attack flow

  1. The attacker identifies a ThinkPHP 5.0.23 (or earlier) instance exposed to the network, typically by fingerprinting the framework through default responses or error pages.
  2. The attacker crafts an HTTP request to the index.php endpoint. The request includes routing parameters that reference the invokeFunction method, a dangerous PHP function (such as system or exec), and the desired command as an argument.
  3. The ThinkPHP routing engine receives the request and processes the controller name incorrectly, without checking whether the target function is restricted.
  4. The framework invokes the attacker-specified function with the supplied arguments, which executes arbitrary commands on the underlying operating system with the privileges of the web application process.
  5. The HTTP response returns the command output to the attacker, which confirms that the code executed.

The chain needs no authentication at any point, and the entire attack fits in a single HTTP request.

Overlapping vulnerabilities

ThinkPHP 5.x has multiple overlapping RCE vulnerabilities across different minor versions, all related to controller name processing and routing parameter handling. The invokeFunction vector in version 5.0.23 is one instance of a broader pattern of insufficient input validation in the framework's routing layer.

Affected systems and versions

Framework BranchVulnerable VersionsFixed VersionVulnerability Mechanism
ThinkPHP 5.05.0.23 and earlier5.0.24Routing parameter invokeFunction RCE
ThinkPHP 5.05.0.22 and earlier5.0.23Controller name processing
ThinkPHP 5.15.1.29 and earlier5.1.30 or laterController name processing

Organizations should check their exact ThinkPHP version number carefully. Because these vulnerabilities overlap across minor versions, a partial upgrade may leave a system exposed to a different but equally critical RCE vector.

Vendor security history

ThinkPHP has a documented history of critical remote code execution vulnerabilities in its 5.x branch. On December 17, 2018, the vendor published a blog post announcing an update that addressed a high-risk RCE vulnerability. Threat actors adopted exploits quickly after that disclosure, which indicates that the vulnerability was straightforward to weaponize. Versions 5.0.22, 5.0.23, and 5.1.29 each had a related RCE flaw with its own fix, which suggests a systemic problem with input validation in the framework's routing and controller subsystems during this period of development.

References

Detect & fix
what others miss

Works with
  • GitHub
  • GitLab
  • Bitbucket
  • Azure DevOps Services
  • Gerrit
  • CVS
  • Jira
  • Linear
  • Slack
  • Security Compass
Explore integrations
Security magnifying glass visualization