Twig versions 2.16.x and 3.9.0 through 3.25.x contain a sandbox bypass vulnerability when using a SourcePolicyInterface that allows attackers with template rendering capabilities to pass arbitrary PHP callables to sort, filter, map, and reduce filters. Attackers can exploit the runtime check that fails to use the current template source to bypass sandbox restrictions and execute arbitrary code when the sandbox is enabled through a source policy rather than globally.
Fix
Patch, vendor advisory and mitigation references on NVD 1
Every line above is quoted from NVD, CISA, Microsoft, the vendor's own advisory or DISA; nothing is generated.
Change history 1
- First seenCVSS 8.7 · symfonyNVD modified 2026-10-08 16:17
Affected (CPE criteria) 1
cpe:2.3:a:symfony:twig:*:*:*:*:*:*:*:*
References 3
- https://github.com/twigphp/Twig/releases/tag/v3.26.0 Product, Release Notes
- https://github.com/twigphp/Twig/security/advisories/GHSA-2q52-x2ff-qgfr Vendor Advisory
- https://www.vulncheck.com/advisories/twig-x-x-sandbox-bypass-via-sourcepolicyinterface Third Party Advisory