CVE-2026-55865: Python Liquid Infinite Loop When Parsing Malformed Vulnerability

MODERATE
Advisory Identifier: GHSA-vq2f-vcc9-j8mv
CWE-835
Published
Advisory Summary

CVE-2026-55865 is a MODERATE infinite loop when parsing malformed vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting Python Liquid libraries in the PyPI ecosystem. The issue involves infinite loop when parsing malformed `{% case %}` tags. Remediation is available by upgrading affected packages to version 2.2.1.

CVE-2026-55865 at a Glance

CVE Identifier CVE-2026-55865
GHSA Identifier GHSA-vq2f-vcc9-j8mv
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
Affected Product Python Liquid
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2026-55865

To remediate this vulnerability, upgrade all affected Python Liquid dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

python-liquid fixed: 2.2.1
pip install python-liquid>=2.2.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show python-liquid

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-55865, inspect your installed packages using pip:

pip show python-liquid

Analyze the terminal output to locate any version of Python Liquid in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.2.1), your application is affected.

Note: The pip show python-liquid command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. In Python Liquid, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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. ```python import liquid from liquid.token import TOKEN_EOF liquid.stream.TokenStream.eof = liquid.Token(TOKEN_EOF, TOKEN_EOF, -1, "") # ... ```

CVE-2026-55865 Affected Python Liquid Versions

1 component(s)
Fixed Versions:
2.2.1
Product / Package Ecosystem Affected Versions Fixed Version
python-liquid
PyPI
< 2.2.1
2.2.1

References

Frequently Asked Questions

What is CVE-2026-55865?
CVE-2026-55865 is a security vulnerability in Python Liquid involving Infinite loop when parsing malformed `{% case %}` tags under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop').
Which Python Liquid versions are affected?
Affected versions include releases prior to 2.2.1 across affected packages: python-liquid.
What version fixes CVE-2026-55865?
Upgrading to 2.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is python-liquid affected?
Yes, python-liquid is affected in releases prior to 2.2.1. Upgrade your dependency to 2.2.1 or later.
What CWE is associated with CVE-2026-55865?
CVE-2026-55865 is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop') (The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.).
How can I check PyPI dependencies for CVE-2026-55865?
Run the dependency tree command: 'pip show python-liquid'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vq2f-vcc9-j8mv",
  "modified" : "2026-06-19T20:46:34Z",
  "published" : "2026-06-19T20:46:34Z",
  "aliases" : [ "CVE-2026-55865" ],
  "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```",
  "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "python-liquid"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.2.1"
      } ]
    } ]
  } ],
  "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"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-835" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-19T20:46:34Z",
    "nvd_published_at" : null
  }
}