CVE-2026-72779: Craft CMS: Arbitrary file read via SplFileObject in non-sandboxed template contexts
The create() Twig function (introduced in 5.9.0) allows instantiation of arbitrary PHP classes from template code, restricted only by a 5-entry blocklist. SplFileObject is not in the blocklist, enabling arbitrary file read, including .env (security key, DB credentials) and the passwd file from non-sandboxed Twig template contexts, such as entry type title formats and URI formats.
Published Aug 6, 2026 · Updated Sep 1, 2026
Affected packages
craftcms/cms
- Ecosystem
- Composer (PHP)
- Affected
- >= 5.0.0-RC1, < 5.10.6
- Fixed in
- 5.10.6
- Check
composer show craftcms/cms
craftcms/cms
- Ecosystem
- Composer (PHP)
- Affected
- >= 4.0.0-RC1, < 4.18.2
- Fixed in
- 4.18.2
- Check
composer show craftcms/cms
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
The create() Twig function (introduced in 5.9.0) allows instantiation of arbitrary PHP classes from template code, restricted only by a 5-entry blocklist. SplFileObject is not in the blocklist, enabling arbitrary file read, including .env (security key, DB credentials) and the passwd file from non-sandboxed Twig template contexts, such as entry type title formats and URI formats.
The sandbox correctly blocks create() in system email templates, so this finding applies only to admin-configured, non-sandboxed contexts that require allowAdminChanges=true.
Prerequisites
- Admin access to the Craft control panel
allowAdminChangesmust betrue(default in dev/staging, recommendedfalsein production)- Admin must be able to edit entry type settings (title format, URI format)
- Any user who subsequently creates an entry in the affected section triggers the file read
Limitations
- Requires admin-level access: not exploitable by low-privilege users
allowAdminChangesmust betrue: production best practices recommendfalse, which prevents entry type configuration changes- Per Craft’s own severity guidelines, findings requiring
allowAdminChanges=trueare rated low - The
create()function is blocked by the Twig sandbox, so this cannot be exploited via system email templates or any other sandboxed context
Impact
An admin user (or an attacker who has compromised an admin account) can read arbitrary files from the server filesystem by setting a malicious entry type title format using create('SplFileObject', ['/path/to/file']). In production environments, this exposes .env files containing the CRAFT_SECURITY_KEY, database credentials, API keys, and other secrets. The file contents are rendered as entry titles visible to any user with permission to view entries in the affected section.
The impact is limited by the requirement for admin access and allowAdminChanges=true.
Credited to je-lv.
References
- https://github.com/craftcms/cms/security/advisories/GHSA-957r-qf9p-67xw
- https://github.com/craftcms/cms/commit/7c96fd73df936a10e8f85ae6ef61a9fc3f277c12
- https://github.com/craftcms/cms/commit/87978f11c8f986c40ef41b941d79547230c4d6d9
- https://github.com/craftcms/cms/releases/tag/4.18.2
- https://github.com/craftcms/cms/releases/tag/5.10.6
- https://nvd.nist.gov/vuln/detail/CVE-2026-72779
- https://www.vulncheck.com/advisories/craft-cms-rc1-before-arbitrary-file-read-via-splfileobject
- https://github.com/advisories/GHSA-957r-qf9p-67xw
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Composer (PHP) vulnerabilities
All Composer (PHP) entriesGHSA-wg23-69c2-gjc8
Craft CMS: Passkey login accepts replayed WebAuthn assertions
critical9.1Aug 7, 2026CVE-2026-14793
Craft CMS: Missing authorization check allows non-admin control panel users to reorder Global Sets
medium4.3Aug 6, 2026CVE-2026-14794
Craft CMS: Missing authorization check allows non-admin control panel users access to user registration metrics
medium4.3Aug 6, 2026CVE-2026-72778
Craft CMS: Authenticated RCE via `condition.config` JSON cleanse bypass
high8.7Aug 6, 2026CVE-2026-72781
Craft CMS: Authenticated RCE through Twig sandbox escape
high8.7Aug 6, 2026CVE-2026-72782
Craft CMS: Authenticated leak of secret environment variables
medium5.1Aug 6, 2026
