CVE-2026-133763: Sandbox `__toString()` policy bypass via the `is true` test
The sandbox checks that a template may call toString() on an object before converting it to a string. For an object, the is true test evaluates to the object itself, and that result wasn't checked. A sandboxed template could therefore print an object through a denied toString() method:
{{ obj is true }}
The same applies when the result is concatenated or passed to a filter. No tag needs to be allowed. A test in a boolean context, like {% if obj is true %}, isn't affected, since it doesn't convert the object to a string.
The sandbox now checks the result of tests like the result of filters and functions.
Affected Software
Event History
Frequently Asked Questions
When is a sandboxed template exposed to this issue?
Exposure requires a sandboxed template to evaluate an object with the `is true` test and then cause that test result to be converted to a string, such as by printing it, concatenating it, or passing it to a filter. The object's `toString()` method must be denied by the sandbox policy for the bypass to matter.
Does this require any template tags to be permitted by the sandbox?
No. The issue can be triggered without any tag being allowed.
Are boolean conditions using this test affected?
No. A use in a boolean context, such as `{% if obj is true %}`, does not convert the object to a string and is not affected.
How can I identify potentially affected templates?
Review sandboxed templates for `is true` applied to objects where the result is printed, concatenated, or supplied to a filter. Uses limited to boolean control-flow contexts are not affected.