Craft has a Twig Function Blocklist Bypass
Description
Craft is a content management system (CMS). Prior to 5.9.0-beta.1 and 4.17.0-beta.1, Craft CMS implements a blocklist to prevent potentially dangerous PHP functions from being called via Twig non-Closure arrow functions. In order to be able to successfully execute this attack, you need to either have allowAdminChanges enabled on production, or a compromised admin account, or an account with access to the System Messages utility. Several PHP functions are not included in the blocklist, which could allow malicious actors with the required permissions to execute various types of payloads, including RCEs, arbitrary file reads, SSRFs, and SSTIs. This vulnerability is fixed in 5.9.0-beta.1 and 4.17.0-beta.1.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Craft CMS before 5.9.0-beta.1 and 4.17.0-beta.1 allows RCE, file reads, SSRF, and SSTI via a Twig non-Closure arrow function blocklist bypass.
Vulnerability
Craft CMS uses a blocklist to prevent dangerous PHP functions from being called through Twig non-Closure arrow functions. However, several PHP functions are missing from this blocklist, allowing a bypass of the intended restriction [1][4].
Exploitation
Successful exploitation requires either allowAdminChanges enabled on production, a compromised admin account, or an account with access to the System Messages utility. The attacker can then call arbitrary PHP functions excluded from the blocklist via Twig arrow functions [1][2].
Impact
This vulnerability can lead to remote code execution (RCE), arbitrary file reads, server-side request forgery (SSRF), and server-side template injection (SSTI), giving an attacker significant control over the server and its data [4].
Mitigation
The issue is fixed in Craft CMS 5.9.0-beta.1 and 4.17.0-beta.1. The fix removes the blocklist and disables all non-Closure arrow functions by default via the enableTwigSandbox config setting. Existing projects must update to a patched version and enable the config setting to fully mitigate the risk [4].
AI Insight generated on May 18, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
craftcms/cmsPackagist | >= 5.0.0-RC1, < 5.9.0-beta.1 | 5.9.0-beta.1 |
craftcms/cmsPackagist | >= 4.0.0-RC1, < 4.17.0-beta.1 | 4.17.0-beta.1 |
Affected products
2Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
5- github.com/advisories/GHSA-5fvc-7894-ghp4ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2026-28783ghsaADVISORY
- github.com/craftcms/cms/pull/18208ghsax_refsource_MISCWEB
- github.com/craftcms/cms/security/advisories/GHSA-5fvc-7894-ghp4ghsax_refsource_CONFIRMWEB
- github.com/twigphp/Twig/blob/946ddeafa3c9f4ce279d1f34051af041db0e16f2/src/Extension/CoreExtension.phpghsaWEB
News mentions
0No linked articles in our index yet.