CVE-2024-34082: Getgrav/grav Grav Vulnerable To Arbitrary File Vulnerability

HIGH
Advisory Identifier: GHSA-f8v5-jmfh-pr69
CVSS 8.5
CWE-269 CWE-22
Published
Advisory Summary

CVE-2024-34082 is a HIGH (CVSS 8.5) grav vulnerable to arbitrary file vulnerability (CWE-269: Improper Privilege Management) affecting Getgrav/grav libraries in the Packagist ecosystem. The issue involves grav vulnerable to arbitrary file read to account takeover. Remediation is available by upgrading affected packages to version 1.7.46.

CVE-2024-34082 at a Glance

CVE Identifier CVE-2024-34082
GHSA Identifier GHSA-f8v5-jmfh-pr69
Severity HIGH
CVSS v3.1 Base Score 8.5
CWE Classification CWE-269: Improper Privilege Management
Affected Product Getgrav/grav
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.5

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

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

How to Fix CVE-2024-34082

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.7.46
Upgrade getgrav/grav to 1.7.46
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-2024-34082, 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.7.46), 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-269: Improper Privilege Management, where the product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. 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 low privilege user account with page edit privilege can read any server files using Twig Syntax. This includes Grav user account files - /grav/user/accounts/*.yaml. This file stores hashed user password, 2FA secret, and the password reset token. This can allow an adversary to compromise any registered account by resetting a password for a user to get access to the password reset token from the file or by cracking the hashed password. ### Proof Of Concept `{{ read_file('/var/www/html/grav/user/accounts/riri.yaml') }}` Use the above Twig template syntax in a page and observe that the administrator riri's authentication details are exposed accessible by any unauthenticated user. ![file-read-2-ATO](https://github.com/getgrav/grav/assets/48800246/9dee4daa-f029-40dd-9646-94c794d3f254) As an additional proof of concept for reading system files, observe the `/etc/passwd` file read using the following Twig syntax: `{{ read_file('/etc/passwd') }}` ![file-read-etc-passwd](https://github.com/getgrav/grav/assets/48800246/e45de4d4-f81f-42cf-8466-aa36b225ca94) ### Impact This can allow a low privileged user to perform a full account takeover of other registered users including Adminsitrators. This can also allow an adversary to read any file in the web server.

CVE-2024-34082 Affected Getgrav/grav Versions

1 component(s)
Fixed Versions:
1.7.46
Product / Package Ecosystem Affected Versions Fixed Version
getgrav/grav
Packagist
< 1.7.46
1.7.46

References

Frequently Asked Questions

What is CVE-2024-34082?
CVE-2024-34082 is a security vulnerability in Getgrav/grav involving Grav Vulnerable to Arbitrary File Read to Account Takeover under CWE-269: Improper Privilege Management.
Which Getgrav/grav versions are affected?
Affected versions include releases prior to 1.7.46 across affected packages: getgrav/grav.
What version fixes CVE-2024-34082?
Upgrading to 1.7.46 (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.7.46. Upgrade your dependency to 1.7.46 or later.
What is the CVSS score of CVE-2024-34082?
CVE-2024-34082 has a CVSS v3.1 base score of 8.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:L.
What CWE is associated with CVE-2024-34082?
CVE-2024-34082 is classified under CWE-269: Improper Privilege Management (The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.).
How can I check Packagist dependencies for CVE-2024-34082?
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-f8v5-jmfh-pr69",
  "modified" : "2024-05-15T19:35:22Z",
  "published" : "2024-05-15T17:15:51Z",
  "aliases" : [ "CVE-2024-34082" ],
  "summary" : "Grav Vulnerable to Arbitrary File Read to Account Takeover",
  "details" : "### Summary\nA low privilege user account with page edit privilege can read any server files using Twig Syntax. This includes Grav user account files - /grav/user/accounts/*.yaml. This file stores hashed user password, 2FA secret, and the password reset token. This can allow an adversary to compromise any registered account by resetting a password for a user to get access to the password reset token from the file or by cracking the hashed password.\n\n### Proof Of Concept\n`{{ read_file('/var/www/html/grav/user/accounts/riri.yaml') }}`\n\nUse the above Twig template syntax in a page and observe that the administrator riri's authentication details are exposed accessible by any unauthenticated user. \n\n![file-read-2-ATO](https://github.com/getgrav/grav/assets/48800246/9dee4daa-f029-40dd-9646-94c794d3f254)\n\nAs an additional proof of concept for reading system files, observe the `/etc/passwd` file read using the following Twig syntax:\n`{{ read_file('/etc/passwd') }}`\n\n![file-read-etc-passwd](https://github.com/getgrav/grav/assets/48800246/e45de4d4-f81f-42cf-8466-aa36b225ca94)\n\n### Impact\nThis can allow a low privileged user to perform a full account takeover of other registered users including Adminsitrators. This can also allow an adversary to read any file in the web server.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "getgrav/grav"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.7.46"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/getgrav/grav/security/advisories/GHSA-f8v5-jmfh-pr69"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-34082"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/getgrav/grav/commit/b6bba9eb99bf8cb55b8fa8d23f18873ca594e348"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/getgrav/grav"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-269" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-15T17:15:51Z",
    "nvd_published_at" : "2024-05-15T17:15:12Z"
  }
}