Twig has a possible sandbox bypass
Package
Affected versions
>= 1.0.0, < 1.44.8
>= 2.0.0, < 2.16.1
>= 3.12.0, < 3.14.0
>= 3.0.0, < 3.11.1
Patched versions
1.44.8
2.16.1
3.14.0
3.11.1
Description
Published by the National Vulnerability Database
Sep 9, 2024
Published to the GitHub Advisory Database
Sep 9, 2024
Reviewed
Sep 9, 2024
Last updated
Oct 10, 2024
Description
Under some circumstances, the sandbox security checks are not run which allows user-contributed templates to bypass the sandbox restrictions.
The security issue happens when all these conditions are met:
include()
function which references a template name (likeincluded.twig
) and not aTemplate
orTemplateWrapper
instance;include()
call but in a non-sandbox context (possible as the sandbox has been globally disabled).Resolution
The patch ensures that the sandbox security checks are always run at runtime.
Credits
We would like to thank Fabien Potencier for reporting and fixing the issue.
References