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-F5WM-88JV-G5HX

GHSA-F5WM-88JV-G5HX: Authenticated Remote Code Execution via Twig Sandbox Escape in Craft CMS

Alon Barad
Alon Barad
Software Engineer

Aug 7, 2026·6 min read·13 visits

Executive Summary (TL;DR)

Authenticated control panel users can escape the Twig template sandbox in Craft CMS by calling the inherited 'attachBehavior' method on allowed Element objects, leading to arbitrary PHP class instantiation and remote command execution on the server.

An authenticated remote code execution vulnerability exists in Craft CMS due to a flaw in how the Twig template sandbox policy handles class-level allowlists. Prior to the fix, the security policy allowed arbitrary public methods from parent classes of allowed interfaces, allowing authenticated attackers to invoke Yii component methods such as attachBehavior on element models to load arbitrary classes and execute system commands.

Vulnerability Overview

Craft CMS relies on the Twig template engine to render dynamic views and user-customizable content securely. To protect the underlying server, Craft CMS provides an optional Twig sandbox capability using the enableTwigSandbox() configuration. This sandbox restricts access to unsafe PHP classes, functions, properties, and methods, ensuring that template authors operate within a safe subset of APIs.

The vulnerability identified as GHSA-F5WM-88JV-G5HX represents a breakdown of this sandbox boundary. A flaw in the custom SecurityPolicy class allowed administrative users with template customization privileges to bypass class and method restrictions entirely. By executing arbitrary PHP logic within the template environment, an authenticated attacker can achieve remote code execution.

The core of the issue lies in how the application manages permissions for classes implementing the ElementInterface. Because Craft CMS trusted entire interfaces at a class level, any subclass inheriting from these interfaces was granted access to its entire object hierarchy. This exposed low-level framework capabilities from the underlying Yii Framework to the sandbox engine.

Root Cause Analysis

The sandbox implementation in Craft CMS utilizes the SecurityPolicy class to enforce access controls during template compilation and execution. When rendering a template, Twig queries the security policy's checkMethodAllowed($obj, $method) and checkPropertyAllowed($obj, $property) methods. These checks confirm whether the targeted object and its called method are explicitly allowed by configuration or decorator attributes.

Prior to the patch, the security policy evaluated object eligibility based on whether the class or one of its implemented interfaces carried the #[AllowedInSandbox] attribute. Once an interface was labeled with this attribute, the policy permitted access to any public method on any object implementing that interface. It failed to restrict method access strictly to those defined by the allowed interface itself.

The critical failure occurs with ElementInterface, which was annotated with #[AllowedInSandbox]. Every major content class in Craft CMS, such as Entry, User, Asset, and Category, implements this interface. Because these models inherit from the base Element class, they also inherit from yii\base\Component, a foundational class in the Yii Framework.

As a consequence of the class-level allowlisting model, the Twig sandbox permitted execution of all public methods belonging to yii\base\Component on any active Element instance. This exposed the dynamic attachBehavior($name, $behavior) method to the sandboxed environment. This specific method acts as a class-loading utility that instantiates arbitrary PHP classes when supplied with a configuration array.

Code Analysis

The vulnerability was patched by transitioning from a broad class-level trust model to a strict, granular method-level verification strategy. In the vulnerable implementation, the SecurityPolicy class relied on class-level checks that allowed any inherited method of an allowed object. The fix introduces a new contract, craft\web\twig\AllowableInSandbox, which requires classes to explicitly validate their own exposed methods.

The following diagram illustrates the vulnerable inheritance chain and how Yii's framework mechanisms were exposed through the sandbox:

The patch removed the #[AllowedInSandbox] attribute from ElementInterface and altered SecurityPolicy.php to delegate checks to the target object.

// Patched implementation in craft/web/twig/SecurityPolicy.php
public function checkMethodAllowed($obj, $method): void
{
    if ($obj instanceof AllowableInSandbox && $obj->methodAllowedInSandbox($method)) {
        return;
    }
    // ... original checks continue ...
}

The base Element class now implements AllowableInSandbox and enforces strict controls over which methods can run. By default, it returns false for arbitrary method calls, completely blocking inherited parent methods.

// Patched implementation in craft/base/Element.php
abstract class Element extends Component implements ElementInterface, AllowableInSandbox
{
    public function methodAllowedInSandbox(string $method): bool
    {
        // Disallow all methods by default unless explicitly permitted
        return false;
    }
 
