# CVE-2026-72781: Craft CMS remote code execution via Twig sandbox escape

Source: https://junglewise.ai/threats/cve-2026-72781-craft-cms-remote-code-execution-via-twig-sandbox-escape  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-11. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2026-72781 · Severity: high · CVSS 8.8 · Published 2026-08-11

Craft CMS is a web content management system that allows administrators to design and manage site content using templating logic. In affected versions, authenticated users with control panel access can exploit a flaw in the Twig template sandbox feature to execute arbitrary code on the server, bypassing the sandbox protections designed to prevent such attacks. This could allow a compromised or malicious admin to take full control of the web server and underlying infrastructure.

Technologies: [craftcms/cms (Packagist)](https://junglewise.ai/threats/technologies/craftcms-cms). Vendors: [Packagist](https://junglewise.ai/threats/vendors/packagist).

## Quick answers

**Is CVE-2026-72781 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-72781 being exploited in the wild.

**How severe is CVE-2026-72781?** High severity, with a CVSS score of 8.8, published 11 August 2026.

**Which products and versions are affected?** craftcms/cms (Packagist) ECOSYSTEM:introduced=5.0.0-RC1,fixed=5.10.7.

**Is there a fix for CVE-2026-72781?** Yes. craftcms/cms (Packagist): upgrade to 5.10.7 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-72781 attacked?** It is attacked over the network.

**Am I affected by CVE-2026-72781?** Check whether you run craftcms/cms (Packagist) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- craftcms/cms (Packagist): upgrade to 5.10.7 or later

  ```sh
  composer require craftcms/cms:^5.10.7
  ```


## Technical details

The vulnerability is a sandbox escape in Craft CMS's Twig security policy implementation. The SecurityPolicy class marks the ElementInterface as safe via the AllowedInSandbox attribute, but the allowlist mechanism incorrectly extends to the entire class hierarchy, including yii\base\Component from the underlying Yii framework. This component contains a known arbitrary function-call gadget that has been exploited in previous Craft CMS RCE vulnerabilities (GHSA-255j-qw47-wjh5, GHSA-2fph-6v5w-89hh, GHSA-7jx7-3846-m7w7, GHSA-qrgm-p9w5-rrfw). An authenticated attacker with control panel access can craft a malicious Twig template that uses this gadget to achieve RCE, even when the Twig sandbox is explicitly enabled via enableTwigSandbox(). The fix involves restricting the allowlist to prevent access to dangerous base class methods and properties. Patches are available in versions 5.10.7 and 4.18.3.

## Affected products

- Craft CMS >= 5.0.0-RC1 before 5.10.7; >= 4.0.0-RC1 before 4.18.3

## Identifiers

- CVE-2026-72781
- GHSA-f5wm-88jv-g5hx

## Timeline

- 2026-07-25: disclosed: GitHub Security Advisory GHSA-f5wm-88jv-g5hx published
- 2026-08-11: advisory: NVD entry published
- 2026-08-11: patched: Patches available: CMS 5.10.7 and 4.18.3

## References

- [https://github.com/craftcms/cms/security/advisories/GHSA-f5wm-88jv-g5hx](https://github.com/craftcms/cms/security/advisories/GHSA-f5wm-88jv-g5hx)
- [https://www.vulncheck.com/advisories/craft-cms-rc1-before-remote-code-execution-via-twig-sandbox-escape](https://www.vulncheck.com/advisories/craft-cms-rc1-before-remote-code-execution-via-twig-sandbox-escape)

## Related threats

- [Craft CMS: Stored XSS in the control panel via unescaped draft name](https://junglewise.ai/threats/cve-2026-72787-craft-cms-stored-xss-in-the-control-panel-via-unescaped-draft)
- [Craft CMS: Arbitrary user password reset leading to administrator account takeover](https://junglewise.ai/threats/cve-2026-72786-craft-cms-arbitrary-user-password-reset-leading-to-administrator)
- [Craft CMS authorization bypass in category structure modification](https://junglewise.ai/threats/craft-cms-authorization-bypass-in-category-structure-modification-1555f980)
- [Craft CMS authenticated RCE through Twig sandbox escape](https://junglewise.ai/threats/craft-cms-authenticated-rce-through-twig-sandbox-escape-32ee5ec1)
- [Craft CMS path traversal in ensurePathIsContained](https://junglewise.ai/threats/craft-cms-path-traversal-in-ensurepathiscontained-4adc3058)
