CVE-2026-133771

LOWCVSS 2.3/10EPSS 0.67%

Last modified

CVE-2026-133771 is a low-severity vulnerability rated 2.3/10 on the CVSS scale. The escaper considered x.attr, x['key'] and x.method() safe whenever {% import ... as x %} appeared anywhere in the template. EPSS estimates a 0.67% chance of exploitation in the next 30 days.

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.

Metrics

Weakness Enumeration

Affected Software

Source: CNA advisory (CVE.org). NVD analysis pending.

VendorProductVersions
Twigtwig/twig< 3.31.0

References

Timeline

Published
Last Modified
Status
Awaiting Analysis

Frequently Asked Questions

What is CVE-2026-133771?
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.
How severe is CVE-2026-133771?
CVE-2026-133771 has a CVSS score of 2.3/10 (LOW severity). The EPSS model estimates a 0.67% probability of exploitation in the next 30 days.
How do I fix CVE-2026-133771?
Check the vendor references and advisories linked above for patched versions and mitigation guidance. You can also run a Strix scan to test if your systems are affected.

How Strix Helps

Related CVEs from 2026

Are you affected by CVE-2026-133771?

Run a free Strix scan to check your systems for this vulnerability.

Scan your code now

Source: NVD / NIST