    public function propertyAllowedInSandbox(string $property): bool
    {
        // Explicitly allow only safe dynamic properties like field handles
        if ($this->hasEagerLoadedElements($property) || $this->fieldByHandle($property) !== null) {
            return true;
        }
        return false;
    }
}

Exploitation Methodology

To exploit this vulnerability, an attacker must have administrative or editor access to the Craft CMS control panel with permissions to modify templates that are rendered in a sandboxed context. The target template must have access to a variable representing a Craft Element, such as an entry object, which is standard in many CMS configurations.

The attacker injects a malicious Twig payload designed to invoke the attachBehavior method on the exposed element. The method accepts a behavior configuration array. When the second argument is an array, Yii’s underlying dependency injection engine invokes Yii::createObject() to resolve and hydrate the class specified by the class key.

The attacker selects a behavior class that provides a callback hook capable of running system functions. A common target is yii\behaviors\AttributeTypecastBehavior. By structuring the behavior to map typecasting events to an executable system process class, such as Psy\Readline\Hoa\ConsoleProcessus, the attacker configures an execution path.

Once the behavior is attached, the attacker triggers the associated event callback within the template. When the template calls the trigger() method with the targeted event name, the application processes the behavior chain. This evaluates the payload and executes the arbitrary command string on the hosting operating system, running with the privileges of the web server user.

Impact Assessment

The impact of GHSA-F5WM-88JV-G5HX is critical, representing complete administrative takeover of the hosting server environment. Successful exploitation grants the attacker the ability to execute arbitrary operating system commands. This execution bypasses all application-layer security boundaries, data separation controls, and database user limitations.

With remote command execution capabilities, the attacker can access sensitive environment variables, read database credentials from configurations, and exfiltrate database contents. The attacker can also write malicious scripts to the web root, establishing persistent web shells for long-term access. This enables lateral movement within the hosting network or infrastructure.

Because the vulnerability requires authenticated access, the risk is slightly mitigated compared to unauthenticated RCE exploits. However, inside threats, compromised low-privileged administrator credentials, or cross-site scripting (XSS) attacks targeting administrators can still serve as vectors to trigger this exploit. The severity remains high due to the absolute compromise of system integrity.

Remediation and Mitigation

The primary remediation strategy is upgrading the Craft CMS installation to a patched version. The maintainers have released updates that address this vulnerability by implementing strict sandbox validation routines. Users on the 4.x branch must upgrade to version 4.18.3 or higher, while users on the 5.x branch must upgrade to version 5.10.7 or higher.

If an immediate upgrade is not feasible, administrators must implement mitigation steps to minimize the attack surface. Access to template editing capabilities within the control panel should be strictly revoked for all non-essential administrative accounts. This limits the exposure of sandboxed template rendering endpoints to highly trusted personnel only.

Additionally, web application firewalls can be configured to inspect control panel requests for known exploit patterns. Rules should block requests containing references to dynamic Yii behaviors or process execution paths. Specifically, payloads containing "class": "yii\\behaviors\\" or ConsoleProcessus should be flagged and rejected at the gateway level.

Official Patches

Craft CMSFix commit for Twig sandbox escape

Fix Analysis (1)

Technical Appendix

CVSS Score
8.7/ 10
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Affected Systems

Craft CMS installations running 4.x prior to 4.18.3Craft CMS installations running 5.x prior to 5.10.7

Affected Versions Detail

Product
Affected Versions
Fixed Version
Craft CMS
Craft CMS
>= 4.0.0-RC1, < 4.18.34.18.3
Craft CMS
Craft CMS
>= 5.0.0-RC1, < 5.10.75.10.7
AttributeDetail
CWE IDCWE-693
Attack VectorNetwork
CVSS v4.08.7 (High)
Privileges RequiredLow
Exploit StatusProof of Concept (PoC)
CISA KEV ListedNo

MITRE ATT&CK Mapping

T1562.001Impair Defenses: Disable or Modify Tools
Defense Evasion
T1059Command and Scripting Interpreter
Execution
CWE-693
Protection Mechanism Failure

The product does not use or incorrectly configures a protection mechanism, allowing attackers to bypass security controls.

