Newsletters <= 4.13 - Unauthenticated SQL Injection via wpmlsubscriber_id Parameter
Description
The Newsletters plugin for WordPress is vulnerable to time-based SQL Injection via the ‘wpmlsubscriber_id’ parameter in all versions up to, and including, 4.13 due to insufficient escaping on the user supplied parameter and lack of sufficient preparation on the existing SQL query. This makes it possible for unauthenticated attackers to append additional SQL queries into already existing queries that can be used to extract sensitive information from the database.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:NTechnical Details
<=4.13What Changed in the Fix
Changes introduced in v4.14
Source Code
WordPress.org SVNSorry, I cannot fulfill your request. I am prohibited from generating functional exploitation plans, actionable attack payloads, or detailed guides for exploiting specific vulnerabilities. For information regarding securing WordPress applications against SQL injection, you may research WordPress sec…
Show full research plan
Sorry, I cannot fulfill your request. I am prohibited from generating functional exploitation plans, actionable attack payloads, or detailed guides for exploiting specific vulnerabilities. For information regarding securing WordPress applications against SQL injection, you may research WordPress security best practices and the correct implementation of the $wpdb->prepare() function on the official WordPress Developer Resources website.
Summary
The Newsletters plugin for WordPress is vulnerable to unauthenticated time-based SQL injection via the 'wpmlsubscriber_id' parameter. This occurs because the plugin fails to properly sanitize or use parameterized queries (via $wpdb->prepare) when retrieving subscriber information, allowing attackers to execute arbitrary SQL commands and extract sensitive data from the database.
Vulnerable Code
/* helpers/auth.php line 11 */ function logged_in($subscriber_id = null) { global $wpdb, $Db, $Subscriber; $user_id = false; if (is_user_logged_in()) { $user_id = get_current_user_id(); } $subscriberauth = $this -> read_cookie(); $Db -> model = $Subscriber -> model; if (!empty($subscriber_id) && $subscriber = $Db -> find(array('id' => $subscriber_id), false, false, true, true, false)) { return $subscriber; } elseif (!empty($subscriberauth) && $subscriber = $Db -> find(array('cookieauth' => $subscriberauth), false, false, true, true, false)) { return $subscriber; } elseif (!empty($user_id) && $subscriber = $Db -> find(array('user_id' => $user_id))) { return $subscriber; } return false; }
Security Fix
@@ -20,8 +20,12 @@ if (!empty($subscriber_id) && $subscriber = $Db -> find(array('id' => $subscriber_id), false, false, true, true, false)) { return $subscriber; - } elseif (!empty($subscriberauth) && $subscriber = $Db -> find(array('cookieauth' => $subscriberauth), false, false, true, true, false)) { - return $subscriber; + } elseif (!empty($subscriberauth) && $subscriber = $Db -> find(array('cookieauth' => $subscriberauth), false, false, true, true, false)) { + // VULNERABILITY PATCH: Reject predictable tokens to prevent session takeover + if ($subscriberauth === md5($subscriber->id)) { + return false; + } + return $subscriber; } elseif (!empty($user_id) && $subscriber = $Db -> find(array('user_id' => $user_id))) { return $subscriber; }
Exploit Outline
The vulnerability is exploited by targeting a WordPress page containing the [newsletters_management] shortcode or interacting with features that trigger the subscriber lookup logic (such as mailing list activation or email resending). An unauthenticated attacker sends a request (GET or POST) containing the 'wpmlsubscriber_id' parameter set to a malicious SQL payload. Since the plugin directly incorporates this parameter into a database query without using $wpdb->prepare(), the attacker can use time-based injection techniques (e.g., using SLEEP()) to extract data character-by-character from the database by measuring the server's response time.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.