Craft CMS Twig Sandbox Remote Code Execution
CVE-2026-72781 is an authenticated remote code execution vulnerability in the Craft CMS Twig sandbox. A sandbox allowlisting design flaw marks ElementInterface as safe and applies that trust to its inherited class hierarchy, reaching yii\base\Component. An authenticated control-panel user can render a malicious Twig template that invokes the yii\base\Component arbitrary function-call gadget, bypassing the intended Twig sandbox restrictions. Affected releases are Craft CMS 5.0.0-RC1 through versions before 5.10.7, and 4.0.0-RC1 through versions before 4.18.3.
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
What an attacker gets, and what they’ve been doing with it.
Successful exploitation allows a low-privileged authenticated user with Craft CMS control-panel access to execute arbitrary code in the context of the Craft CMS application. This can compromise the confidentiality, integrity, and availability of the affected deployment.
If you can’t patch tonight, do this now.
If immediate patching is not possible, restrict access to the Craft CMS control panel to only fully trusted users, minimize or disable any workflows that allow untrusted authenticated users to render or submit Twig templates, and reduce exposure of template-rendering functionality until the fixed versions can be deployed. Because exploitation is possible even with the Twig sandbox enabled, reliance on enableTwigSandbox() alone is not a sufficient mitigation.
Patch, then assume compromise.
Upgrade Craft CMS 5.x installations to version 5.10.7 or later, and Craft CMS 4.x installations to version 4.18.3 or later.
1 exploit validated by Mallory's analysis.
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
2 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.