{"id":"PYSEC-2026-3035","summary":"Python Liquid: Infinite loop when parsing malformed `{% case %}` tags","details":"### Impact\nGiven 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.\n\n### Patches\nThe 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`.\n\n### Workarounds\nManually correct the definition of `liquid.TokenStream.eof` before parsing any templates.\n\n```python\nimport liquid\nfrom liquid.token import TOKEN_EOF\n\nliquid.stream.TokenStream.eof = liquid.Token(TOKEN_EOF, TOKEN_EOF, -1, \"\")\n\n# ...\n```","aliases":["CVE-2026-55865","GHSA-vq2f-vcc9-j8mv"],"modified":"2026-07-13T16:33:29.033510918Z","published":"2026-07-13T15:46:21.968216Z","references":[{"type":"WEB","url":"https://github.com/jg-rp/liquid/security/advisories/GHSA-vq2f-vcc9-j8mv"},{"type":"PACKAGE","url":"https://github.com/jg-rp/liquid"},{"type":"PACKAGE","url":"https://pypi.org/project/python-liquid"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-vq2f-vcc9-j8mv"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-55865"}],"affected":[{"package":{"name":"python-liquid","ecosystem":"PyPI","purl":"pkg:pypi/python-liquid"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.2.1"}]}],"versions":["0.10.0","0.10.1","0.11.0","0.5.1","0.5.2","0.5.3","0.5.5","0.5.6","0.6.0","0.6.1","0.6.2","0.6.3","0.6.4","0.7.0","0.7.1","0.7.2","0.7.3","0.7.4","0.7.5","0.7.6","0.7.7","0.8.0","0.8.1","0.9.0","1.0.0","1.0.1","1.0.2","1.0.3","1.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.1.5","1.1.6","1.1.7","1.10.0","1.10.2","1.11.0","1.12.0","1.12.1","1.12.2","1.13.0","1.2.0","1.2.1","1.3.0","1.4.0","1.4.1","1.4.2","1.4.3","1.4.4","1.4.5","1.4.6","1.4.7","1.5.0","1.5.1","1.6.0","1.6.1","1.7.0","1.8.0","1.8.1","1.9.0","1.9.1","1.9.2","1.9.3","1.9.4","2.0.0","2.0.1","2.0.2","2.1.0","2.2.0"],"database_specific":{"source":"https://github.com/pypa/advisory-database/blob/main/vulns/python-liquid/PYSEC-2026-3035.yaml"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"}]}