<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/cve-2026-133772-sandbox-tag-allow-list-bypass-via-the-branch-of-a-guard-tag-that-isn-t-selected-s-anoj5xepn" -->

---
title: CVE-2026-133772 Sandbox Tag Allow-List Bypass via the...
description: Twig versions 3.15.0 through 3.30.x let sandboxed templates bypass the tag allow-list using the 'guard' tag. The 'guard' tag only compiles the branch matching...
canonical: https://daily.dev/posts/cve-2026-133772-sandbox-tag-allow-list-bypass-via-the-branch-of-a-guard-tag-that-isn-t-selected-s-anoj5xepn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: CVE-2026-133772 Sandbox Tag Allow-List Bypass via the Branch of a `guard` Tag That Isn't Selected (Symfony Blog) | daily.dev
og:description: Twig versions 3.15.0 through 3.30.x let sandboxed templates bypass the tag allow-list using the 'guard' tag. The 'guard' tag only compiles the branch matching...
og:url: https://daily.dev/posts/cve-2026-133772-sandbox-tag-allow-list-bypass-via-the-branch-of-a-guard-tag-that-isn-t-selected-s-anoj5xepn
og:image: https://api.daily.dev/og/posts/aNoJ5Xepn.png
og:image:alt: CVE-2026-133772 Sandbox Tag Allow-List Bypass via the Branch of a `guard` Tag That Isn't Selected (Symfony Blog)
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CVE-2026-133772 Sandbox Tag Allow-List Bypass via the Branch of a `guard` Tag That Isn't Selected (Symfony Blog)

