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

CVE-2026-112770: Craft CMS Twig Filter RCE Vulnerability

CVE-2026-112770 is a remote code execution flaw in Craft CMS that allows authenticated control panel users to write webshells via Twig filter exploitation. This post explains its impact, affected versions, and mitigation steps.

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-112770 Overview

CVE-2026-112770 is an authenticated remote code execution vulnerability in Craft CMS affecting versions 4.x before 4.18.8 and 5.x before 5.11.0. The flaw resides in the Twig group filter, which fails to apply the checkArrow guard used by other arrow-accepting filters. Authenticated control panel users can supply an array-callable such as FileHelper::writeToFile through element-select condition rules. This allows attackers to write a webshell to the webroot and execute arbitrary code as the web server user. The vulnerability is classified under CWE-94: Improper Control of Generation of Code.

Critical Impact

Authenticated attackers with control panel access can achieve remote code execution on the underlying web server, leading to full application compromise.

Affected Products

  • Craft CMS 4.x versions prior to 4.18.8
  • Craft CMS 5.x versions prior to 5.11.0
  • Deployments exposing the Craft CMS control panel to authenticated users

Discovery Timeline

  • 2026-10-19 - CVE-2026-112770 published to NVD
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-112770

Vulnerability Analysis

The vulnerability stems from inconsistent input validation across Twig filters within Craft CMS. The group filter accepts an arrow argument that is intended to be a string or closure for grouping template data. Unlike sibling filters such as map, filter, and reduce, the group filter omits the checkArrow guard. This guard normally rejects non-string, non-closure arguments and prevents arbitrary PHP callables from being invoked. Without the guard, attackers can submit array-callables of the form [ClassName, methodName], which PHP will resolve and invoke directly.

An authenticated user with access to element-select condition rules can craft Twig expressions that pass array-callables such as ["craft\\helpers\\FileHelper", "writeToFile"]. Supplying attacker-controlled arguments to this callable writes PHP content to a file inside the webroot. Requesting that file then executes attacker code under the web server account.

Root Cause

The root cause is a missing callable-validation check in the Twig group filter implementation. Other arrow-accepting filters invoke checkArrow, which rejects non-closure callables. The group filter bypasses this safeguard and treats any callable-shaped value as valid, enabling [CWE-94] code injection through template evaluation.

Attack Vector

Exploitation requires authenticated access to the Craft CMS control panel and permission to configure element-select condition rules. The attacker constructs a condition rule that evaluates a Twig expression invoking the group filter with an array-callable targeting FileHelper::writeToFile. The payload writes a PHP webshell to a web-accessible path. The webshell is then requested directly over HTTP to achieve code execution. Refer to the Craft CMS GitHub Security Advisory and VulnCheck advisory for additional technical context.

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-112770

Indicators of Compromise

  • New or modified PHP files in the Craft CMS web/ directory with recent timestamps that do not match deployment artifacts
  • Control panel audit log entries showing creation or modification of element-select condition rules containing Twig group filter expressions
  • Outbound connections from the web server process immediately following condition rule changes
  • Web server access logs containing requests to unfamiliar .php files under the webroot

Detection Strategies

  • Inspect template and condition rule payloads for references to FileHelper, writeToFile, or other array-callable patterns submitted to the group filter
  • Review authentication logs for control panel sessions that preceded unexpected filesystem changes in web-accessible directories
  • Correlate PHP process executions spawning shell utilities such as /bin/sh, bash, or python through endpoint telemetry

Monitoring Recommendations

  • Enable file integrity monitoring on the Craft CMS web/ directory and alert on any new .php files outside deployment windows
  • Forward Craft CMS audit logs and web server access logs to a centralized SIEM for correlation and anomaly detection
  • Monitor for Twig expression strings in request bodies to control panel endpoints that reference PHP class and method names

How to Mitigate CVE-2026-112770

Immediate Actions Required

  • Upgrade Craft CMS 4.x installations to version 4.18.8 or later
  • Upgrade Craft CMS 5.x installations to version 5.11.0 or later
  • Audit control panel user accounts and revoke unnecessary privileges, especially permissions to configure element-select condition rules
  • Review the Craft CMS webroot for unauthorized PHP files and remove any identified webshells

Patch Information

Craft CMS resolved the vulnerability in versions 4.18.8 and 5.11.0 by applying the checkArrow guard to the Twig group filter. The fix rejects non-closure callable arguments, preventing array-callable invocation. Full patch details are available in the Craft CMS GitHub Security Advisory GHSA-xmwr-88vw-5ghh.

Workarounds

  • Restrict control panel access to trusted administrators until the patch is applied
  • Enforce strong authentication, including multi-factor authentication, on all control panel accounts
  • Remove or restrict permissions that allow non-administrative users to create or edit element-select condition rules
  • Deploy a web application firewall rule to block requests containing suspicious Twig expressions referencing FileHelper or array-callable syntax

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.