CVE-2018-16385: ThinkPHP SQL Injection vulnerability
9.8
CVSS Score
3.0
Basic Information
CVE ID
GHSA ID
EPSS Score
0.66837%
CWE
Published
5/14/2022
Updated
5/4/2024
KEV Status
No
Technology
PHP
Technical Details
CVSS Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
topthink/framework | composer | < 5.1.23 | 5.1.23 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from how ThinkPHP's query builder handles array parameters in the order() method. When user-controlled input (like the 'order' GET parameter) is passed directly to order() as an array key-value pair, the framework fails to properly escape the array keys. This allows attackers to inject SQL expressions through crafted keys (e.g., 'id`|updatexml(...)#'). The GitHub issue demonstrates this vulnerability pattern and confirms the order method's role in query construction. The patch in 5.1.23 likely added proper escaping for array keys in ORDER BY processing.