**[Symfony](https://daily.dev/sources/symfony)** · 1 min read · 0 upvotes · 0 comments

## Summary

Twig versions 3.15.0 through 3.30.x let sandboxed templates bypass the tag allow-list using the 'guard' tag. The 'guard' tag only compiles the branch matching an available callable, but the unselected branch was still parsed. That meant 'extends', 'use', 'macro' and 'block' tags inside the unselected branch registered their effects even though the sandbox never saw them. A template with only 'guard' permitted could extend a parent, import blocks or define macros despite policy forbidding those tags. Twig 3.31.0 fixes this by discarding what the unselected branch registers on the parser. Fabien Potencier reported the issue and provided the fix.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://symfony.com/blog/cve-2026-133772-sandbox-tag-allow-list-bypass-via-the-branch-of-a-guard-tag-that-isn-t-selected>

## Questions this post answers

### What is CVE-2026-133772 in Twig and which versions are affected?

CVE-2026-133772 is a sandbox tag allow-list bypass in Twig affecting versions 3.15.0 up to but not including 3.31.0. The 'guard' tag parses both of its branches but only compiles the one matching an available callable; the unselected branch's 'extends', 'use', 'macro' and 'block' tags still registered their effects, letting sandboxed templates bypass tag restrictions. Twig 3.31.0 fixes it.

_Teams running sandboxed Twig templates can track fixes like this one on daily.dev before upgrading._

### How can a sandboxed Twig template bypass its tag policy using the guard tag?

By placing a disallowed tag like 'extends' in the branch of a 'guard' tag that will not be selected for compilation, since that branch was still parsed and its effects, such as extending a template or importing blocks and macros, were registered even though the sandbox's tag policy never inspected it. Example: '{% guard filter upper %}{% else %}{% extends "parent.html" %}{% endguard %}'.

_Developers auditing Twig sandbox policies can follow disclosures like this on daily.dev to catch bypass techniques early._

### How was the Twig guard tag sandbox bypass fixed?

The fix discards whatever the branch of a 'guard' tag that isn't selected registers on the parser, so tags like 'extends', 'use', 'macro' and 'block' in the unused branch no longer take effect outside the sandbox's visibility. The patch landed on the Twig 3.x branch and shipped in Twig 3.31.0, credited to Fabien Potencier who reported the issue and provided the fix.

_daily.dev helps developers patching Twig sandboxes stay current on fixes affecting template security._

## Similar posts on daily.dev

- [CVE-2026-46636: Sandbox filter, tag and function allow-list bypass when sandbox state changes between renders \(Symfony Blog\)](https://daily.dev/posts/cve-2026-46636-sandbox-filter-tag-and-function-allow-list-bypass-when-sandbox-state-changes-betwee-ewzmcouhv) · Symfony · 0 upvotes · 0 comments
- [Twig 3.31.1 released \(Symfony Blog\)](https://daily.dev/posts/twig-3-31-1-released-symfony-blog--o7sva0txx) · Symfony · 0 upvotes · 0 comments
- [CVE-2026-46639: Sandbox property and method bypass via object-destructuring assignment \(Symfony Blog\)](https://daily.dev/posts/cve-2026-46639-sandbox-property-and-method-bypass-via-object-destructuring-assignment-symfony-blog-fdy12mcph) · Symfony · 1 upvotes · 0 comments
- [CVE-2026-133771 Missing autoescaping for a variable named like a macro import alias of another scope \(Symfony Blog\)](https://daily.dev/posts/cve-2026-133771-missing-autoescaping-for-a-variable-named-like-a-macro-import-alias-of-another-scope-6vhxidr8l) · Symfony · 0 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#php](https://daily.dev/tags/php), [#symfony](https://daily.dev/tags/symfony)

[View this post on daily.dev](https://daily.dev/posts/cve-2026-133772-sandbox-tag-allow-list-bypass-via-the-branch-of-a-guard-tag-that-isn-t-selected-s-anoj5xepn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"CVE-2026-133772 Sandbox Tag Allow-List Bypass via the Branch of a `guard` Tag That Isn't Selected (Symfony Blog)","url":"https://daily.dev/posts/cve-2026-133772-sandbox-tag-allow-list-bypass-via-the-branch-of-a-guard-tag-that-isn-t-selected-s-anoj5xepn","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/cve-2026-133772-sandbox-tag-allow-list-bypass-via-the-branch-of-a-guard-tag-that-isn-t-selected-s-anoj5xepn"},"datePublished":"2026-11-24T13:51:15.260Z","dateModified":"2026-11-24T13:51:42.636Z","description":"Twig versions 3.15.0 through 3.30.x let sandboxed templates bypass the tag allow-list using the 'guard' tag. The 'guard' tag only compiles the branch matching...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/327b244859fddae8f3a20d0225898aa0?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/327b244859fddae8f3a20d0225898aa0?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Symfony","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Symfony","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/cc07051b7112472f9729e73c14660a64","url":"https://daily.dev/sources/symfony"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/cve-2026-133772-sandbox-tag-allow-list-bypass-via-the-branch-of-a-guard-tag-that-isn-t-selected-s-anoj5xepn","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,php,symfony","timeRequired":"PT1M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Symfony","item":"https://daily.dev/sources/symfony"},{"@type":"ListItem","position":3,"name":"CVE-2026-133772 Sandbox Tag Allow-List Bypass via the Branch of a `guard` Tag That Isn't Selected (Symfony Blog)"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/cve-2026-133772-sandbox-tag-allow-list-bypass-via-the-branch-of-a-guard-tag-that-isn-t-selected-s-anoj5xepn#faq","mainEntity":[{"@type":"Question","name":"What is CVE-2026-133772 in Twig and which versions are affected?","acceptedAnswer":{"@type":"Answer","text":"CVE-2026-133772 is a sandbox tag allow-list bypass in Twig affecting versions 3.15.0 up to but not including 3.31.0. The 'guard' tag parses both of its branches but only compiles the one matching an available callable; the unselected branch's 'extends', 'use', 'macro' and 'block' tags still registered their effects, letting sandboxed templates bypass tag restrictions. Twig 3.31.0 fixes it. Teams running sandboxed Twig templates can track fixes like this one on daily.dev before upgrading."}},{"@type":"Question","name":"How can a sandboxed Twig template bypass its tag policy using the guard tag?","acceptedAnswer":{"@type":"Answer","text":"By placing a disallowed tag like 'extends' in the branch of a 'guard' tag that will not be selected for compilation, since that branch was still parsed and its effects, such as extending a template or importing blocks and macros, were registered even though the sandbox's tag policy never inspected it. Example: '{% guard filter upper %}{% else %}{% extends \"parent.html\" %}{% endguard %}'. Developers auditing Twig sandbox policies can follow disclosures like this on daily.dev to catch bypass techniques early."}},{"@type":"Question","name":"How was the Twig guard tag sandbox bypass fixed?","acceptedAnswer":{"@type":"Answer","text":"The fix discards whatever the branch of a 'guard' tag that isn't selected registers on the parser, so tags like 'extends', 'use', 'macro' and 'block' in the unused branch no longer take effect outside the sandbox's visibility. The patch landed on the Twig 3.x branch and shipped in Twig 3.31.0, credited to Fabien Potencier who reported the issue and provided the fix. daily.dev helps developers patching Twig sandboxes stay current on fixes affecting template security."}}]}
```

