The vulnerability existed in Craft CMS's handling of Twig's non-Closure arrow functions. To prevent code execution, Craft CMS implemented a custom function, checkArrowFunction, which maintained a blocklist of dangerous PHP functions (e.g., system, exec). However, this blocklist was incomplete, allowing an attacker with admin or template-editing permissions to call other dangerous, unlisted PHP functions (like phpinfo, var_dump, or other functions that could lead to file disclosure or SSRF) through various Twig filters such as map, filter, and sort.
The patch addresses this vulnerability at its root. Instead of relying on an imperfect blocklist, the fix removes the checkArrowFunction entirely. It introduces a new configuration setting, enableTwigSandbox, which, when enabled, activates Twig's Sandbox extension. A key side effect of enabling the sandbox, even with a permissive policy, is that it disables the use of string-based function names in arrow functions, which was the vector for the attack. This effectively forces developers to use safe, anonymous (Closure) functions, mitigating the risk of arbitrary code execution. The vulnerable functions are the various Twig filters in craft\web\twig\Extension that previously relied on the faulty checkArrowFunction for security.