GitHub Advisoryadvisory · npm
GHSA-m7fp-h3p4-hr49 LiquidJS has an infinite loop vulnerability in its `strip_html` filter
HIGH
Official page ↗
- Aliases
- CVE-2026-61556
- Ecosystem
- npm
- Packages
- liquidjs
- Severity
- High
- CVSS vector
- 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
- Weaknesses
- CWE-835
- Reviewed
- 2026-09-03
Affected packages
• npm liquidjs: >= 10.26.0, < 10.27.1 → fixed in 10.27.1
Description
Summary
The current implementation of `strip_html` can cause an infinite loop when the input string contains `` appears after `' 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([[''], [''], [''], ['']])
let out = ''
let i = 0
while (i = 0) { i = e + closer.length; break }
blocks.delete(opener)
}
if (i === lt) return out + str.slice(lt)
}
return out
}
```
For the input "a 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);
```
Related
Alias · CVE (1)
- CVE-2026-61556 LiquidJS is a Shopify / GitHub Pages compatible template engine in pure JavaScript. vulnerability
Weakness · CWE (1)
- CWE-835 Loop with Unreachable Exit Condition weakness
References
- https://github.com/harttle/liquidjs/security/advisories/GHSA-m7fp-h3p4-hr49 web
- https://nvd.nist.gov/vuln/detail/CVE-2026-61556 advisory
- https://github.com/harttle/liquidjs/pull/917 web
- https://github.com/harttle/liquidjs/commit/5c3522f33928aae66f0fe85c36e1d9015c768fe2 web
- https://github.com/harttle/liquidjs package
- https://github.com/harttle/liquidjs/releases/tag/v10.27.1 web