CVE-2026-133772

NameCVE-2026-133772
DescriptionThe 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.
SourceCVE (at NVD; CERT, ENISA, LWN, oss-sec, fulldisc, Debian ELTS, Red Hat, Ubuntu, Gentoo, SUSE bugzilla/CVE, GitHub advisories/code/issues, web search, more)

Vulnerable and fixed packages

The table below lists information on source packages.

Source PackageReleaseVersionStatus
php-twig (PTS)bookworm, bookworm (security)3.5.1-1+deb12u3vulnerable
trixie (security), trixie3.27.0-0+deb13u1vulnerable
forky3.30.0-1vulnerable
sid3.31.1-1fixed

The information below is based on the following data on fixed versions.

PackageTypeReleaseFixed VersionUrgencyOriginDebian Bugs
php-twigsource(unstable)3.31.0-1

Notes

https://symfony.com/blog/cve-2026-133772-sandbox-tag-allow-list-bypass-via-the-branch-of-a-guard-tag-that-isn-t-selected
https://github.com/twigphp/Twig/security/advisories/GHSA-qr49-4294-4gmw
https://github.com/twigphp/Twig/commit/d5011f4654042f03d8986b5b3ba12a4d85f976f8 (v3.31.0)

Search for package or bug name: Reporting problems