Missing autoescaping for a variable named like a macro import alias of another scope

Summary

CVECVE-2026-133771
StatePUBLISHED
AssignerSymfony
Source PriorityCVE Program / NVD first with legacy fallback
Published2026-11-24 13:17:25 UTC
Updated2026-11-24 13:17:25 UTC
DescriptionThe 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.

Risk And Classification

Primary CVSS: v4.0 2.3 LOW from b5aa5c7f-767d-4597-9c64-3ac08b8711c6

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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Problem Types: CWE-79 | CWE-116 | CWE-79 CWE-79 Improper Neutralization of Input During Web Page Generation | CWE-116 CWE-116 Improper Encoding or Escaping of Output


VersionSourceTypeScoreSeverityVector
4.0b5aa5c7f-767d-4597-9c64-3ac08b8711c6Secondary2.3LOWCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/C...
4.0CNACVSS2.3LOWCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N

CVSS v4.0 Breakdown

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
Passive
Confidentiality
None
Integrity
None
Availability
None
Sub Conf.
Low
Sub Integrity
Low
Sub Availability
None

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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Vendor Declared Affected Products

SourceVendorProductVersionPlatforms
CNA Twig Twig/twig affected 3.31.0 semver Not specified

References

ReferenceSourceLinkTags
github.com/twigphp/Twig/security/advisories/GHSA-63v2-9rx5-wjgr b5aa5c7f-767d-4597-9c64-3ac08b8711c6 github.com
github.com/twigphp/Twig/commit/3a6745a0d88048474457fa2e69968ebd5267dd5a b5aa5c7f-767d-4597-9c64-3ac08b8711c6 github.com
symfony.com/cve-2026-133771 b5aa5c7f-767d-4597-9c64-3ac08b8711c6 symfony.com
CVE Program record CVE.ORG www.cve.org canonical
NVD vulnerability detail NVD nvd.nist.gov canonical, analysis

Vendor Comments And Credit

Discovery Credit

CNA: Jack Worman (en)

© CVE.report 2026

Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. It is the responsibility of user to evaluate the accuracy, completeness or usefulness of any information, opinion, advice or other content. EACH USER WILL BE SOLELY RESPONSIBLE FOR ANY consequences of his or her direct or indirect use of this web site. ALL WARRANTIES OF ANY KIND ARE EXPRESSLY DISCLAIMED. This site will NOT BE LIABLE FOR ANY DIRECT, INDIRECT or any other kind of loss.

CVE, CWE, and OVAL are registred trademarks of The MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. This site includes MITRE data granted under the following license.

Free CVE JSON API cve.report/api

CVE.report and Source URL Uptime Status status.cve.report