Impact
Twig versions 2.16.x and 3.9.0 through 3.25.x contain a sandbox bypass that lets an attacker with the ability to render templates supply arbitrary PHP callables to the sort, filter, map, and reduce functions. The runtime check misuses the current template source, allowing sandbox restrictions to be circumvented when the sandbox is enabled via a SourcePolicyInterface rather than globally, resulting in arbitrary PHP code execution.
Affected Systems
The vulnerability affects the Twig PHP templating engine, specifically all releases from 2.16.x and 3.9.0 up to 3.25.x. Systems that run these versions and render templates with an enabled sandbox that relies on a SourcePolicyInterface are impacted.
Risk and Exploitability
The CVSS score of 8.7 classifies this as high severity. With the EPSS score unavailable and no listing in the CISA KEV catalog, the exploitation probability is uncertain but the high severity indicates a potentially costly attack. Likely attack vectors involve systems that accept user‑supplied templates or templates provided by untrusted sources, in contexts where a sandbox is configured with a SourcePolicyInterface. Successful exploitation would grant the attacker full remote code execution inside the web process.
OpenCVE Enrichment