CVE-2026-133771Missing autoescaping for a variable named like a macro import alias of another scope
The escaper considered x.attr, x['key'] and x.method() safe whenever {% import ... as x %} appeared anywhere in the template. Macro calls haven't needed this rule since Twig 3.0. It only matched ordinary variables that have the name of an alias imported in another block or macro, and printed them without escaping: {% block header %}{% import _self as item %}{{ item.hello() }}{% endblock %} {% block content %}{% for item in items %}{{ item.body }}{% endfor %}{% endblock %} Here, item.body is printed raw. This leads to XSS when the value comes from an attacker. The same happens with an import in a macro and an argument of the same name in another macro. It also happens with a template-level import placed after the block that uses the name. The rule is removed. Macro calls through an alias are still considered safe.
What to do
Debian has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Debian 14 | php-twig | Fix pending | DEBIAN-CVE-2026-133771 | |
| Debian 13 | php-twig | Fix pending | DEBIAN-CVE-2026-133771 | |
| Debian 12 | php-twig | Fix pending | DEBIAN-CVE-2026-133771 |
What the vendor says
As published in the CVE record by Symfony, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- twig/twig: affected: before 3.31.0; fixed in
3.31.0
Vendor advisories:
- https://symfony.com/cve-2026-133771 (vendor-advisory)
- https://github.com/twigphp/Twig/security/advisories/GHSA-63v2-9rx5-wjgr (vendor-advisory)
- https://github.com/twigphp/Twig/commit/3a6745a0d88048474457fa2e69968ebd5267dd5a (patch)
References
- https://symfony.com/cve-2026-133771
- https://github.com/twigphp/Twig/security/advisories/GHSA-63v2-9rx5-wjgr
- https://github.com/twigphp/Twig/commit/3a6745a0d88048474457fa2e69968ebd5267dd5a
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.