GHSA-cw6g-qmjq-6w2w

Suggest an improvement
Source
https://github.com/advisories/GHSA-cw6g-qmjq-6w2w
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/11/GHSA-cw6g-qmjq-6w2w/GHSA-cw6g-qmjq-6w2w.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-cw6g-qmjq-6w2w
Aliases
Published
2024-11-13T14:15:39Z
Modified
2024-11-13T19:09:41.146294Z
Severity
  • 7.7 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N CVSS Calculator
  • 7.0 (High) CVSS_V4 - 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 CVSS Calculator
Summary
Craft CMS Arbitrary System File Read
Details

Summary

By abusing the mail notification template it is possible to read arbitrary operating system files.

Details

The 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:

{{ 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

Decoded string: Bildschirmfoto 2024-09-05 um 16 28 24

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

Database specific
{
    "nvd_published_at": "2024-11-13T17:15:12Z",
    "cwe_ids": [
        "CWE-22",
        "CWE-552"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2024-11-13T14:15:39Z"
}
References

Affected packages

Packagist / craftcms/cms

Package

Name
craftcms/cms
Purl
pkg:composer/craftcms/cms

Affected ranges

Type
ECOSYSTEM
Events
Introduced
5.0.0-alpha.1
Fixed
5.4.9

Affected versions

5.*

5.0.0-alpha.1
5.0.0-alpha.2
5.0.0-alpha.3
5.0.0-alpha.4
5.0.0-alpha.5
5.0.0-alpha.6
5.0.0-alpha.7
5.0.0-alpha.8
5.0.0-alpha.9
5.0.0-alpha.10
5.0.0-alpha.11
5.0.0-alpha.12
5.0.0-alpha.13
5.0.0-beta.1
5.0.0-beta.2
5.0.0-beta.3
5.0.0-beta.4
5.0.0-beta.5
5.0.0-beta.6
5.0.0-beta.7
5.0.0-beta.8
5.0.0-beta.9
5.0.0-beta.10
5.0.0-beta.11
5.0.0-RC1
5.0.0
5.0.1
5.0.2
5.0.3
5.0.4
5.0.5
5.0.6
5.1.0
5.1.1
5.1.2
5.1.3
5.1.4
5.1.5
5.1.6
5.1.7
5.1.8
5.1.9
5.1.10
5.2.0-beta.1
5.2.0-beta.2
5.2.0-beta.3
5.2.0-beta.4
5.2.0-beta.5
5.2.0-beta.6
5.2.0
5.2.1
5.2.2
5.2.3
5.2.4
5.2.4.1
5.2.5
5.2.6
5.2.7
5.2.8
5.2.9
5.2.10
5.3.0-beta.1
5.3.0-beta.2
5.3.0
5.3.0.1
5.3.0.2
5.3.0.3
5.3.1
5.3.2
5.3.3
5.3.4
5.3.5
5.3.6
5.4.0
5.4.0.1
5.4.1
5.4.2
5.4.3
5.4.4
5.4.5
5.4.5.1
5.4.6
5.4.7
5.4.7.1
5.4.8

Database specific

{
    "last_known_affected_version_range": "<= 5.4.7.1"
}

Packagist / craftcms/cms

Package

Name
craftcms/cms
Purl
pkg:composer/craftcms/cms

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.5.13
Fixed
4.12.8

Affected versions

3.*

3.5.13
3.5.13.1
3.5.13.2
3.5.14
3.5.15
3.5.15.1
3.5.16
3.5.17
3.5.17.1
3.5.18
3.5.19
3.5.19.1
3.6.0-beta.1
3.6.0-beta.1.1
3.6.0-beta.2
3.6.0-RC1
3.6.0-RC2
3.6.0-RC2.1
3.6.0-RC3
3.6.0-RC4
3.6.0
3.6.0.1
3.6.1
3.6.2
3.6.3
3.6.4
3.6.4.1
3.6.5
3.6.5.1
3.6.6
3.6.7
3.6.8
3.6.9
3.6.10
3.6.11
3.6.11.1
3.6.11.2
3.6.12
3.6.12.1
3.6.13
3.6.14
3.6.15
3.6.16
3.6.17
3.6.18
3.7.0-beta.1
3.7.0-beta.2
3.7.0-beta.3
3.7.0-beta.4
3.7.0-beta.5
3.7.0-beta.6
3.7.0
3.7.1
3.7.2
3.7.3
3.7.3.1
3.7.3.2
3.7.4
3.7.5
3.7.6
3.7.7
3.7.8
3.7.9
3.7.10
3.7.11
3.7.12
3.7.13
3.7.14
3.7.15
3.7.16
3.7.17
3.7.17.1
3.7.17.2
3.7.18
3.7.18.1
3.7.18.2
3.7.19
3.7.19.1
3.7.20
3.7.21
3.7.22
3.7.23
3.7.24
3.7.25
3.7.25.1
3.7.26
3.7.27
3.7.27.1
3.7.27.2
3.7.28
3.7.29
3.7.30
3.7.30.1
3.7.31
3.7.32
3.7.33
3.7.34
3.7.35
3.7.36
3.7.37
3.7.38
3.7.39
3.7.40
3.7.40.1
3.7.41
3.7.42
3.7.43
3.7.44
3.7.45
3.7.45.1
3.7.45.2
3.7.46
3.7.47
3.7.47.1
3.7.48
3.7.49
3.7.50
3.7.51
3.7.52
3.7.53
3.7.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
4.4.16.1
4.4.17
4.5.0-beta.1
4.5.0-beta.2
4.5.0
4.5.1
4.5.2
4.5.3
4.5.4
4.5.5
4.5.6
4.5.6.1
4.5.7
4.5.8
4.5.9
4.5.10
4.5.11
4.5.11.1
4.5.12
4.5.13
4.5.14
4.5.15
4.6.0-RC1
4.6.0
4.6.1
4.7.0
4.7.1
4.7.2
4.7.2.1
4.7.3
4.7.4
4.8.0
4.8.1
4.8.2
4.8.3
4.8.4
4.8.5
4.8.6
4.8.7
4.8.8
4.8.9
4.8.10
4.8.11
4.9.0
4.9.1
4.9.2
4.9.3
4.9.4
4.9.5
4.9.6
4.9.7
4.10.0-beta.1
4.10.0-beta.2
4.10.0
4.10.1
4.10.2
4.10.3
4.10.4
4.10.5
4.10.6
4.10.7
4.10.8
4.11.0
4.11.0.1
4.11.0.2
4.11.1
4.11.2
4.11.3
4.11.4
4.11.5
4.12.0
4.12.1
4.12.2
4.12.3
4.12.4
4.12.4.1
4.12.5
4.12.6
4.12.6.1
4.12.7

Database specific

{
    "last_known_affected_version_range": "<= 4.12.6.1"
}