CVE-2024-9385
Executive Summary
CVE-2024-9385 is a Reflected Cross-Site Scripting (XSS) vulnerability in the Themify Builder plugin for WordPress, affecting all versions up to and including 7.6.2. The flaw arises from the insecure use of add_query_arg without proper escaping on URLs, allowing unauthenticated attackers to inject arbitrary web scripts. Successful exploitation requires user interaction (e.g., clicking a crafted link), leading to script execution in the victim's browser within the context of the WordPress site. This can result in session hijacking, credential theft, or defacement. As a WordPress plugin vulnerability, it is critical to update the plugin or apply a virtual patch.
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. No supply chain compromise has been reported, but users should verify plugin integrity and update from trusted sources only.
CVSS Breakdown & Threat Level
- CVSS Score: 6.1 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: Required
- Scope: Changed
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
Threat Level: Medium. Exploitation is straightforward but requires user interaction. The impact is limited to script execution in the user's session.
Deep Dive & Mechanics
The vulnerability exists in the add_query_arg function usage within the Themify Builder plugin. In PHP, add_query_arg builds a URL by appending query parameters. When user-supplied input (e.g., via $_SERVER['REQUEST_URI'] or $_GET parameters) is passed to add_query_arg without escaping, an attacker can inject malicious JavaScript code into the generated URL. This URL is then reflected back to the user (e.g., in a redirect or link), leading to XSS.
The vulnerable code likely resembles:
$url = add_query_arg( 'return', $_GET['return'], home_url() );
echo '<a href="' . $url . '">Click here</a>';
An attacker can craft a URL like:
https://victim.com/?return=javascript:alert(document.cookie)
When the victim clicks the link, the JavaScript executes.
Vulnerable vs. Patched Code
Vulnerable Code (<= 7.6.2):
$url = add_query_arg( 'return', $_GET['return'], home_url() );
echo '<a href="' . $url . '">Go Back</a>';
Patched Code (Hypothetical):
$return_url = esc_url( add_query_arg( 'return', esc_url_raw( $_GET['return'] ), home_url() ) );
echo '<a href="' . $return_url . '">Go Back</a>';
The patch uses esc_url() and esc_url_raw() to sanitize the URL and prevent script injection.
Exploitation & Lab Setup
Red Team (Exploitation)
- Setup: Install WordPress with Themify Builder <= 7.6.2 on a local server.
- Craft Payload: Create a malicious URL:
http://localhost/wp-admin/?return=javascript:alert('XSS') - Deliver: Send the link to a victim (e.g., via email or social engineering).
- Execute: When the victim clicks the link, the JavaScript executes in their browser.
Example Exploit URL:
http://victim-site.com/?return=%22%3E%3Cscript%3Ealert(1)%3C/script%3E
Blue Team (Detection & Defense)
- Monitor Logs: Look for unusual query parameters containing
return=with JavaScript or HTML tags. - Web Application Firewall (WAF): Block requests with
returnparameter containing<script>orjavascript:. - User Education: Train users not to click suspicious links.
Indicators of Compromise (IOCs)
- URL Patterns: Requests containing
?return=followed by encoded JavaScript or HTML. - Log Entries: HTTP requests with
returnparameter containing<script>,onerror,javascript:, ordata:URIs. - File Hashes: N/A (plugin files unchanged).
- Network Traffic: Outbound connections to attacker-controlled domains (if payload exfiltrates data).
Detection Engineering
YARA Rule
rule CVE_2024_9385_Themify_XSS {
meta:
description = "Detects reflected XSS attempts against Themify Builder plugin"
author = "Valters IT"
date = "2024-10-01"
reference = "CVE-2024-9385"
strings:
$xss1 = /return=.*?<script/i
$xss2 = /return=.*?javascript:/i
$xss3 = /return=.*?onerror/i
$xss4 = /return=.*?alert\(/i
condition:
any of them
}
Sigma Rule
title: Reflected XSS Attempt Against Themify Builder
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects reflected XSS attempts targeting CVE-2024-9385
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: GET
cs-uri-query|contains: 'return='
cs-uri-query|re: '(?:<script|javascript:|onerror|alert\()'
condition: selection
falsepositives:
- Legitimate use of 'return' parameter with safe values
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-9385 Themify Builder Reflected XSS Attempt"; flow:to_server; content:"return="; http_uri; pcre:"/return=.*?(?:<script|javascript:|onerror|alert\()/i"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Disable the Themify Builder plugin until a patch is available.
- Virtual Patch: Use a WAF to block requests containing
return=with suspicious patterns. - Update: Apply the official patch when released (check WordPress plugin repository).
- Code Fix: Ensure all uses of
add_query_argare wrapped withesc_url(). - User Training: Educate users to avoid clicking untrusted links.
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.