CVE-2024-45411
JSON

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 packageVersionsReported by
twigphp Twig> 1.0.0, < 1.44.8, > 2.0.0, < 2.16.1, > 3.0.0, < 3.14.0CVE List
symfony twigfrom 1.0.0 before 1.44.8, from 2.0.0 before 2.16.1, from 3.0.0 before 3.14.0CVE 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.1GitHub Advisory Database

All scores

GitHub_M8.6high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H
GitHub8.5medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H
NVD8.6high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N

Classification

CWE-693

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 (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.

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

SourceRecordLicence
CVE ListCVE-2024-45411 changed 2024-09-16CVE Terms of Use
GitHub Advisory DatabaseGHSA-6j75-5wfj-gh66 changed 2024-10-10CC-BY-4.0
NVDCVE-2024-45411 changed 2026-06-17Public domain