CVE-2026-61556: Liquidjs LiquidJS Has An Infinite Loop Vulnerability

HIGH
Advisory Identifier: GHSA-m7fp-h3p4-hr49
CWE-835
Published
Advisory Summary

CVE-2026-61556 is a HIGH liquidjs has an infinite loop vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting Liquidjs libraries in the npm ecosystem. The issue involves liquidjs has an infinite loop vulnerability in its `strip_html` filter. Remediation is available by upgrading affected packages to version 10.27.1.

CVE-2026-61556 at a Glance

CVE Identifier CVE-2026-61556
GHSA Identifier GHSA-m7fp-h3p4-hr49
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
Affected Product Liquidjs
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-61556

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

liquidjs fixed: 10.27.1
npm install liquidjs@10.27.1
Verify Direct and Transitive Dependencies

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

npm ls liquidjs

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-61556, inspect your project dependencies using npm:

npm ls liquidjs

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

Note: The npm ls liquidjs command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

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 Liquidjs, 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

### Summary The current implementation of `strip_html` can cause an infinite loop when the input string contains `<`, has at least one character before `<`, and no `>` appears after `<`. ### Details The problem is in `src/filters/html.ts`. Specifically, the following part has the infinite loop. ``` // Raw-text blocks (HTML5) plus '<...>' as the catch-all kind; a regex // equivalent is O(n^2) in V8 on unclosed openers. export function strip_html (this: FilterImpl, v: string) { const str = stringify(v) this.context.memoryLimit.use(str.length) const blocks = new Map([['<script', '</script>'], ['<style', '</style>'], ['<!--', '-->'], ['<', '>']]) let out = '' let i = 0 while (i < str.length) { const lt = str.indexOf('<', i) if (lt < 0) return out + str.slice(i) out += str.slice(i, lt) for (const [opener, closer] of blocks) { if (!str.startsWith(opener, lt)) continue const e = str.indexOf(closer, lt + opener.length) if (e >= 0) { i = e + closer.length; break } blocks.delete(opener) } if (i === lt) return out + str.slice(lt) } return out } ``` For the input "a<", the variable `lt` is updated to 1 by `const lt = str.indexOf('<', i)`. However, the variable `i` is never updated from its initial value of 0. This is because in `const e = str.indexOf(closer, lt + opener.length)`, `e` becomes -1, since there is no > after <. Therefore, when execution reaches `if (i === lt) return out + str.slice(lt)`, `i` is 0. This is the same state as at the beginning of the loop. As a result, the same thing is repeated again from that state, causing an infinite loop. ### PoC ``` const { Liquid } = require('liquidjs'); const engine = new Liquid(); engine.parseAndRender('{{ html | strip_html }}', { html: 'a<' }).then(console.log); console.log("This is never displayed."); ``` ### Impact This is an infinite loop vulnerability (cf. https://cwe.mitre.org/data/definitions/835.html). This results in a denial of service (DoS). Although a ReDoS vulnerability has previously been reported in the affected function (cf. https://github.com/harttle/liquidjs/security/advisories/GHSA-r7g9-xpmj-5fcq), this issue can cause a more severe impact than that ReDoS vulnerability with an input of only two characters at minimum. ### Recommended Fix There is an issue with the following conditional branch. ``` if (i === lt) return out + str.slice(lt); ``` The following should fix the issue. ``` if (i <= lt) return out + str.slice(lt); ```

CVE-2026-61556 Affected Liquidjs Versions

1 component(s)
Fixed Versions:
10.27.1
Product / Package Ecosystem Affected Versions Fixed Version
liquidjs
npm
≥ 10.26.0
< 10.27.1
10.27.1

References

Frequently Asked Questions

