CVE Watchtower

CVE-2026-133771twig/twig Cross-site Scripting (XSS)

NVD

Vulnerability Summary

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.
Severity Level
LOW(2.3)
Published Date
Nov 24, 2026
Last Modified
Nov 24, 2026
Exploitation Status
No confirmed exploitation yet
Root Weakness (CWE)
The software does not neutralize user-controllable input before it is placed in output that is used as a web page.
The product prepares a structured message for communication with another component, but encoding or escaping of the data is missing or incorrect.
CVSS v4.0 Base Metrics — Score 2.3 (LOW)
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
Attack VectorNetwork
Attack ComplexityLow
Attack RequirementsPresent
Privileges RequiredNone
User InteractionPassive
Confidentiality (Vulnerable System)None
Integrity (Vulnerable System)None
Availability (Vulnerable System)None
Confidentiality (Subsequent System)Low
Integrity (Subsequent System)Low
Availability (Subsequent System)None

Affected & Patched Versions

Affected Versions
  • twig/twig < 3.31.0
Patched Versions
  • twig/twig 3.31.0

What to do

Fix it during your normal patch cycle. No exploitation is confirmed yet.

  1. Check whether you run twig/twig and which version.
  2. Update to a patched version listed above, then confirm the new version.

Timeline

  • Nov 24, 2026Published
  • Nov 24, 2026Record last modified

Score, severity and exploitation changes are tracked from the day Watchtower started logging them.

Get notified about new twig/twig CVEsYou are reading CVE-2026-133771. Get an email when KEV listings, exploits or new CVEs match your stack.
Set up CVE alerts

Data last checked: Nov 24, 2026 14:13 UTC