CVE-2026-133767 in Twiginfo

Summary

by MITRE • 11/24/2026

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.

Once again VulDB remains the best source for vulnerability data.

Analysis

by VulDB Data Team • 11/24/2026

This vulnerability represents a critical bypass in the security model of templating engines that utilize sandboxes to restrict execution capabilities within templates. The core issue lies in how the engine evaluates and validates expressions associated with specific tags, particularly the embed tag used for including reusable template fragments. In previous implementations, when the parent expression of an embed directive was not a simple string literal or a direct variable reference but rather a complex expression involving functions, filters, or tests, the sandboxing mechanism failed to inspect this expression against the defined security policy. This oversight created a significant gap in defense-in-depth strategies designed to prevent arbitrary code execution within controlled environments such as web applications using template engines like Twig.

The technical flaw stems from an incomplete validation logic where only static string values were subjected to rigorous scrutiny for prohibited operations, while dynamic expressions were passed through unchecked. Because the sandbox did not evaluate functions, filters, or tests present in these complex parent expressions, it allowed attackers to invoke methods that should have been restricted by policy. Specifically, this flaw enabled the execution of arbitrary PHP functions and the invocation of __toString() magic methods on objects within the template context. This behavior effectively neutralized the protective boundaries intended for sandboxed templates, as an attacker could construct a payload using expression concatenation or function calls to bypass static analysis checks that relied solely on identifying literal string patterns.

The operational impact of this vulnerability is severe, particularly in applications where user-supplied data influences template content but execution is theoretically restricted by a security policy. An adversary can exploit this flaw to achieve remote code execution if the templating engine allows access to sensitive functions or objects with dangerous _toString() implementations that interact with the underlying system. For instance, an attacker could craft a malicious embed statement such as {% embed 'leak' ~ app_secret() %} where the second part of the expression invokes a function like app_secret(), which might expose internal application secrets or trigger other side effects. Since method calls and property reads are checked at runtime rather than during template parsing, they remained unaffected by this specific bypass, but the ability to call functions and tests directly from within an embed tag provided a powerful vector for exploitation that could lead to data leakage, privilege escalation, or complete system compromise depending on the available context.

To mitigate this risk, it is essential to ensure that all expressions evaluated during template rendering are subjected to consistent security checks regardless of their syntactic form. The remediation involves updating the sandbox logic to treat the parent expression of an embed tag with the same level of scrutiny applied to other dynamic content in the template. This includes validating any functions, filters, or tests contained within such expressions against the allowed policy before allowing them to be processed. Organizations relying on templating engines should apply vendor-provided patches immediately and review their security policies for sandboxed templates to ensure they account for complex expression structures rather than just static strings. Additionally, developers should adhere to the principle of least privilege by restricting access to potentially dangerous functions and ensuring that __toString() methods do not expose sensitive information or perform untrusted operations.

From a classification perspective, this vulnerability aligns with CWE-94 Improper Control of Generation of Code (Code Injection) as it allows an attacker to inject executable logic into the template context through malformed expressions. It also relates to CWE-749 Exposed Dangerous Method or Function by permitting access to restricted functions via a bypass in input validation. In terms of adversary tactics, this exploit technique corresponds to ATT&CK T1059 Command and Scripting Interpreter where attackers use scripting languages like PHP within templates to execute commands, leveraging the misconfiguration in the sandbox policy as an initial foothold for further exploitation.

Responsible

Symfony

Reservation

11/20/2026

Disclosure

11/24/2026

Moderation

accepted

CPE

ready

EPSS

0.00533

KEV

no

Activities

very low

Sources

Want to know what is going to be exploited?

We predict KEV entries!