Skip to main content
Vulnerability Database/CVE-2026-112772

CVE-2026-112772: Craft CMS Twig Sandbox RCE Vulnerability

CVE-2026-112772 is a remote code execution vulnerability in Craft CMS that allows authenticated Control Panel users to escape the Twig sandbox and execute arbitrary code. This article covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-112772 Overview

Craft CMS versions 5.0.0 through 5.10.x contain a remote code execution vulnerability that allows authenticated Control Panel users to escape the Twig sandbox. The flaw resides in Asset::getMimeType transforms, where as or on keys are passed unfiltered to Craft::createObject. Attackers can attach malicious behaviors or event handlers that execute arbitrary code as the web server user. The vulnerability is categorized under [CWE-94] Improper Control of Generation of Code (Code Injection) and was published to the National Vulnerability Database (NVD) on October 19, 2026.

Critical Impact

Authenticated Control Panel users can achieve remote code execution on the underlying web server, compromising confidentiality, integrity, and availability of the Craft CMS installation.

Affected Products

  • Craft CMS 5.0.0 through 5.10.x
  • Craft CMS Control Panel component
  • Twig templating sandbox in affected Craft CMS releases

Discovery Timeline

  • 2026-10-19 - CVE-2026-112772 published to NVD
  • 2026-10-20 - Last updated in NVD database

Technical Details for CVE-2026-112772

Vulnerability Analysis

The vulnerability stems from unsafe handling of transform parameters in the Asset::getMimeType method within Craft CMS. Twig templates in Craft CMS execute inside a sandbox designed to restrict dangerous operations against the underlying PHP runtime. Transform definitions accept arbitrary configuration arrays and forward them into Craft::createObject, the Yii framework factory used to instantiate configured components.

When a template author supplies the as key, Yii attaches a behavior class to the created object. When the on key is supplied, Yii binds an event handler. Both constructs allow user-controlled class names and callables to execute during object initialization, which bypasses the Twig sandbox entirely and runs native PHP code as the web user.

Authentication to the Control Panel is required to reach the vulnerable sink, but the flaw does not require administrator privileges. Any user who can edit templates, assets, or render contexts that feed into getMimeType transforms can trigger code execution.

Root Cause

The root cause is missing input filtering for reserved Yii configuration keys. Craft::createObject honors as and on keys as object configuration directives, but the asset transform pipeline did not strip or reject these keys before passing user-controlled arrays to the factory. The sandbox boundary assumed transform parameters were data, not executable configuration.

Attack Vector

The attack vector is network-based through the authenticated Control Panel. An attacker with low-privileged Control Panel access crafts a transform payload containing an as or on key that references a malicious behavior class or callable event handler. When the transform is applied through Asset::getMimeType, Yii instantiates the behavior and executes the attacker-controlled code in the web server process.

See the GitHub Security Advisory and the Vulncheck Advisory on RCE for additional technical details.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2026-112772

Indicators of Compromise

  • Unexpected PHP processes spawned by the web server user originating from Craft CMS request handlers
  • Asset transform definitions or template fragments containing as or on configuration keys referencing unfamiliar class names
  • New or modified files under writable Craft CMS directories such as storage/, web/cpresources/, or template directories outside normal deployment pipelines
  • Outbound network connections from the web server to attacker-controlled hosts following Control Panel activity

Detection Strategies

  • Review Craft CMS access logs for Control Panel requests that invoke asset transforms with unusual query parameters or payload sizes
  • Audit stored transform configurations, template files, and database-backed render contexts for the strings "as": or "on": within asset or image parameters
  • Correlate Control Panel authentication events with subsequent process creation on the web server using endpoint telemetry
  • Flag any invocation of Craft::createObject receiving configuration arrays sourced from user-editable fields

Monitoring Recommendations

  • Enable PHP process auditing and ship logs to a centralized analytics platform for behavioral review
  • Monitor file integrity on Craft CMS webroot, templates, and the vendor/ directory for unauthorized modifications
  • Alert on new child processes of the PHP-FPM or web server worker where the parent is a Craft CMS request
  • Track Control Panel user activity for privilege or role changes that would expand access to transform-editing surfaces

How to Mitigate CVE-2026-112772

Immediate Actions Required

  • Upgrade Craft CMS to version 5.11.0 or later, which filters as and on keys before they reach Craft::createObject
  • Audit all Control Panel user accounts and revoke access for stale, shared, or over-privileged users
  • Rotate credentials, API keys, and session secrets stored in the Craft CMS installation if compromise is suspected
  • Review template and transform content created or modified before patching for malicious configuration keys

Patch Information

Craft CMS 5.11.0 contains the fix. The patched release sanitizes transform configuration arrays and rejects reserved Yii keys that would attach behaviors or event handlers through Craft::createObject. Refer to the GitHub Security Advisory for upgrade notes and backport guidance.

Workarounds

  • Restrict Control Panel access to a minimal set of trusted administrators until the upgrade is complete
  • Place the Craft CMS Control Panel behind network controls such as VPN or IP allowlists to reduce exposure
  • Remove template-editing permissions from non-administrative roles that do not require them
  • Deploy a web application firewall rule that inspects Control Panel request bodies for as or on keys inside asset transform parameters

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.