Lucene search

K
githubGitHub Advisory DatabaseGHSA-6J75-5WFJ-GH66
HistorySep 09, 2024 - 8:19 p.m.

Twig has a possible sandbox bypass

2024-09-0920:19:26
CWE-693
GitHub Advisory Database
github.com
15
twig
sandbox bypass
security issue

CVSS3

8.6

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

CHANGED

Confidentiality Impact

NONE

Integrity Impact

HIGH

Availability Impact

NONE

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N

AI Score

7.2

Confidence

Low

EPSS

0.001

Percentile

48.5%

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.

Affected configurations

Vulners
Node
twigtwigRange<3.11.1
OR
twigtwigRange<3.14.0
OR
twigtwigRange<2.16.1
OR
twigtwigRange<1.44.8
VendorProductVersionCPE
twigtwig*cpe:2.3:a:twig:twig:*:*:*:*:*:*:*:*

CVSS3

8.6

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

CHANGED

Confidentiality Impact

NONE

Integrity Impact

HIGH

Availability Impact

NONE

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N

AI Score

7.2

Confidence

Low

EPSS

0.001

Percentile

48.5%