Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

Craft CMS: Arbitrary file read via SplFileObject in non-sandboxed template contexts

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

Description

Craft CMS versions from 5.9.0 introduced a vulnerability where the Twig `create()` function allows instantiation of arbitrary PHP classes from template code, with only a limited blocklist. The class `SplFileObject` is not blocked, enabling an admin user to read arbitrary files on the server by configuring entry type title or URI formats in non-sandboxed template contexts. This can expose sensitive files such as `.env` containing security keys and database credentials. Exploitation requires admin access and the configuration setting `allowAdminChanges` to be true, which is typically disabled in production. The vulnerability does not affect sandboxed contexts like system email templates. The severity is rated medium due to the required privileges and configuration.

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: 08/07/2026, 07:16:43 UTC

Technical Analysis

The vulnerability arises from the `create()` Twig function introduced in Craft CMS 5.9.0, which allows instantiation of arbitrary PHP classes from template code but restricts only five classes via a blocklist. Since `SplFileObject` is not blocked, an admin user can instantiate it with a file path argument to read arbitrary files on the server. This is exploitable in non-sandboxed template contexts such as entry type title and URI formats, where the file contents are rendered as entry titles visible to users with entry view permissions. The vulnerability requires admin-level access and `allowAdminChanges=true`, which is usually disabled in production environments. The Twig sandbox blocks this function in system email templates, limiting the scope of exploitation. The impact includes exposure of sensitive files like `.env` containing security keys and database credentials.

Potential Impact

An attacker or admin with control over entry type settings can read arbitrary files on the server filesystem, including sensitive configuration files such as `.env` that contain security keys, database credentials, and API keys. The file contents are exposed as entry titles visible to users with permission to view entries in the affected section. The impact is limited by the need 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. It is recommended to apply the official fix provided by the vendor. Additionally, ensure that the `allowAdminChanges` configuration setting is set to false in production environments to prevent unauthorized entry type configuration changes. The Twig sandbox already blocks the `create()` function in system email templates, so no action is required for sandboxed 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
Aliases
[]
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: 08/07/2026, 07:16:43 UTC

Last updated: 08/08/2026, 01:06:14 UTC

Views: 3

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