CVE-2024-52292: Craftcms/cms Craft CMS Arbitrary System File Vulnerability

HIGH
Advisory Identifier: GHSA-cw6g-qmjq-6w2w
CVSS 7.7
CWE-552 CWE-22
Published
Advisory Summary

CVE-2024-52292 is a HIGH (CVSS 7.7) craft cms arbitrary system file vulnerability (CWE-552: Files or Directories Accessible to External Parties) affecting Craftcms/cms libraries in the Packagist ecosystem. The issue involves craft cms arbitrary system file read. Remediation is available by upgrading affected packages to version 5.4.9, 4.12.8.

CVE-2024-52292 at a Glance

CVE Identifier CVE-2024-52292
GHSA Identifier GHSA-cw6g-qmjq-6w2w
Severity HIGH
CVSS v3.1 Base Score 7.7
CWE Classification CWE-552: Files or Directories Accessible to External Parties
Affected Product Craftcms/cms
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 7.7

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:N).

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 None (A:N)

How to Fix CVE-2024-52292

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

craftcms/cms fixed: 5.4.9
Upgrade craftcms/cms to 5.4.9
craftcms/cms fixed: 4.12.8
Upgrade craftcms/cms to 4.12.8
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 craftcms/cms

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-52292, inspect your project dependencies for Craftcms/cms:

inspect dependencies for craftcms/cms

Analyze the terminal output to locate any version of Craftcms/cms in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.4.9), 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-552: Files or Directories Accessible to External Parties, where the product makes files or directories accessible to unauthorized actors, even though they should not be. In Craftcms/cms, 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 By abusing the mail notification template it is possible to read arbitrary operating system files. ### Details The [dataUrl](https://craftcms.com/docs/3.x/dev/functions.html#dataurl) function can be exploited if an attacker has write permissions on system notification templates. This function accepts an absolute file path, reads the file's content, and converts it into a Base64-encoded string. By embedding this function within a system notification template, the attacker can exfiltrate the Base64-encoded file content through a triggered system email notification. Once the email is received, the Base64 payload can be decoded, allowing the attacker to read arbitrary files on the server. Requirements: * write permissions to system notification templates * ability to trigger a corresponding system email ### PoC 1) Modify a template to contain the following twig template string: ```twig {{ dataUrl('/var/www/web/.env') }} ``` 2) Trigger the corresponding notification email (e.g. by resetting a password) 3) Receive the email and decode the base64 string Mail received: ![Bildschirmfoto 2024-09-05 um 16 20 41](https://github.com/user-attachments/assets/24dc5196-6847-4006-b7ef-8cd10d659c30) Decoded string: ![Bildschirmfoto 2024-09-05 um 16 28 24](https://github.com/user-attachments/assets/1913a475-5277-49b9-9210-2f3fcd3b9bf1) ### Impact 1) Exposure of Sensitive Information: Arbitrary file read can lead to the exposure of sensitive data such as configuration files (e.g., /etc/passwd, .env, config.php), which may contain credentials, API keys, or database passwords. This can provide the attacker with further access to the system or connected services. 2) Privilege Escalation: If the attacker is able to read files that contain privileged information, such as credentials for other systems or applications, they may be able to escalate their privileges beyond what the web admin role originally allowed, potentially gaining full control over the server or other related systems. 3) Server Compromise: Access to files like SSH keys, private certificates, or system configuration files can lead to the complete compromise of the underlying server. With this information, an attacker could remotely log in to the server or impersonate it in secure communications. 4) Exfiltration of User Data: The ability to read arbitrary files may allow an attacker to access user data, such as stored passwords, session tokens, or private information (like uploaded files or logs), leading to a breach of confidentiality and violating privacy regulations (e.g., GDPR).

CVE-2024-52292 Affected Craftcms/cms Versions

2 component(s)
Fixed Versions:
5.4.94.12.8
Product / Package Ecosystem Affected Versions Fixed Version
craftcms/cms
Packagist
≥ 5.0.0-alpha.1
< 5.4.9
5.4.9
craftcms/cms
Packagist
≥ 3.5.13
< 4.12.8
4.12.8

References

Frequently Asked Questions

What is CVE-2024-52292?
CVE-2024-52292 is a security vulnerability in Craftcms/cms involving Craft CMS Arbitrary System File Read under CWE-552: Files or Directories Accessible to External Parties.
Which Craftcms/cms versions are affected?
Affected versions include releases prior to 5.4.9, 4.12.8 across affected packages: craftcms/cms.
What version fixes CVE-2024-52292?
Upgrading to 5.4.9, 4.12.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is craftcms/cms affected?
Yes, craftcms/cms is affected in releases prior to 5.4.9, 4.12.8. Upgrade your dependency to 5.4.9, 4.12.8 or later.
What is the CVSS score of CVE-2024-52292?
CVE-2024-52292 has a CVSS v3.1 base score of 7.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2024-52292?
CVE-2024-52292 is classified under CWE-552: Files or Directories Accessible to External Parties (The product makes files or directories accessible to unauthorized actors, even though they should not be.).
How can I check Packagist dependencies for CVE-2024-52292?
Run the dependency tree command: 'inspect dependencies for craftcms/cms'. 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-cw6g-qmjq-6w2w",
  "modified" : "2024-11-13T18:58:35Z",
  "published" : "2024-11-13T14:15:39Z",
  "aliases" : [ "CVE-2024-52292" ],
  "summary" : "Craft CMS Arbitrary System File Read",
  "details" : "### Summary\nBy abusing the mail notification template it is possible to read arbitrary operating system files. \n\n### Details\nThe [dataUrl](https://craftcms.com/docs/3.x/dev/functions.html#dataurl) function can be exploited if an attacker has write permissions on system notification templates. This function accepts an absolute file path, reads the file's content, and converts it into a Base64-encoded string. By embedding this function within a system notification template, the attacker can exfiltrate the Base64-encoded file content through a triggered system email notification. Once the email is received, the Base64 payload can be decoded, allowing the attacker to read arbitrary files on the server.\n\nRequirements:\n* write permissions to system notification templates\n* ability to trigger a corresponding system email\n\n### PoC\n1) Modify a template to contain the following twig template string:\n```twig\n{{ dataUrl('/var/www/web/.env') }}\n```\n2) Trigger the corresponding notification email (e.g. by resetting a password)\n3) Receive the email and decode the base64 string\n\nMail received:\n![Bildschirmfoto 2024-09-05 um 16 20 41](https://github.com/user-attachments/assets/24dc5196-6847-4006-b7ef-8cd10d659c30)\n\nDecoded string:\n![Bildschirmfoto 2024-09-05 um 16 28 24](https://github.com/user-attachments/assets/1913a475-5277-49b9-9210-2f3fcd3b9bf1)\n\n\n### Impact\n1) Exposure of Sensitive Information: Arbitrary file read can lead to the exposure of sensitive data such as configuration files (e.g., /etc/passwd, .env, config.php), which may contain credentials, API keys, or database passwords. This can provide the attacker with further access to the system or connected services.\n\n2) Privilege Escalation: If the attacker is able to read files that contain privileged information, such as credentials for other systems or applications, they may be able to escalate their privileges beyond what the web admin role originally allowed, potentially gaining full control over the server or other related systems.\n\n3) Server Compromise: Access to files like SSH keys, private certificates, or system configuration files can lead to the complete compromise of the underlying server. With this information, an attacker could remotely log in to the server or impersonate it in secure communications.\n\n4) Exfiltration of User Data: The ability to read arbitrary files may allow an attacker to access user data, such as stored passwords, session tokens, or private information (like uploaded files or logs), leading to a breach of confidentiality and violating privacy regulations (e.g., GDPR).\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N/E:P"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "craftcms/cms"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0-alpha.1"
      }, {
        "fixed" : "5.4.9"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.4.7.1"
    }
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "craftcms/cms"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.5.13"
      }, {
        "fixed" : "4.12.8"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.12.6.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/craftcms/cms/security/advisories/GHSA-cw6g-qmjq-6w2w"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-52292"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/craftcms/cms"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-552" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-13T14:15:39Z",
    "nvd_published_at" : "2024-11-13T17:15:12Z"
  }
}