8.6high
Twig has a possible sandbox bypass
- Severity
- 8.6high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.85% (higher than 59% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-6j75-5wfj-gh66
Description
Twig is a template language for PHP. Under some circumstances, the sandbox security checks are not run which allows user-contributed templates to bypass the sandbox restrictions. This vulnerability is fixed in 1.44.8, 2.16.1, and 3.14.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| twigphp Twig | > 1.0.0, < 1.44.8, > 2.0.0, < 2.16.1, > 3.0.0, < 3.14.0 | CVE List |
| symfony twig | from 1.0.0 before 1.44.8, from 2.0.0 before 2.16.1, from 3.0.0 before 3.14.0 | CVE List, NVD |
| twig/twig (Packagist) | from 1.0.0 before 1.44.8, from 2.0.0 before 2.16.1, from 3.12.0 before 3.14.0, from 3.0.0 before 3.11.1 | GitHub Advisory Database |
All scores
| GitHub_M | 8.6high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H |
| GitHub | 8.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H |
| NVD | 8.6high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.
What each source says
CVE List
Twig is a template language for PHP. Under some circumstances, the sandbox security checks are not run which allows user-contributed templates to bypass the sandbox restrictions. This vulnerability is fixed in 1.44.8, 2.16.1, and 3.14.0.
GitHub Advisory Database
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 (likeincluded.twig) and not aTemplateorTemplateWrapperinstance; - 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.
NVD (es)
Twig es un lenguaje de plantillas para PHP. En determinadas circunstancias, las comprobaciones de seguridad de la zona protegida no se ejecutan, lo que permite que las plantillas aportadas por los usuarios eludan las restricciones de la zona protegida. Esta vulnerabilidad se ha corregido en las versiones 1.44.8, 2.16.1 y 3.14.0.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-45411 changed 2024-09-16 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-6j75-5wfj-gh66 changed 2024-10-10 | CC-BY-4.0 |
| NVD | CVE-2024-45411 changed 2026-06-17 | Public domain |