
Twig 3.31.0 Patch Resolves Low-Risk XSS Flaw in Macro Alias Escaping
Twig released version 3.31.0 to fix CVE-2026-133771, a low-severity cross-site scripting vulnerability. The flaw occurred when variables shared names with macro import aliases, causing the engine to skip output escaping. This allowed attackers to inject malicious scripts if they controlled the variable values. The issue affects versions prior to 3.31.0 and has been assigned a CVSS 4.0 score of 2.3. The fix removes the outdated safety rule for macro calls, ensuring all variables are properly escaped regardless of naming conflicts with imports in other scopes.