CVE-2026-6295 in WP Optimizer Plugininfo

Summary

by MITRE • 09/19/2026

The WP Optimizer plugin for WordPress is vulnerable to SQL Injection via the 's' parameter in all versions up to and including 2.5.0. This is due to an unsafe subquery-detection branch in the Query::parse_key_compare_field() method that, when the user-supplied value matches the regex ^[(\s]*SELECT\s+, wraps the value in parentheses and embeds it directly into the SQL string without any escaping or quoting. While the normal LIKE code path correctly uses esc_sql($wpdb->esc_like(...)) and wraps the value in single quotes, this branch completely bypasses those protections. Because the attack payload (SELECT ...) contains no single quotes, WordPress's wp_magic_quotes() provides no protection. This makes it possible for authenticated attackers with administrator-level access to inject arbitrary SQL subqueries — including time-based blind payloads — that can be used to extract sensitive information from the database.

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 09/19/2026

The WP Optimizer plugin for WordPress versions up to and including 2.5.0 contains a critical SQL Injection vulnerability located within the Query::parse_key_compare_field() method. This flaw arises from an unsafe handling of user-supplied input in the 's' parameter, which is typically used for search or filter operations. The core technical issue lies in a specific code branch designed to detect subqueries. When the input value matches the regular expression pattern ^[(\s]*SELECT\s+, indicating it likely contains a SELECT statement potentially wrapped in parentheses and whitespace, the application logic diverges from standard sanitization procedures. Instead of applying necessary escaping mechanisms, this branch wraps the raw user-supplied value directly into an SQL string without any form of quoting or escaping. This deviation creates a direct injection vector for malicious actors who can manipulate database queries through crafted input that triggers this specific conditional path.

The severity of this vulnerability is compounded by the failure of standard WordPress security measures to mitigate the attack. In normal execution paths, such as those handling LIKE operators, the application correctly utilizes esc_sql($wpdb->esc_like(...)) and wraps values in single quotes, effectively neutralizing most injection attempts. However, because the malicious payload begins with SELECT and often lacks single quotes, it bypasses WordPress's wp_magic_quotes() function, which primarily targets quote-based escaping. Consequently, an authenticated attacker possessing administrator-level privileges can inject arbitrary SQL subqueries into the database query structure. This capability allows for sophisticated attacks, including time-based blind SQL injection techniques, where the attacker infers data by observing response times or boolean outcomes rather than direct error messages or visible data dumps.

The operational impact of this vulnerability is significant due to the high privilege level required and the potential scope of data exposure. While administrative access is typically restricted to trusted users, compromised admin accounts are a common vector for initial exploitation in WordPress environments. Once exploited, the attacker can extract sensitive information from the database, such as user credentials, configuration details containing API keys or secret tokens, and other proprietary site data stored within the WordPress tables. The ability to execute time-based blind payloads means that even if immediate feedback is not visible on the page, an automated tool can systematically reconstruct database contents by analyzing subtle differences in server response times caused by delayed SQL execution. This transforms a seemingly minor input validation error into a severe compromise of confidentiality and integrity for the entire WordPress installation.

From a classification perspective, this vulnerability aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command, specifically highlighting failures in context-appropriate escaping within conditional code paths. It also maps to MITRE ATT&CK techniques related to Database Query Injection and potentially Data Exfiltration via Blind SQLi. To mitigate this risk, site administrators must immediately update the WP Optimizer plugin to a version newer than 2.5.0 where the parse_key_compare_field() method has been patched to apply consistent escaping regardless of input pattern matching. Additionally, implementing Web Application Firewalls with rules targeting SELECT-based injection patterns can provide an additional layer of defense against exploitation attempts while patches are being deployed across affected installations.

Responsible

Wordfence

Reservation

04/14/2026

Disclosure

09/19/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!