The vulnerability is a Server-Side Template Injection (SSTI) in Craft CMS, allowing an authenticated attacker to achieve Remote Code Execution. The root cause was the insecure configuration of the Twig template engine, which did not enable sandboxing.
An attacker could exploit this by supplying a malicious payload to any feature that renders Twig templates, such as the System Messages utility. The payload would use a Twig filter like map and pass a string representing a dangerous PHP function (e.g., 'system') as an 'arrow function'. Without sandboxing, Twig would execute this string as a function.
The developers had attempted a partial fix via a checkArrowFunction method, which used a denylist to block known dangerous functions. However, this approach was insufficient and could be bypassed.
The patch addresses the vulnerability by introducing a enableTwigSandbox setting. When enabled, the craft\web\View::createTwig method configures the Twig environment with the SandboxExtension. This extension, even with a permissive policy, inherently prevents non-Closure values (like strings) from being executed as functions, effectively closing the RCE vector. The flawed checkArrowFunction was consequently removed.
The identified vulnerable functions are therefore the checkArrowFunction itself, the various Twig filter implementations (mapFilter, filterFilter, etc.) that used it, and the createTwig method that set up the insecure environment.