Sandbox allow-list and `__toString()` bypass via a dynamic `embed` parent expression
- State
- Published
- Severity
- 5.3 Medium
- Published
- Nov 24, 2026
- Updated
- Nov 24, 2026
- Reserved
- Nov 20, 2026
Description
When the parent of an embed tag was an expression other than a string or a variable, the sandbox didn't see that expression. The functions, filters and tests of the expression weren't checked against the policy, and neither were its conversions to strings. A sandboxed template allowed to use embed could therefore call any function, filter or test, and any __toString() method:
{% embed 'leak_' ~ app_secret() %}{% endembed %}
Method calls and property reads were not affected, since they're checked at runtime.
The sandbox now checks the parent expression of embed like any other expression of the template.
| Product | Versions |
|---|---|
| twig/twig Twig | before 3.31.1 Affected |
| CVSS | Score | How It's Reached | Source |
|---|---|---|---|
| 4.0 | 5.3 Medium | Symfony |
Weaknesses
References
- CVE-2026-133767Vendor Advisory
- GHSA-fmp9-6wxr-cfmqVendor Advisory
- https://github.com/twigphp/Twig/commit/fe395ad247b8e6c6f34f39bc211119ecb11f80b3Patch
Every record here comes from the CVE Program's CVE List. © 1999-2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.