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·20 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

•30 minutes ago•GHSA-9J25-MM2H-2F76
9.9

CVE-2026-48750: Arbitrary File Write on Host via exec-output Symlink in Canonical LXD and Incus

Canonical LXD and LXC Incus contain an arbitrary file write vulnerability (CWE-73 / CWE-59) in the `/1.0/instances/<name>/exec` REST API endpoint. When an instance is unpacked from an image archive, top-level symbolic links are extracted directly onto the host filesystem within the instance storage directory. If a crafted image includes a symbolic link named `exec-output` pointing to an arbitrary host path, invoking the execution endpoint with `record-output: true` causes the privileged host daemon to follow the symlink and write command output files directly to the target host directory. An authenticated attacker with permissions to import images and execute commands can exploit this flaw to write controlled content to sensitive host directories such as `/etc/cron.d`, resulting in arbitrary code execution on the host as `root`.

Alon Barad
Alon Barad
2 views•12 min read
•about 1 hour ago•GHSA-VGHH-5RFX-XHQ8
9.9

CVE-2026-48749: Arbitrary Host File Read and Write via Malicious Image Symlink in Canonical LXD and Incus

CVE-2026-48749 (tracked as GHSA-vghh-5rfx-xhq8 for LXD and GHSA-2q3f-q5pq-g8wv for Incus) is a critical container escape vulnerability in the Canonical LXD and Linux Containers Incus system container managers. By importing a specially crafted container image archive containing duplicate tar member headers, an authenticated attacker can replace the instance rootfs directory with a symbolic link pointing to the underlying host root filesystem. When performing file operations on a stopped container, the privileged forkfile helper binary resolves the symbolic link without confinement and chroots directly into the host filesystem, granting arbitrary root-level file read and write access.

Amit Schendel
Amit Schendel
3 views•9 min read
•about 3 hours ago•GHSA-FMC8-P6Q7-75CC
9.9

GHSA-fmc8-p6q7-75cc: Argument Injection in Canonical LXD Backup Compression Leads to Host Root Code Execution

GHSA-fmc8-p6q7-75cc (associated with CVE-2026-48755) is a critical argument injection vulnerability in Canonical LXD (github.com/canonical/lxd). The vulnerability occurs during instance and storage volume backup operations when processing the user-supplied compression_algorithm configuration parameter. While LXD validates the primary executable token against an allowlist of supported compression binaries, it fails to sanitize or restrict subsequent tokens parsed via shellquote.Split. These additional arguments are passed directly to exec.Command. An authenticated attacker with privileges to trigger backups can inject command-line flags for utilities like zstd to read staged files from a container filesystem and write them to arbitrary paths on the underlying host filesystem, such as /etc/cron.d/, achieving root-level arbitrary code execution on the host.

Amit Schendel
Amit Schendel
6 views•10 min read
•about 3 hours ago•GHSA-PJFF-C2WC-F6JM
9.9

CVE-2026-48769: Arbitrary File Write and Remote Code Execution via Trusted Image Hash in Canonical LXD and Linux Containers Incus

A critical path traversal vulnerability caused by improper input validation (CWE-20) exists in the direct image download handler of Canonical LXD and Linux Containers Incus. When an authenticated user requests an image import using the URL source type, the daemon reads the image fingerprint from an untrusted HTTP response header (`Incus-Image-Hash` or `LXD-Image-Hash`) without validating that it conforms to a SHA-256 format. This unvalidated string is concatenated directly into a filesystem path via `filepath.Join` prior to file creation and cryptographic verification, allowing directory traversal sequences to write arbitrary files on the host filesystem as root.

Alon Barad
Alon Barad
7 views•10 min read
•about 7 hours ago•CVE-2026-9639
6.5

CVE-2026-9639: Authenticated Denial of Service via Nil-Pointer Dereference in Canonical LXD Custom Volume Backup Import

CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.

Amit Schendel
Amit Schendel
7 views•9 min read
•about 9 hours ago•CVE-2026-33050
8.8

CVE-2026-33050: OS Command Injection in GeoNode Vector Upload Handler

An operating system command injection vulnerability (CWE-78) exists in GeoNode versions prior to 5.1.0. The vulnerability occurs in the vector upload processing pipeline when handling user-supplied geospatial files. By supplying a crafted layer name containing shell metacharacters, an authenticated attacker with basic data upload privileges can execute arbitrary commands on the underlying server or container hosting the GeoNode application and Celery worker processes.

Alon Barad
Alon Barad
6 views•9 min read