CVE-2024-45411:
Twig has a possible sandbox bypass
8.6
CVSS ScoreBasic Information
CVE ID
GHSA ID
EPSS Score
-
CWE
Published
9/9/2024
Updated
10/10/2024
KEV Status
No
Technology
PHP
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
twig/twig | composer | >= 1.0.0, < 1.44.8 | 1.44.8 |
twig/twig | composer | >= 2.0.0, < 2.16.1 | 2.16.1 |
twig/twig | composer | >= 3.12.0, < 3.14.0 | 3.14.0 |
twig/twig | composer | >= 3.0.0, < 3.11.1 | 3.11.1 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from how security checks were handled in the include() function. The original implementation (pre-patch) checked security during template preparation via a loop that only validated Template/TemplateWrapper instances. When including templates by name (not instances) that had been cached without sandbox context, these checks were skipped. The commit diff shows the security check (checkSecurity()) was moved from the preparation phase to the runtime phase after template loading, ensuring enforcement regardless of how the template was referenced. The test cases added in CoreTest.php validate that security errors now occur at runtime when preloading occurs, confirming the function's behavior was the root cause.