CVE-2024-5002
Executive Summary
CVE-2024-5002 is a Stored Cross-Site Scripting (XSS) vulnerability in the User Submitted Posts WordPress plugin, affecting versions prior to 20240516. The vulnerability arises from insufficient sanitization and escaping of plugin settings, allowing high-privilege users (e.g., administrators) to inject arbitrary JavaScript. In multisite WordPress configurations, where the unfiltered_html capability is typically disallowed, this flaw enables privilege escalation and persistent compromise of the admin interface. The CVSS score is 0.0 due to incomplete NVD data, but the actual risk is elevated in shared hosting or multisite environments.
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 specific to the WordPress plugin ecosystem. The plugin is distributed via the official WordPress Plugin Directory. Users should verify the integrity of the plugin by checking the SHA-256 hash against the official repository. No known supply chain compromise has been reported, but the lack of a patch for older versions increases risk for unmaintained sites.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The attack is performed over the network.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): High (H) – Requires admin-level access.
- User Interaction (UI): Required (R) – Victim must visit the admin page.
- Scope (S): Changed (C) – Impact extends beyond the vulnerable component.
- Confidentiality (C): Low (L) – Limited data exposure.
- Integrity (I): Low (L) – Limited ability to modify data.
- Availability (A): None (N) – No impact on availability.
Threat Level: Medium (5.4) – Exploitation requires admin privileges but can lead to persistent XSS in multisite setups.
Deep Dive & Mechanics
The User Submitted Posts plugin allows site visitors to submit posts from the frontend. The vulnerability exists in the plugin’s settings page, where options such as custom messages, redirect URLs, and form labels are stored without proper sanitization or output escaping. An admin user can inject malicious JavaScript into these settings fields. When another admin (or the same admin) views the settings page, the injected script executes in the context of the WordPress admin dashboard.
In a multisite network, super admins can manage settings for all subsites. If a subsite admin with limited privileges (who cannot normally use unfiltered_html) exploits this vulnerability, they can inject scripts that execute when the super admin visits the network admin settings page. This can lead to session hijacking, privilege escalation, or deployment of backdoors.
The root cause is the use of echo or _e() functions without wrapping the output in esc_html() or wp_kses_post(). The plugin fails to validate that the stored data is safe for output in the admin context.
Vulnerable vs. Patched Code
Vulnerable Code (pre-20240516):
// In settings page rendering
echo '<input type="text" name="usp_custom_message" value="' . get_option('usp_custom_message') . '" />';
The get_option() value is directly echoed without escaping, allowing stored XSS.
Patched Code (20240516):
// In settings page rendering
echo '<input type="text" name="usp_custom_message" value="' . esc_attr( get_option('usp_custom_message') ) . '" />';
The esc_attr() function escapes the output, preventing XSS.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- Admin access to a WordPress site running User Submitted Posts < 20240516.
- In a multisite, the attacker must be a subsite admin.
Steps:
- Navigate to Settings > User Submitted Posts.
- In the "Custom Message" field, inject the following payload:
<script>alert('XSS');</script> - Save the settings.
- When any admin visits the settings page, the script executes.
Advanced Payload (Session Hijacking):
<script>
fetch('/wp-admin/admin-ajax.php?action=your_custom_action', {
method: 'POST',
credentials: 'include',
body: new URLSearchParams({ 'cookie': document.cookie })
});
</script>
Blue Team (Detection & Hardening)
Detection:
- Monitor for changes to the
usp_custom_messageoption in thewp_optionstable. - Look for unusual JavaScript in plugin settings fields via database queries.
Hardening:
- Update the plugin to version 20240516 or later.
- Restrict admin access to trusted users only.
- Use a Web Application Firewall (WAF) to block XSS payloads in admin requests.
Indicators of Compromise (IOCs)
- File:
/wp-content/plugins/user-submitted-posts/user-submitted-posts.php(check version string) - Database:
wp_optionstable,option_name=usp_custom_messagecontaining<script>tags. - Network: Outbound HTTP requests to attacker-controlled domains from admin dashboard.
- Logs: WordPress debug log entries showing
wp_ajax_calls with suspicious parameters.
Detection Engineering
YARA Rule
rule Detect_User_Submitted_Posts_XSS {
meta:
description = "Detects stored XSS payloads in User Submitted Posts plugin settings"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-5002"
strings:
$xss_payload = /<script[^>]*>.*?<\/script>/is
$usp_option = "usp_custom_message"
condition:
$usp_option and $xss_payload
}
Sigma Rule
title: Stored XSS in User Submitted Posts Plugin Settings
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects attempts to store XSS payloads in the User Submitted Posts plugin settings
author: Valters IT
logsource:
category: application
product: wordpress
detection:
selection:
EventID: 1000
Plugin: "user-submitted-posts"
Action: "update_option"
OptionName: "usp_custom_message"
OptionValue|contains: "<script"
condition: selection
falsepositives:
- Legitimate use of JavaScript in settings (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-5002 Stored XSS in User Submitted Posts"; flow:to_server,established; content:"POST"; http_method; content:"/wp-admin/options.php"; http_uri; content:"usp_custom_message"; http_client_body; pcre:"/<script[^>]*>.*?<\/script>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Update the plugin to version 20240516 or later from the WordPress Plugin Directory.
- Short-term: If unable to update, manually patch the vulnerable file by adding
esc_attr()to all output of plugin settings. - Long-term: Implement a Content Security Policy (CSP) header to restrict script execution in the admin area.
- Monitoring: Enable WordPress audit logging to track changes to plugin settings.
- Access Control: Review admin user lists and remove unnecessary high-privilege accounts.
Valters IT – Securing WordPress ecosystems through proactive 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.