What is CVE-2026-61556?
CVE-2026-61556 is a security vulnerability in Liquidjs involving LiquidJS has an infinite loop vulnerability in its `strip_html` filter under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop').
Which Liquidjs versions are affected?
Affected versions include releases prior to 10.27.1 across affected packages: liquidjs.
What version fixes CVE-2026-61556?
Upgrading to 10.27.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is liquidjs affected?
Yes, liquidjs is affected in releases prior to 10.27.1. Upgrade your dependency to 10.27.1 or later.
What CWE is associated with CVE-2026-61556?
CVE-2026-61556 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 npm dependencies for CVE-2026-61556?
Run the dependency tree command: 'npm ls liquidjs'. 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-m7fp-h3p4-hr49",
  "modified" : "2026-09-03T17:45:26Z",
  "published" : "2026-09-03T17:45:26Z",
  "aliases" : [ "CVE-2026-61556" ],
  "summary" : "LiquidJS has an infinite loop vulnerability in its `strip_html` filter",
  "details" : "### Summary\nThe current implementation of `strip_html` can cause an infinite loop when the input string contains `<`, has at least one character before `<`, and no `>` appears after `<`.\n\n### Details\nThe problem is in `src/filters/html.ts`.\nSpecifically, the following part has the infinite loop.\n\n```\n// Raw-text blocks (HTML5) plus '<...>' as the catch-all kind; a regex\n// equivalent is O(n^2) in V8 on unclosed openers.\nexport function strip_html (this: FilterImpl, v: string) {\n  const str = stringify(v)\n  this.context.memoryLimit.use(str.length)\n  const blocks = new Map([['<script', '</script>'], ['<style', '</style>'], ['<!--', '-->'], ['<', '>']])\n  let out = ''\n  let i = 0\n  while (i < str.length) {\n    const lt = str.indexOf('<', i)\n    if (lt < 0) return out + str.slice(i)\n    out += str.slice(i, lt)\n    for (const [opener, closer] of blocks) {\n      if (!str.startsWith(opener, lt)) continue\n      const e = str.indexOf(closer, lt + opener.length)\n      if (e >= 0) { i = e + closer.length; break }\n      blocks.delete(opener)\n    }\n    if (i === lt) return out + str.slice(lt)\n  }\n  return out\n}\n```\n\nFor the input \"a<\", the variable `lt` is updated to 1 by `const lt = str.indexOf('<', i)`. However, the variable `i` is never updated from its initial value of 0. This is because in `const e = str.indexOf(closer, lt + opener.length)`, `e` becomes -1, since there is no > after <. Therefore, when execution reaches `if (i === lt) return out + str.slice(lt)`, `i` is 0. This is the same state as at the beginning of the loop. As a result, the same thing is repeated again from that state, causing an infinite loop.\n\n\n### PoC\n```\nconst { Liquid } = require('liquidjs');\n\nconst engine = new Liquid();\n\nengine.parseAndRender('{{ html | strip_html }}', {\n  html: 'a<'\n}).then(console.log);\n\nconsole.log(\"This is never displayed.\");\n```\n\n### Impact\nThis is an infinite loop vulnerability (cf. https://cwe.mitre.org/data/definitions/835.html). This results in a denial of service (DoS). Although a ReDoS vulnerability has previously been reported in the affected function (cf. https://github.com/harttle/liquidjs/security/advisories/GHSA-r7g9-xpmj-5fcq), this issue can cause a more severe impact than that ReDoS vulnerability with an input of only two characters at minimum.\n\n### Recommended Fix\nThere is an issue with the following conditional branch.\n\n```\nif (i === lt) return out + str.slice(lt);\n```\n\nThe following should fix the issue.\n\n```\nif (i <= lt) return out + str.slice(lt);\n```",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "liquidjs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "10.26.0"
      }, {
        "fixed" : "10.27.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/harttle/liquidjs/security/advisories/GHSA-m7fp-h3p4-hr49"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-61556"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/harttle/liquidjs/pull/917"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/harttle/liquidjs/commit/5c3522f33928aae66f0fe85c36e1d9015c768fe2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/harttle/liquidjs"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/harttle/liquidjs/releases/tag/v10.27.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-835" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-03T17:45:26Z",
    "nvd_published_at" : "2026-08-19T21:17:03Z"
  }
}