Missing autoescaping for a variable named like a macro import alias of another scope
影響パッケージ
| パッケージ | 影響を受ける版 → 修正版 | |
|---|---|---|
| Twigtwig/twig |
3.31.0 未満→ 3.31.0 |
3.31.0 |
ディストリビューション別の修正状況
各ディストリビューションが公開している、この CVE の記録です。修正版は配布版ごとに違うので、リンク先で確かめてください。
- Debian DEBIAN-CVE-2026-133771 php-twig 修正版あり
原文の説明 取得元が公開している説明をそのまま載せています (多くは英語)。
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.
出典: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
参照URL
- advisory symfony.com
- advisory github.com
- advisory github.com
- advisory nvd.nist.gov
- package github.com
- patch github.com
- web packagist.org