GitHub Advisoryadvisory · Packagist

GHSA-6j75-5wfj-gh66 Twig has a possible sandbox bypass

MEDIUM Published 2024-09-09 Modified 2024-10-10 Official page ↗
Aliases
CVE-2024-45411
Ecosystem
Packagist
Packages
twig/twig
Severity
Moderate
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H
Weaknesses
CWE-693
Reviewed
2024-09-09

Affected packages

• Packagist twig/twig: >= 1.0.0, < 1.44.8 → fixed in 1.44.8 • Packagist twig/twig: >= 2.0.0, < 2.16.1 → fixed in 2.16.1 • Packagist twig/twig: >= 3.12.0, < 3.14.0 → fixed in 3.14.0 • Packagist twig/twig: >= 3.0.0, < 3.11.1 → fixed in 3.11.1

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.

Related

Alias · CVE (1)

Weakness · CWE (1)

  • CWE-693 Protection Mechanism Failure weakness

References