CVE-2024-1541
Executive Summary
CVE-2024-1541 is a Stored Cross-Site Scripting (XSS) vulnerability in the Gutenberg Blocks by Kadence Blocks – Page Builder Features plugin for WordPress. The flaw exists in all versions up to and including 3.2.23, due to insufficient input sanitization and output escaping on the htmlTag attribute. An authenticated attacker with contributor-level access or higher can inject arbitrary web scripts into pages. When a user visits the compromised page, the injected script executes in their browser, potentially leading to session hijacking, defacement, or data theft.
This vulnerability is specific to the WordPress ecosystem and affects the Kadence Blocks plugin, not the underlying web server (Apache/Nginx). The EPSS score is 0.0%, indicating low exploitation likelihood at the time of analysis, but the risk remains significant for sites with multiple contributors.
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 is not related to NPM, PyPI, Go, or Ruby packages. It is a WordPress plugin vulnerability. The plugin is distributed via the WordPress plugin repository and can be updated through the WordPress admin dashboard.
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:L
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low (Contributor)
- User Interaction: Required (Victim visits page)
- Scope: Changed
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: Low
The medium severity reflects the need for authenticated access and user interaction, but the potential for stored XSS in a widely-used page builder plugin makes it a notable threat.
Deep Dive & Mechanics
The vulnerability resides in the htmlTag attribute of Kadence Blocks. When a block is rendered, the plugin fails to properly sanitize and escape the htmlTag value before outputting it in the HTML. An attacker with contributor access can create or edit a page using Kadence Blocks and set the htmlTag attribute to a malicious payload, such as <img src=x onerror=alert(1)>. This payload is stored in the WordPress database and executed when any user (including administrators) views the page.
The root cause is the lack of input validation and output escaping in the block rendering function. The plugin likely uses echo $htmlTag; without applying esc_attr() or wp_kses().
Vulnerable vs. Patched Code
Vulnerable Code (<= 3.2.23):
// In the block render function
$htmlTag = $attributes['htmlTag'];
echo '<' . $htmlTag . '>'; // No sanitization
Patched Code (Hypothetical):
// In the block render function
$htmlTag = isset($attributes['htmlTag']) ? esc_attr($attributes['htmlTag']) : 'div';
echo '<' . $htmlTag . '>'; // Sanitized
The patch would involve using esc_attr() to escape the attribute value and potentially validating it against a whitelist of allowed HTML tags.
Exploitation & Lab Setup
Red Team
- Prerequisites: WordPress site with Kadence Blocks <= 3.2.23, contributor-level account.
- Steps:
- Log in as contributor.
- Create a new page or edit an existing one.
- Add a Kadence Block (e.g., Advanced Heading).
- In the block settings, set the
htmlTagattribute to:<img src=x onerror=alert('XSS')> - Save/publish the page.
- When any user visits the page, the script executes.
Proof of Concept (PoC):
<!-- Injected via htmlTag attribute -->
<img src=x onerror=alert('XSS')>
Blue Team
- Detection: Monitor for unusual
htmlTagvalues in page/post content. Use WAF rules to block common XSS payloads. - Response: Immediately remove the malicious page, revoke contributor access if compromised, and update the plugin.
- Forensics: Check database for injected scripts in
wp_posts.post_content.
Indicators of Compromise (IOCs)
- File:
wp-content/plugins/kadence-blocks/(version <= 3.2.23) - Database: Entries in
wp_posts.post_contentcontaining<img src=x onerror=or similar XSS payloads. - Network: Outbound connections from the victim's browser to attacker-controlled domains (if payload exfiltrates data).
- Logs: WordPress audit logs showing page edits by contributors with suspicious
htmlTagvalues.
Detection Engineering
YARA Rule
rule CVE_2024_1541_Kadence_XSS {
meta:
description = "Detects stored XSS payloads in Kadence Blocks htmlTag attribute"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-1541"
strings:
$xss_payload = /<[^>]*onerror\s*=\s*['"]?[^'"]*['"]?[^>]*>/i
$html_tag_attr = /htmlTag\s*=\s*['"][^'"]*['"]/
condition:
$html_tag_attr and $xss_payload
}
Sigma Rule
title: Stored XSS via Kadence Blocks htmlTag
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects stored XSS attempts using the htmlTag attribute in Kadence Blocks
author: Valters IT
date: 2025/04/10
logsource:
category: webserver
product: wordpress
detection:
selection:
http.url|contains: "/wp-admin/post.php"
http.body|contains: "htmlTag"
http.body|contains|re: "<[^>]*onerror"
condition: selection
falsepositives:
- Legitimate use of onerror in rare cases
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-1541 Kadence Blocks Stored XSS"; flow:to_server; content:"htmlTag"; http_client_body; pcre:"/<[^>]*onerror\s*=/i"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Disable the Kadence Blocks plugin if no patch is available. Restrict contributor-level access.
- Update: Apply the vendor patch when released (check WordPress plugin repository for updates).
- WAF: Deploy web application firewall rules to block XSS payloads in
htmlTagattribute. - Hardening: Implement Content Security Policy (CSP) headers to mitigate XSS impact.
- Monitoring: Enable WordPress audit logging and monitor for suspicious page edits.
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.