CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-957R-QF9P-67XW

GHSA-957R-QF9P-67XW: Arbitrary File Read via SplFileObject in Craft CMS Twig Extension

Alon Barad
Alon Barad
Software Engineer

Aug 6, 2026·6 min read·16 visits

Executive Summary (TL;DR)

Craft CMS administrators with template capabilities can read sensitive server files (such as .env and system configurations) by abusing an omission in the dynamic class helper's blocklist to instantiate PHP's SplFileObject.

An information disclosure vulnerability in Craft CMS allows users with administrative or non-sandboxed template-authoring privileges to read arbitrary system and configuration files. The issue stems from an incomplete class instantiation blocklist in the Twig template extension, which omitted PHP's built-in SplFileObject class.

Vulnerability Overview

Craft CMS is a content management system built on PHP and the Twig template engine. To facilitate dynamic operations, the platform implements custom Twig extensions that expose utility helper functions directly inside template environments. One such helper is the create() function, designed to allow template authors to instantiate arbitrary utility classes within the Twig environment.

While this feature is intended to increase template flexibility, it introduces a significant attack surface by exposing direct object instantiation capabilities to template authors. To prevent abuse, such as remote command execution or file system manipulation, the helper relies on an explicit blocklist of forbidden classes. However, if a dangerous class is omitted from this blocklist, any user capable of writing or modifying non-sandboxed templates can instantiate that class and interact with its methods.

This specific vulnerability is classified under CWE-470 (Use of Externally-Controlled Input to Select Classes or Code, or 'Unsafe Reflection'). Because the class dynamic creation mechanism did not fully restrict access to file-handling classes, it allowed authenticated users with template-authoring permissions to read arbitrary local files, including confidential configuration keys, via standard PHP object manipulation interfaces.

Root Cause Analysis

The underlying vulnerability is located within the createFunction() method inside the custom Twig extension class (src/web/twig/Extension.php). This method accepts a class name identifier as a string and an optional array of parameters, which are then used to dynamically instantiate the specified object using reflection or standard PHP instantiation routines.

To restrict the instantiation of dangerous classes, the method utilizes a blocklist array containing classes known to pose security risks. The original implementation of this blocklist included Symfony\Component\Process\Process (to prevent command injection), GuzzleHttp\Psr7\FnStream (to prevent stream abuse), and SimpleXMLElement (to prevent XML External Entity injection). However, it failed to block SplFileObject, which is a built-in PHP class representing a local file stream.

Because SplFileObject implements PHP's SeekableIterator, RecursiveIterator, and IteratorAggregate interfaces, it behaves as an iterable collection of file lines. When an attacker passes SplFileObject as the target class to the create() helper, the PHP interpreter instantiates the object and opens a read stream to the file path provided in the parameters. This allows the template engine to bypass standard path restrictions and access files directly on the host system.

Code-Level Diff & Patch Analysis

The vulnerability was mitigated by adding SplFileObject directly to the class blocklist within src/web/twig/Extension.php across both the 4.x and 5.x maintenance branches. This prevents the dynamic instantiation helper from processing any request to create an instance of this file-handling class.

Below is the code-level change applied in the 5.x branch to restrict the instantiation of SplFileObject:

File: src/web/twig/Extension.php
@@ -73,6 +73,7 @@
 use IteratorAggregate;
 use Money\Money;
 use SimpleXMLElement;
+use SplFileObject;
 use Symfony\Component\Process\Process;
 use Throwable;
 use Traversable;
@@ -1552,6 +1553,7 @@ public function createFunction(string|array $type, array $params = []): object
             FnStream::class,
             Process::class,
             SimpleXMLElement::class,
