CVE-2026-133772: Sandbox Tag Allow-List Bypass via the Branch of a `guard` Tag That Isn't Selected

Published Nov 24, 2026
·
Updated

The guard tag compiles only one of its branches, depending on whether a callable exists. The other branch was still parsed, though. The extends, use, macro and block tags in it registered their effects on the template. The sandbox doesn't see these tags, since that branch isn't compiled. A sandboxed template allowed to use guard could therefore extend a template, import blocks and define macros, while the policy doesn't allow these tags:

{% guard filter upper %}{% else %}{% extends "parent.html" %}{% endguard %}

The templates reached this way come from the loader of the sandbox, and they are sandboxed too.

What the branch that isn't selected registers on the parser is now discarded.

Affected Software

1 affected component
composer/twig/twig

Event History

Nov 24, 2026
CVE Published
via MITRE·01:07 PM
Data Sourced
via MITRE·01:07 PM
DescriptionWeakness
Data Sourced
via OSV·01:07 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·01:17 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Who is exposed to this issue?

Applications that render sandboxed Twig templates and allow the guard tag are exposed when their sandbox policy disallows extends, use, macro, or block tags. The issue affects parser-side effects from those tags when they appear in the guard branch that is not compiled.

2

What must an attacker be able to do to exploit it?

An attacker needs the ability to supply or control a sandboxed template that can use guard. They can place restricted tags such as extends in the branch that guard does not select, causing those tags to register effects despite not being seen by the sandbox policy.

3

Does this allow an attacker to load templates outside the sandbox?

No. Templates reached through this behavior come from the sandbox's configured loader and are themselves sandboxed.

4

What changes address the problem?

The fix discards parser registrations made by the guard branch that is not selected. Until the fix is applied, avoid allowing guard in sandboxed templates where extends, use, macro, or block are prohibited by policy.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203