-
CVSS Score
-| 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 |
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.