All reports
Medium

Twig has a possible sandbox bypass

Affected versions

Version ranges need review.

Composertwig/twig
Affected versions
>= 2.0.0, < 2.16.1
Fixed version
2.16.1
Composertwig/twig
Affected versions
>= 3.12.0, < 3.14.0
Fixed version
3.14.0
Composertwig/twig
Affected versions
>= 1.0.0, < 1.44.8
Fixed version
1.44.8
Composertwig/twig
Affected versions
>= 3.0.0, < 3.11.1
Fixed version
3.11.1
Composertwig/twig
Affected versions
>=1.0.0,<1.44.7|>=2.0.0,<2.16.0|>=3.0.0,<3.11.0|>=3.12.0,<3.14.0
Fixed version
Not reported
Affected versions
<=1.23.1
Fixed version
1.23.3

Exploitation

CVE-2024-45411

Probability of exploitation in the next 30 days: 0.85%

FIRST EPSS · 2026-11-22

Description

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:

  • The sandbox is disabled globally;

  • The sandbox is enabled via a sandboxed include() function which references a template name (like included.twig) and not a Template or TemplateWrapper instance;

  • The included template has been loaded before the 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.

Links

Credits

  • fabpot
  • stof

Data rights and licenses

Wordfence

Copyright 2012-2026 Defiant Inc.

Defiant hereby grants you a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute this software vulnerability information. Any copy of the software vulnerability information you make for such purposes is authorized provided that you include a hyperlink to this vulnerability record and reproduce Defiant's copyright designation and this license in any such copy.

License terms

Copyright 1999-2026 The MITRE Corporation

CVE Usage: MITRE hereby grants you a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Common Vulnerabilities and Exposures (CVE®). Any copy you make for such purposes is authorized provided that you reproduce MITRE's copyright designation and this license in any such copy.

License terms