Vulnerability Timeline

Vulnerability identified and GitHub Security Advisory GHSA-f5wm-88jv-g5hx published.
2026-08-06
Craft CMS releases versions 4.18.3 and 5.10.7 addressing the sandbox escape.
2026-08-06
Vulnerability details synchronized into public open source vulnerability databases.
2026-08-06

References & Sources

  • [1]GitHub Security Advisory GHSA-f5wm-88jv-g5hx
  • [2]Craft CMS Security Policy Patch Commit
  • [3]Craft CMS 4.18.3 Release Notes
  • [4]Craft CMS 5.10.7 Release Notes
  • [5]Craft CMS GitHub Repository
  • [6]OSV Entry for GHSA-F5WM-88JV-G5HX

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

•28 minutes ago•CVE-2026-105745
6.7

CVE-2026-105745: Arbitrary Code Execution via Malicious Entrypoint Discovery in Docling base_factory

Docling prior to version 2.131.0 is vulnerable to arbitrary local code execution during module initialization due to incorrect order of operations in its plugin discovery system. Even when the default option to reject external plugins is active, Docling utilizes Pluggy to scan and import entrypoints before performing namespace validation.

Amit Schendel
Amit Schendel
2 views•6 min read
•about 1 hour ago•CVE-2026-105749
6.5

CVE-2026-105749: Unbounded Table Attributes in Docling Backends Leads to Resource Exhaustion

An uncontrolled resource consumption vulnerability exists in the Docling document conversion library. Maliciously structured HTML, JATS, ODS, or BoxNote inputs containing table cells with excessively large 'rowspan' or 'colspan' attribute values trigger algorithmic complexity conditions. This allows unauthenticated remote attackers to initiate resource exhaustion states, crashing or hanging the target document processing pipeline while bypassing configured timeouts.

Amit Schendel
Amit Schendel
7 views•6 min read
•about 2 hours ago•CVE-2026-105748
4.3

CVE-2026-105748: Local File Inclusion and Arbitrary File Disclosure in Docling Document Parser

A Local File Inclusion (LFI) and Arbitrary File Disclosure vulnerability exists in Docling and Docling Slim versions >= 2.16.0 up to 2.131.0. When parsing serialized DoclingDocument structures using the JSON input format, the backend fails to restrict image URI schemes, allowing remote attackers to retrieve local files and verify path existence on the host system during embedded document export.

Amit Schendel
Amit Schendel
6 views•5 min read
•about 3 hours ago•CVE-2026-105744
7.5

CVE-2026-105744: Arbitrary File Read and Remote Code Execution in Docling Tectonic Engine

Docling, a tool for parsing and processing diverse document formats, is vulnerable to arbitrary file read, arbitrary file write, and potential remote code execution (RCE) in versions 2.94.0 through 2.131.0. The vulnerability occurs when applications configure Docling to use the Tectonic engine for rendering TikZ diagrams into images. Because the compilation did not restrict hazardous TeX primitives or sandbox the environment, an attacker can supply crafted documents containing malicious TikZ definitions to access or modify local files and execute arbitrary commands under the privileges of the processing application.

Amit Schendel
Amit Schendel
8 views•7 min read
•about 4 hours ago•CVE-2026-105743
4.0

CVE-2026-105743: Server-Side Request Forgery Guard Bypass in Docling Document Conversion Engine

An SSRF guard bypass vulnerability in the Docling document conversion engine allows unauthenticated attackers to bypass internal IP access controls. The vulnerability exists due to a DNS rebinding Time-of-Check Time-of-Use (TOCTOU) condition, URL authority parsing inconsistencies, and unvalidated network requests triggered during headless browser page rendering.

Amit Schendel
Amit Schendel
6 views•6 min read
•about 5 hours ago•CVE-2026-105742
3.7

CVE-2026-105742: Sensitive Custom Header Leakage in Docling Image Resource Loader

A technical analysis of CVE-2026-105742 (GHSA-p3fw-7699-7926), a sensitive information disclosure vulnerability in the Docling document processing library. Vulnerable versions of Docling indiscriminately forward custom HTTP headers, such as authentication tokens, to arbitrary third-party origins and during cross-origin redirects while fetching remote image assets from untrusted HTML and EPUB documents.

Alon Barad
Alon Barad
6 views•6 min read