CVE-2025-66302: Getgrav/grav Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-j422-qmxp-hv94
CVSS 6.8
CWE-22
Published
Advisory Summary

CVE-2025-66302 is a MODERATE (CVSS 6.8) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Getgrav/grav libraries in the Packagist ecosystem. The issue involves grav vulnerable to path traversal allowing server files backup. Remediation is available by upgrading affected packages to version 1.8.0-beta.27.

CVE-2025-66302 at a Glance

CVE Identifier CVE-2025-66302
GHSA Identifier GHSA-j422-qmxp-hv94
Severity MODERATE
CVSS v3.1 Base Score 6.8
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Getgrav/grav
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 6.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2025-66302

To remediate this vulnerability, upgrade all affected Getgrav/grav dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

getgrav/grav fixed: 1.8.0-beta.27
Upgrade getgrav/grav to 1.8.0-beta.27
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for getgrav/grav

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-66302, inspect your project dependencies for Getgrav/grav:

inspect dependencies for getgrav/grav

Analyze the terminal output to locate any version of Getgrav/grav in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.8.0-beta.27), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Getgrav/grav, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary ``` A path traversal vulnerability has been identified in Grav CMS, versions 1.7.49.5 , allowing authenticated attackers with administrative privileges to read arbitrary files on the underlying server filesystem. This vulnerability arises due to insufficient input sanitization in the backup tool, where user-supplied paths are not properly restricted, enabling access to files outside the intended webroot directory. The impact of this vulnerability depends on the privileges of the user account running the application. ``` ### PoC ``` To accurately demonstrate the maximum potential impact of this vulnerability, the testing environment was configured in a specific way: - Elevated Privileges: The application was run locally with the highest possible system privileges, operating under the **`root`** user account. - Objective: This configuration was chosen to unequivocally show that the path traversal vulnerability is not just a theoretical issue but can lead to a complete compromise of the underlying host when combined with poor operational practices. The ability to read any file on the system is the ultimate test of the flaw's severity. Proof of Concept Goal: Under these conditions, the subsequent PoC will exploit the vulnerability to read the SSH private key of the `root` user (`/root/.ssh/id_rsa`). The successful exfiltration of this key represents a worst-case scenario, as it would provide an attacker with persistent, undetectable, and complete administrative access to the host server. This highlights the critical intersection of an application-layer vulnerability and a infrastructure-level misconfiguration. ``` ``` 1- LOGIN AS ADMIN AND GO TO : http://127.0.0.1/admin/tools/backups 2- Change 'Root Folder' to backup directory /../../../../../../../root/.ssh/ ``` <img width="1902" height="492" alt="Screenshot 2025-09-11 161519" src="https://github.com/user-attachments/assets/23a60dc3-7758-4e24-b910-e66a1dd1f5e2" /> ``` 3- CLICK : 'SAVE' 4- CLICK : 'Backup Now' ``` <img width="1916" height="512" alt="Screenshot 2025-09-11 154151" src="https://github.com/user-attachments/assets/88a63ff2-777e-467e-857b-0644ef698499" /> ``` 5- Extract Backup : ``` <img width="704" height="101" alt="Screenshot 2025-09-11 160114" src="https://github.com/user-attachments/assets/b91ce4db-9843-4280-b8f0-32c73aa12d4d" /> <img width="567" height="101" alt="Screenshot 2025-09-11 160135" src="https://github.com/user-attachments/assets/155ce7d8-c2fc-4b54-b054-f7c7550bec82" />

CVE-2025-66302 Affected Getgrav/grav Versions

1 component(s)
Fixed Versions:
1.8.0-beta.27
Product / Package Ecosystem Affected Versions Fixed Version
getgrav/grav
Packagist
< 1.8.0-beta.27
1.8.0-beta.27

References

Frequently Asked Questions

