Craft CMS: Arbitrary file read via SplFileObject in non-sandboxed template contexts
Published 6 Aug 2026 · Updated 1 Sept 2026
Affected packages
- Affected
- >=5.0.0-RC1 <5.10.6
- Fixed in
- 5.10.6
composer require craftcms/cms:^5.10.6- Affected
- >=4.0.0-RC1 <4.18.2
- Fixed in
- 4.18.2
composer require craftcms/cms:^4.18.2Details
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.
Is GHSA-957r-qf9p-67xw in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected craftcms/cms, and gives you the command that fixes it.
References
- Linkgithub.com/craftcms/cms/security/advisories/GHSA-957r-qf9p-67xw
- Advisorynvd.nist.gov/vuln/detail/CVE-2026-72779
- Linkgithub.com/craftcms/cms/commit/7c96fd73df936a10e8f85ae6ef61a9fc3f277c12
- Linkgithub.com/craftcms/cms/commit/87978f11c8f986c40ef41b941d79547230c4d6d9
- Packagegithub.com/craftcms/cms
- Linkgithub.com/craftcms/cms/releases/tag/4.18.2
- Linkgithub.com/craftcms/cms/releases/tag/5.10.6
- Linkwww.vulncheck.com/advisories/craft-cms-rc1-before-arbitrary-file-read-via-splfileobject
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.