CVE-2021-44350: ThinkPHP5 SQL Injection vulnerability

topthink/framework Updated 02 Oct 2025

Summary

17/12/2021
No i
Critical
9.8

CVE-2021-44350: ThinkPHP5 SQL Injection vulnerability. Affects topthink/framework versions >= 5.0, <= 5.1.22. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

ThinkPHP5 is a popular PHP framework used for developing web applications. It provides a range of features and functionalities to simplify the development process. However, versions 5.0.x through 5.1.22 of ThinkPHP5 are vulnerable to a SQL Injection attack. This vulnerability arises from a flaw in the parseOrder function in Builder.php.

Vulnerability Detail

The SQL Injection vulnerability in ThinkPHP5 allows an attacker to manipulate SQL queries and potentially gain unauthorized access to the database. By exploiting this vulnerability, an attacker can execute arbitrary SQL commands, extract sensitive information, modify or delete data, and even take control of the affected system. The vulnerability has a severity rating of CRITICAL with a CVSS score of 9.8.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, developers can manually sanitize and validate user input before using it in SQL queries. This involves using parameterized queries or prepared statements to separate the SQL code from the user input. Here is an example of how to use parameterized queries in PHP to mitigate the SQL Injection vulnerability:

$pdo = new PDO('mysql:host=localhost;dbname=mydatabase', 'username', 'password');
$stmt = $pdo->prepare('SELECT * FROM users WHERE username = :username');
$stmt->bindParam(':username', $username);
$stmt->execute();
$result = $stmt->fetchAll();

Conclusion

The ThinkPHP5 SQL Injection vulnerability poses a significant risk to applications built on this framework. It is crucial to promptly update to a version higher than 5.1.22 to mitigate the vulnerability. Additionally, developers should implement proper input validation and sanitization techniques to prevent SQL Injection attacks. For further support and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for topthink/framework →

Share this vulnerability

FAQ

ThinkPHP5 is a PHP framework used for developing web applications. It provides a range of features and functionalities to simplify the development process.

SQL Injection is a type of security vulnerability that allows an attacker to manipulate SQL queries and potentially gain unauthorized access to the database.

This vulnerability has a severity rating of CRITICAL with a CVSS score of 9.8.

To fix this vulnerability, it is recommended to upgrade ThinkPHP5 to a version higher than 5.1.22.

As a temporary workaround, developers can manually sanitize and validate user input before using it in SQL queries.

Related vulnerabilities

Recent vulnerabilities recorded for topthink/framework.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback