Advisory

PYSEC-2026-3035

Also known as: CVE-2026-55865, GHSA-vq2f-vcc9-j8mv

Summary

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

Details

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, "")

# ...

Severity

Not rated by the source.

Dates

Published
2026-07-13 15:46 UTC
Modified
2026-07-13 16:33 UTC

Affected packages and fixes

python-liquid

PyPI · All systems

Affected

  • introduced 0, fixed 2.2.1 (ecosystem)

Fixed versions

2.2.1

Fix

  • Fixed version 2.2.1
    pip install --upgrade python-liquid==2.2.1

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: PyPA Advisory Database · CC BY 4.0

Sources & licences