GHSA-957r-qf9p-67xw
GHSA-957r-qf9p-67xw is a security vulnerability in craftcms/cms. O3 Security confirms whether GHSA-957r-qf9p-67xw is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
Craft CMS: Arbitrary file read via SplFileObject in non-sandboxed template contexts
Blast Radius
craftcms/cms🐘craftcms/cmsReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
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.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | craftcms/cms | ≥ 5.0.0-RC1&&< 5.10.6 | 5.10.6 |
| 🐘Packagist | craftcms/cms | ≥ 4.0.0-RC1&&< 4.18.2 | 4.18.2 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for craftcms/cms. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update craftcms/cms to 5.10.6 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-957r-qf9p-67xw is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-957r-qf9p-67xw is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-957r-qf9p-67xw. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-957r-qf9p-67xw in your dependencies?
O3 detects GHSA-957r-qf9p-67xw across Packagist dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.