The vulnerability exists in three deprecated wrapper functions (twig_array_some, twig_array_every, and twig_check_arrow_in_sandbox) located in src/Resources/core.php. These functions were not updated correctly following a signature change in the underlying CoreExtension methods they call. Specifically, they fail to pass a boolean $isSandboxed flag that indicates whether the current execution context is sandboxed.
For twig_array_some and twig_array_every, the absence of this flag causes the called methods (CoreExtension::arraySome and CoreExtension::arrayEvery) to default to a non-sandboxed mode ($isSandboxed = false). This bypasses a critical security check that restricts callables to Closure objects when in sandbox mode, thereby allowing string representations of any PHP function to be called. An attacker could leverage this to execute arbitrary code.
For twig_check_arrow_in_sandbox, the function passes an entire Environment object instead of the expected boolean, leading to a TypeError and a failure of the intended security check. The analysis of the patch commit e235cae3a1d1e23edc24df4d675f18108c6b167b confirms these changes, where the vulnerable calls are replaced with versions that correctly resolve and forward the sandbox state using twig_resolve_is_sandboxed(\$env).