CVE-2024-3308
Executive Summary
CVE-2024-3308 is a Stored Cross-Site Scripting (XSS) vulnerability in the HT Mega – Absolute Addons For Elementor WordPress plugin, affecting all versions up to and including 2.4.9. The flaw resides in the Image Grid widget, where insufficient input sanitization and output escaping allow authenticated attackers with contributor-level access or higher to inject arbitrary web scripts. When a user (including administrators) visits a page containing the malicious widget, the injected script executes in their browser, potentially leading to session hijacking, credential theft, or further site compromise.
This vulnerability is part of the WordPress ecosystem and is not related to Apache or Nginx. The plugin is widely used to extend Elementor page builder functionality, making this a significant supply chain risk for WordPress sites.
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
- Ecosystem: WordPress Plugin Repository
- Affected Component:
ht-mega-for-elementorplugin - Risk: Stored XSS can be used to escalate privileges, deface sites, or distribute malware to visitors.
- Patch Status: No official patch has been released as of the latest analysis. Users should disable the plugin or restrict contributor roles until a fix is available.
CVSS Breakdown & Threat Level
- CVSS Score: 6.4 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low (Contributor+)
- User Interaction: Required (victim must visit the page)
- Scope: Changed (impact may extend beyond the vulnerable component)
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
Threat Level: Medium. While the CVSS score is moderate, the ability for authenticated users to inject persistent scripts makes this a serious risk for multi-author WordPress sites.
Deep Dive & Mechanics
The vulnerability exists in the Image Grid widget of the HT Mega plugin. The widget allows users to upload images and configure grid layouts. The plugin fails to properly sanitize user-supplied input (e.g., image captions, alt text, or custom attributes) and does not escape output when rendering the widget on the front end.
Attack Flow:
- An attacker with contributor-level access creates or edits a page/post using the Elementor editor.
- The attacker adds the HT Mega Image Grid widget and injects malicious JavaScript into a field that is not sanitized (e.g., image caption or custom CSS class).
- The payload is stored in the WordPress database.
- When any user (including admins) visits the page, the script executes in their browser context.
Root Cause: The plugin uses echo or the_content filters without applying esc_html() or wp_kses() to user-controlled data. This allows HTML/JavaScript to pass through unescaped.
Vulnerable vs. Patched Code
Vulnerable Code (version 2.4.9):
// In widgets/ht-mega-image-grid.php
public function render() {
$settings = $this->get_settings_for_display();
foreach ( $settings['image_list'] as $item ) {
// Direct output without escaping
echo '<div class="ht-mega-grid-item" data-caption="' . $item['caption'] . '">';
// ...
}
}
Patched Code (hypothetical fix):
public function render() {
$settings = $this->get_settings_for_display();
foreach ( $settings['image_list'] as $item ) {
// Properly escape output
echo '<div class="ht-mega-grid-item" data-caption="' . esc_attr( $item['caption'] ) . '">';
// ...
}
}
The fix requires applying esc_attr() for HTML attributes and esc_html() or wp_kses_post() for body content.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress site with HT Mega plugin <= 2.4.9
- Contributor-level account or higher
Steps:
- Log in as a contributor.
- Create a new page using Elementor.
- Add the "Image Grid" widget.
- In the "Caption" field of any image, inject the following payload:
Or a more sophisticated payload:<img src=x onerror=alert('XSS')>"><script>fetch('/wp-admin/admin-ajax.php?action=your_malicious_action')</script> - Save and publish the page.
- When an admin visits the page, the script executes.
Note: No public exploit code is available at this time.
Blue Team (Detection & Hardening)
Detection:
- Monitor for unusual Elementor widget usage by low-privilege users.
- Look for pages containing
<script>tags or event handlers (e.g.,onerror,onload) in image captions.
Hardening:
- Disable the HT Mega plugin until a patch is released.
- Restrict contributor roles from using Elementor (use user role editor plugins).
- Implement a Web Application Firewall (WAF) rule to block common XSS patterns in POST data.
Indicators of Compromise (IOCs)
- File:
wp-content/plugins/ht-mega-for-elementor/widgets/ht-mega-image-grid.php(version <= 2.4.9) - Database: Rows in
wp_postmetawithmeta_keycontaining_elementor_dataandmeta_valuecontaining suspicious JavaScript. - Network: Outbound requests to attacker-controlled domains from the WordPress admin panel.
- Logs: WordPress debug log entries showing
wp_ksesfailures or unescaped output.
Detection Engineering
YARA Rule
rule CVE_2024_3308_HT_Mega_XSS {
meta:
description = "Detects vulnerable HT Mega plugin files with unescaped output"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-3308"
strings:
$unescaped1 = /echo\s*['\"].*\$item\[/
$unescaped2 = /data-caption\s*=\s*['\"].*\$item/
condition:
$unescaped1 or $unescaped2
}
Sigma Rule
title: CVE-2024-3308 HT Mega Stored XSS Detection
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects potential exploitation of Stored XSS in HT Mega plugin
author: Valters IT
logsource:
category: webserver
product: wordpress
detection:
selection:
http.method: POST
http.url: '*/wp-admin/admin-ajax.php*'
http.body: '*action=elementor_ajax*'
keywords:
- 'onerror='
- 'onload='
- '<script>'
condition: selection and keywords
falsepositives:
- Legitimate use of JavaScript in Elementor widgets (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2024-3308 HT Mega Stored XSS Exploit Attempt";
flow:to_server,established;
content:"POST"; http_method;
content:"/wp-admin/admin-ajax.php"; http_uri;
content:"action=elementor_ajax"; http_client_body;
pcre:"/(onerror=|onload=|<script>)/i";
sid:1000001;
rev:1;
reference:cve,2024-3308;
)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin – Deactivate HT Mega until a patched version is released.
- Restrict user roles – Remove Elementor editing capabilities from contributor and author roles.
- Audit existing content – Scan all pages/posts for injected scripts in Elementor widgets.
Long-term Fix:
- Apply the vendor patch when available (monitor the WordPress plugin repository).
- Implement a Content Security Policy (CSP) to block inline scripts.
- Use a security plugin (e.g., Wordfence) to detect and block XSS attempts.
Workaround:
- If the plugin must remain active, manually edit the vulnerable file to add
esc_attr()around all user-supplied attributes.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Analyst
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.