What is CVE-2025-66302?
CVE-2025-66302 is a security vulnerability in Getgrav/grav involving Grav vulnerable to Path Traversal allowing server files backup under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Getgrav/grav versions are affected?
Affected versions include releases prior to 1.8.0-beta.27 across affected packages: getgrav/grav.
What version fixes CVE-2025-66302?
Upgrading to 1.8.0-beta.27 (or the latest patched release for your respective branch) resolves the vulnerability.
Is getgrav/grav affected?
Yes, getgrav/grav is affected in releases prior to 1.8.0-beta.27. Upgrade your dependency to 1.8.0-beta.27 or later.
What is the CVSS score of CVE-2025-66302?
CVE-2025-66302 has a CVSS v3.1 base score of 6.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2025-66302?
CVE-2025-66302 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Packagist dependencies for CVE-2025-66302?
Run the dependency tree command: 'inspect dependencies for getgrav/grav'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-j422-qmxp-hv94",
  "modified" : "2025-12-02T00:38:41Z",
  "published" : "2025-12-02T00:38:41Z",
  "aliases" : [ "CVE-2025-66302" ],
  "summary" : "Grav vulnerable to Path Traversal allowing server files backup",
  "details" : "### Summary\n```\nA path traversal vulnerability has been identified in Grav CMS, versions 1.7.49.5 , allowing authenticated attackers\n with administrative privileges to read arbitrary files on the underlying server filesystem. This vulnerability arises due\n to insufficient input sanitization in the backup tool, where user-supplied paths are not properly restricted, enabling\n access to files outside the intended webroot directory. The impact of this vulnerability depends on the privileges of \nthe user account running the application.\n```\n\n### PoC\n```\nTo accurately demonstrate the maximum potential impact of this vulnerability, the testing environment was configured in a specific way:\n\n- Elevated Privileges: The application was run locally with the highest possible system privileges, operating under the **`root`** user account.\n    \n- Objective: This configuration was chosen to unequivocally show that the path traversal vulnerability is not just a theoretical issue but can lead to a complete compromise of the underlying host when combined with poor operational practices. The ability to read any file on the system is the ultimate test of the flaw's severity.\n    \n\nProof of Concept Goal: Under these conditions, the subsequent PoC will exploit the vulnerability to read the SSH private key\n of the `root` user (`/root/.ssh/id_rsa`). The successful exfiltration of this key represents a worst-case scenario, as it would provide \nan attacker with persistent, undetectable, and complete administrative access to the host server. This highlights the critical intersection\n of an application-layer vulnerability and a infrastructure-level misconfiguration.\n\n```\n\n\n\n\n```\n1- LOGIN AS ADMIN AND  GO TO  : http://127.0.0.1/admin/tools/backups\n2- Change 'Root Folder' to backup directory /../../../../../../../root/.ssh/ \n\n```\n<img width=\"1902\" height=\"492\" alt=\"Screenshot 2025-09-11 161519\" src=\"https://github.com/user-attachments/assets/23a60dc3-7758-4e24-b910-e66a1dd1f5e2\" />\n\n\n\n```\n3- CLICK  : 'SAVE'\n4- CLICK  : 'Backup Now'\n```\n\n<img width=\"1916\" height=\"512\" alt=\"Screenshot 2025-09-11 154151\" src=\"https://github.com/user-attachments/assets/88a63ff2-777e-467e-857b-0644ef698499\" />\n\n```\n5- Extract Backup :\n```\n\n\n<img width=\"704\" height=\"101\" alt=\"Screenshot 2025-09-11 160114\" src=\"https://github.com/user-attachments/assets/b91ce4db-9843-4280-b8f0-32c73aa12d4d\" />\n<img width=\"567\" height=\"101\" alt=\"Screenshot 2025-09-11 160135\" src=\"https://github.com/user-attachments/assets/155ce7d8-c2fc-4b54-b054-f7c7550bec82\" />",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "getgrav/grav"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.8.0-beta.27"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/getgrav/grav/security/advisories/GHSA-j422-qmxp-hv94"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-66302"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/getgrav/grav/commit/ed640a13143c4177af013cf001969ed2c5e197ee"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/getgrav/grav"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-12-02T00:38:41Z",
    "nvd_published_at" : "2025-12-01T22:15:49Z"
  }
}