Description
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.
Problem types
CWE-693 Protection Mechanism Failure
Product status
3.9.0 (semver) before 3.26.0
2.16.* (custom)
Credits
Nicolò Ribaudo
Fabien Potencier
VulnCheck
References
github.com/...p/Twig/security/advisories/GHSA-2q52-x2ff-qgfr
github.com/twigphp/Twig/releases/tag/v3.26.0
www.vulncheck.com/...andbox-bypass-via-sourcepolicyinterface