همهٔ گزارش‌ها
متوسط

Python Liquid: Infinite loop when parsing malformed `{% case %}` tags

متن اصلی

نسخه‌های متأثر

بازه‌ها نیاز به بررسی دارند.

نسخه‌های متأثر
<2.2.1
نسخهٔ اصلاح‌شده
2.2.1
نسخه‌های متأثر
< 2.2.1
نسخهٔ اصلاح‌شده
2.2.1

بهره‌برداری

CVE-2026-55865

احتمال بهره‌برداری در ۳۰ روز آینده: 0.45%

FIRST EPSS · ۱۴۰۵/۰۸/۲۷

شرح آسیب‌پذیری

Impact

Given a malformed {% case %} tag without associated {% when %} or {% else %} block, and no terminating {% endcase %} tag, Python Liquid hangs in an infinite loop at parse time. This allows malicious template authors to craft templates for a denial of service attack.

Patches

The issue is fixed in version 2.2.1 with the correction of the liquid.TokenStream.eof attribute. The kind and value of the special EOF token are now the same, so either can be tested against liquid.token.TOKEN_EOF.

Workarounds

Manually correct the definition of liquid.TokenStream.eof before parsing any templates.

import liquid
from liquid.token import TOKEN_EOF

liquid.stream.TokenStream.eof = liquid.Token(TOKEN_EOF, TOKEN_EOF, -1, "")

# ...

پیوندها

گزارش‌دهندگان

  • Nuhiat-Arefin