+            SplFileObject::class,
         ];
 
         foreach ($blocklist as $c) {

While this change successfully blocks SplFileObject, a blocklist-based approach remains structurally fragile compared to an allowlist. Third-party packages loaded via Composer into the vendor/ directory could introduce other classes that permit arbitrary file reading, server-side request forgery (SSRF), or deserialization. A robust remediation strategy would deprecate arbitrary dynamic class instantiation in template contexts entirely, or enforce a strict, closed allowlist of permitted utility classes.

Exploitation Methodology

To exploit this vulnerability, an attacker must first obtain credentials for an account with permissions to author or edit Twig templates that are evaluated in a non-sandboxed context. This access is typically restricted to administrators or highly privileged content managers who configure system templates, custom fields, or entry-type rendering options within the Craft CMS Control Panel.

Once the template-authoring interface is accessible, the attacker can inject a payload that leverages the create() helper. By specifying the string 'SplFileObject' as the first argument and an array containing the path to a sensitive local file as the second argument, the attacker forces the server to open the target file. The attacker then uses a standard Twig iteration loop ({% for %}) to read each line sequentially and render it to the output page.

The following Twig code snippet demonstrates a functional proof-of-concept payload designed to extract the database configurations and system security keys contained in the local environment file:

{# Craft CMS SplFileObject Arbitrary File Read PoC #}
{% set file = create('SplFileObject', ['.env']) %}
{% for line in file %}
    {{ line }}
{% endfor %}

Impact & Threat Assessment

The concrete security impact of this vulnerability is significant, as it permits unauthorized access to the application's environment configuration file (.env). The .env file in Craft CMS contains the primary database credentials, third-party API integration keys, SMTP server credentials, and the global application security key (CRAFT_SECURITY_KEY).

Acquiring the CRAFT_SECURITY_KEY represents a high-severity threat. The application uses this key to sign cookies, generate secure tokens, and encrypt serialized data. If an attacker recovers this key, they can craft valid cryptographic signatures to perform object deserialization attacks or forge administrative sessions, potentially escalating the initial information disclosure vulnerability into a remote code execution vector.

Additionally, on host operating systems where PHP file permissions are weak, this vulnerability can be leveraged to read sensitive system configuration files outside the web directory. For example, on standard Linux installations, an attacker could read /etc/passwd to enumerate local system users and facilitate targeted privilege escalation attacks.

Defensive Strategies & Remediation

The primary remediation for this vulnerability is to upgrade Craft CMS to a patched release. Organizations running the 4.x release line must update to version 4.18.2 or later. Organizations running the 5.x release line must update to version 5.10.6 or later. These updates modify the createFunction() blocklist to prevent the instantiation of SplFileObject and other related file system stream classes.

If patching cannot be executed immediately, administrators should implement defensive configuration controls. Restricting the PHP execution environment using the open_basedir directive in php.ini can limit the directories that PHP's file system classes are permitted to open. This prevents SplFileObject from accessing files outside of designated application paths, even if the blocklist bypass is exploited.

Furthermore, administrative template-authoring capabilities should be strictly restricted to trusted staff members. Organizations should regularly review user permissions to ensure that only authorized developers are granted access to write or modify custom Twig templates, thereby reducing the exposure of non-sandboxed template evaluation interfaces.

Official Patches

CraftCMSCraft CMS 4.18.2 Release Tag containing the security patch
CraftCMSCraft CMS 5.10.6 Release Tag containing the security patch

Fix Analysis (2)

Technical Appendix

CVSS Score
4.9/ 10

Affected Systems

Craft CMS 4.xCraft CMS 5.x

Affected Versions Detail

Product
Affected Versions
Fixed Version
Craft CMS
CraftCMS
>= 4.0.0, < 4.18.24.18.2
Craft CMS
CraftCMS
>= 5.0.0, < 5.10.65.10.6
AttributeDetail
CWE IDCWE-470
Attack VectorNetwork / Authenticated Administrative User
Vulnerability ClassUnsafe Reflection
CVSS Score4.9
Exploit Statuspoc
KEV Statusnot listed

MITRE ATT&CK Mapping

T1059.006Command and Scripting Interpreter: Astro/Twig/etc. (Template Engines)
Execution
T1552Unsecured Credentials
Credential Access
T1083File and Directory Discovery
Discovery
CWE-470
Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')

The application uses externally-controlled input to select a class or code to instantiate, without sufficiently restricting which classes can be instantiated.

Known Exploits & Detection

GitHub Advisory DatabaseProof of concept using standard Twig iteration to leak the server .env file.

References & Sources

  • [1]GitHub Advisory: Craft CMS Arbitrary File Read
  • [2]Fix Commit (5.x Branch)
  • [3]Fix Commit (4.x Branch)

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•9 minutes ago•CVE-2026-114156
6.5

CVE-2026-114156: Path Equivalence Security Feature Bypass in Microsoft ASP.NET Core

CVE-2026-114156 is an improper resolution of path equivalence vulnerability (CWE-41) in Microsoft ASP.NET Core affecting .NET 11.0 preview releases and Microsoft Visual Studio 2026. The vulnerability stems from a discrepancy between how path prefix validation helpers (such as PathString.StartsWithSegments) and downstream routing mechanisms handle alternate path separators and percent-encoded characters. An unauthenticated remote attacker can exploit this mismatch over the network to bypass path-based authorization middleware and access restricted endpoints.

Amit Schendel
Amit Schendel
0 views•8 min read
•about 1 hour ago•CVE-2026-114157
7.5

CVE-2026-114157: Local Privilege Escalation via Race Condition in ASP.NET Core Kestrel Named Pipes Transport

CVE-2026-114157 is a high-severity local privilege escalation and security feature bypass vulnerability affecting ASP.NET Core on Microsoft Windows. The flaw resides in the Kestrel web server's Named Pipes transport layer (Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes) and stems from a race condition (CWE-362) during broken pipe error recovery. When an active connection throws an IOException during handshake acceptance, the connection listener previously disposed of the broken NamedPipeServerStream instance before acquiring a replacement stream from its internal pool. This sequence created a momentary window where zero server instances of the named pipe existed in the Windows Named Pipe File System (NPFS). A local, low-privileged attacker can exploit this timing window to create a named pipe with the identical name and a permissive Discretionary Access Control List (DACL), hijacking subsequent inter-process communications and escalating privileges across security boundaries.

Amit Schendel
Amit Schendel
4 views•11 min read
•about 2 hours ago•CVE-2026-124194
6.5

CVE-2026-124194: Forced Authentication and NetNTLMv2 Credential Leakage in Microsoft Office Outlook

CVE-2026-124194 is a forced authentication and spoofing vulnerability in Microsoft Office Outlook caused by a missing user interface warning before dereferencing remote network paths (CWE-356). By embedding an attacker-controlled Universal Naming Convention (UNC) path within MAPI message properties such as PidLidReminderFileParameter, an unauthenticated remote attacker can force a victim's system to initiate an outbound SMB or WebDAV connection upon opening or previewing a crafted message. This automatic authentication handshake leaks the user's NetNTLMv2 hash, enabling offline password cracking or real-time NTLM relay attacks. The vulnerability was exploited in the wild as a zero-day prior to its remediation in Microsoft's November 2026 Patch Tuesday updates and is listed in the CISA Known Exploited Vulnerabilities (KEV) catalog.

Alon Barad
Alon Barad
9 views•10 min read
•about 2 hours ago•CVE-2026-114154
7.5

CVE-2026-114154: Denial of Service in ASP.NET Core HttpSys Request Header Processing

CVE-2026-114154 is a high-severity Denial of Service (DoS) and uncontrolled resource consumption vulnerability in the Microsoft.AspNetCore.Server.HttpSys component of ASP.NET Core. When processing an HTTP request that simultaneously contains a chunked Transfer-Encoding header, a Content-Length header, and an explicit X-Content-Length header, the server throws an unhandled ArgumentException during header normalization. In certain versions, subsequent exception handling attempts to dereference a disposed native request context, aborting error response dispatch and leaking unmanaged HTTP.sys request structures.

Amit Schendel
Amit Schendel
4 views•9 min read
•about 3 hours ago•CVE-2026-120778
7.3

CVE-2026-120778: Local Elevation of Privilege via Insecure Temporary Directory Handling and MSBuild Response File Hijacking in Microsoft .NET Aspire CLI

A local elevation of privilege vulnerability exists in the Microsoft .NET Aspire CLI (`Aspire.Cli`) versions 13.5.4 prior to 13.6.5. When executing SDK management commands (`aspire sdk generate`, `aspire sdk dump`, and `aspire sdk export`), the CLI creates temporary project directories inside the shared operating system temporary folder (such as `/tmp` on Unix-like systems) without restricting directory permissions or disabling MSBuild automatic response file resolution. A local, low-privileged attacker on a multi-user system can place a crafted `Directory.Build.rsp` file in the shared temporary directory hierarchy. When a victim user executes an affected Aspire CLI command, MSBuild traverses upward, ingests the attacker-controlled response file, and executes arbitrary commands in the security context of the victim user.

Alon Barad
Alon Barad
4 views•10 min read
•about 4 hours ago•CVE-2026-120792
7.3

CVE-2026-120792: Local Information Disclosure via Temporary File Logging in Microsoft .NET Aspire CLI

CVE-2026-120792 is a high-severity local information disclosure vulnerability in the Microsoft .NET Aspire CLI (Aspire.Cli) affecting versions 13.5.4 prior to 13.6.5. The flaw stems from the insertion of sensitive information into a shared temporary log file (CWE-532) combined with insecure temporary file creation (CWE-377) within the DeprecatedMcpCommandScanner component. During agent configuration scanning, the CLI unconditionally appends internal workspace paths and the first 200 characters of Model Context Protocol (MCP) agent configuration files to a statically named file in the system temporary directory. On multi-user systems, unprivileged local users can read this file to harvest API keys, authentication tokens, and internal service endpoints.

Alon Barad
Alon Barad
4 views•9 min read