CVE-2026-72781 Craft CMS 5.0.0-RC1 before 5.10.7 Remote Code Execution via Twig Sandbox Escape

High 8.7 Published Updated

Authenticated attackers can execute arbitrary code via Twig sandbox escape in Craft CMS, requiring an upgrade to patched versions.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-72781?

CVE-2026-72781 is a high-severity code injection vulnerability in craftcms cms, published on 11 Aug 2026. Any signed-in user can exploit it over the network, with no action from the victim.

Official description

Craft CMS versions >= 5.0.0-RC1 before 5.10.7 and >= 4.0.0-RC1 before 4.18.3 contain a remote code execution vulnerability in the Twig sandbox mechanism. Because Craft marks the ElementInterface as safe (via the AllowedInSandbox attribute) and the sandbox allowlisting extends to the entire class hierarchy (craft\base\Component up to yii\base\Component), an authenticated attacker with permission to access the control panel can render a malicious Twig template that abuses the yii\base\Component arbitrary function-call gadget to execute arbitrary code, even when the Twig sandbox is enabled via enableTwigSandbox().

Weakness: CWE-693

Which versions are affected by CVE-2026-72781?

4 open source packages ship an affected version, including craftcms/cms.

PackageAffectedFixed in
craftcms/cms PackagistFrom 4.0.0-RC14.18.3
craftcms/cms PackagistFrom 4.0.0-RC14.18.3
craftcms/cms PackagistFrom 5.0.0-RC15.10.7
craftcms/cms PackagistFrom 5.0.0-RC15.10.7

How do I fix CVE-2026-72781?

Upgrade craftcms/cms to a fixed version for your release line: 4.18.3 or 5.10.7.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2026-72781 being exploited?

There is no known exploitation of CVE-2026-72781 in the wild and no public exploit code.

Public exploit code: 1 proofs of concept on GitHub.

Sources

Also known as GHSA-f5wm-88jv-g5hx.

Is CVE-2026-72781 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free