BuzzPHP
LightDarkSystem

Twig: Sandbox filter, tag and function allow-list bypass when sandbox state changes between renders for a cached `Template`

High severity. Published 1 July 2026. Update twig/twig to 3.27.0 or later: composer update twig/twig.

Which versions are affected?

PackageAffected versionsFixed in
twig/twig (opens in a new tab)<= 3.26.03.27.0

What should you do?

Update every affected package you use to its fixed version, then check that nothing else in your project matches an advisory. To see which version you run, and whether anything is still affected:

composer show twig/twig
composer audit

Advisory details

SeverityHigh
Published
Updated
CVECVE-2026-49981 (opens in a new tab)
GHSAGHSA-529h-vh3j-85hq (opens in a new tab)
WeaknessCWE-693, CWE-863

What the advisory says

Description

The per-template filter, tag and function allow-list check is compiled into the checkSecurity() method of each Template subclass and was invoked once from the constructor, gated by SandboxExtension::isSandboxed($source). Template instances are then cached on the Environment in $loadedTemplates, so the verdict computed at construction time was sticky for the rest of the process.

Source: GHSA-529h-vh3j-85hq (opens in a new tab) in the GitHub Advisory Database (CC BY 4.0). Data from GitHub (opens in a new tab) as of .

Other recent advisories for this package

All Composer security advisories