# CVE-2026-133771: Missing autoescaping for a variable named like a macro import alias of another scope

- Severity: Low 2.3 (CVSS:4.0, scored by Symfony) `CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.67%, higher than 53% of CVEs (2026-12-01)
- Published: 2026-11-24T13:07:54.072Z
- Modified: 2026-12-01T20:18:25.987Z
- Weaknesses: CWE-79, CWE-116
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Symfony

## Description

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.

(As written by CVE List.)

## Affected

- twig/twig: before 3.31.0

## References

- <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)

## Sources

- CVE List: [CVE-2026-133771](https://www.cve.org/CVERecord?id=CVE-2026-133771), CVE Terms of Use, modified 2026-12-01
- NVD: [CVE-2026-133771](https://nvd.nist.gov/vuln/detail/CVE-2026-133771), Public domain, modified 2026-12-01

---

Page: https://cve.day/CVE-2026-133771 · Whole record: https://cve.day/CVE-2026-133771.json · Rebuilt by cve.day 2026-12-01T20:32:18.441Z
