CVE-2026-133767: Sandbox allow-list and `__toString()` bypass via a dynamic `embed` parent expression
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' ~ appsecret() %}{% 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.
Affected Software
Event History
Frequently Asked Questions
Who is exposed to this issue?
Applications that render sandboxed Twig templates and permit use of the embed tag are exposed. The bypass applies when an embed tag uses a dynamic parent expression rather than a literal string or variable.
What could an attacker do through the bypass?
A sandboxed template could invoke functions, filters, and tests that were not allowed by the sandbox policy. It could also trigger __toString() conversions that were not checked by the policy.
Are method calls and property reads bypassed as well?
No. Method calls and property reads remain checked at runtime and were not affected by this issue.
How can I identify potentially affected templates?
Review sandboxed templates that are allowed to use embed and look for embed parent values built from expressions, such as concatenation or expressions that invoke functions, filters, tests, or string conversions. A literal parent name or a simple variable is not the described bypass condition.
What should be done if the fix cannot be applied immediately?
Restrict or disable embed usage in sandboxed templates, especially where the parent template name can be built dynamically. Avoid allowing untrusted template authors to supply dynamic embed parent expressions.