Skip to main content

Craft CMS: Arbitrary file read via SplFileObject in non-sandboxed template contexts (CVE-2026-72779)

0
Medium
Published: 08/06/2026 (08/06/2026, 21:54:45 UTC)
Source: GCVE Database
Product: craftcms/cms

Description

Craft CMS versions 4.0.0-RC1 up to but not including 4.18.2, and 5.0.0-RC1 up to but not including 5.10.6, contain a vulnerability in the Twig `create()` function that allows an admin user to read arbitrary files on the server. This is possible because the `create()` function can instantiate PHP classes like SplFileObject, which is not blocked, enabling file reads from non-sandboxed template contexts such as entry type title and URI formats. Exploitation requires admin access and the configuration setting `allowAdminChanges` to be true, which is typically disabled in production. The vulnerability exposes sensitive files like `.env` containing security keys and database credentials. The Twig sandbox blocks this function in system email templates, limiting the attack surface. A patch is available for this vulnerability.

CVSS v4.0

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
High
User Interaction
None
Vuln. Confidentiality
High
Vuln. Integrity
None
Vuln. Availability
None
Subsq. Confidentiality
None
Subsq. Integrity
None
Subsq. Availability
None
CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

Affected software

Packagistghsa
craftcms/cms
Affected versions
>=5.0.0-RC1 <5.10.6
Packagistghsa
craftcms/cms
Affected versions
>=4.0.0-RC1 <4.18.2

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 09/13/2026, 15:02:52 UTC

Technical Analysis

The vulnerability in Craft CMS arises from the `create()` Twig function introduced in version 5.9.0, which allows instantiation of arbitrary PHP classes from template code but restricts only five classes via a blocklist. The class SplFileObject is not blocked, enabling an admin user to read arbitrary files by setting entry type title or URI formats to use `create('SplFileObject', ['/path/to/file'])`. This file read can expose sensitive server files such as `.env` containing security keys and database credentials. The vulnerability requires admin-level access and the `allowAdminChanges` setting to be true, which is the default in development and staging but recommended to be false in production. The Twig sandbox prevents exploitation in system email templates and other sandboxed contexts. The vulnerability affects Craft CMS versions >=4.0.0-RC1 <4.18.2 and >=5.0.0-RC1 <5.10.6. A patch is available.

Potential Impact

An attacker or malicious admin with control over the Craft CMS control panel and `allowAdminChanges=true` can read arbitrary files on the server filesystem by abusing the `create()` Twig function to instantiate SplFileObject. This can expose sensitive configuration files such as `.env` containing the CRAFT_SECURITY_KEY, database credentials, and API keys. The file contents are rendered as entry titles visible to users with permission to view entries, potentially leaking secrets to unauthorized users. The impact is limited by the requirement for admin access and the `allowAdminChanges` setting being enabled, which is not recommended in production environments.

Mitigation Recommendations

A patch is available for this vulnerability and should be applied to affected Craft CMS versions. Additionally, production environments should ensure that the `allowAdminChanges` setting is set to false, which prevents entry type configuration changes and mitigates this vulnerability. The Twig sandbox already blocks the `create()` function in system email templates, so no action is required for those contexts.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
GHSA-957r-qf9p-67xw
Osv Schema Version
1.4.0
Ecosystems
["Packagist"]
Database Specific Severity
MODERATE
Cvss Version
4.0

Threat ID: 6a7573b7bf8831d539d93f45

Added to database: 08/07/2026, 05:57:11 UTC

Last enriched: 09/13/2026, 15:02:52 UTC

Last updated: 09/22/2026, 14:15:34 UTC

Views: 51

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses