CVE-2026-34166
Description
LiquidJS is a Shopify / GitHub Pages compatible template engine in pure JavaScript. Prior to 10.25.3, the replace filter in LiquidJS incorrectly accounts for memory usage when the memoryLimit option is enabled. It charges str.length + pattern.length + replacement.length bytes to the memory limiter, but the actual output from str.split(pattern).join(replacement) can be quadratically larger when the pattern occurs many times in the input string. This allows an attacker who controls template content to bypass the memoryLimit DoS protection with approximately 2,500x amplification, potentially causing out-of-memory conditions. This vulnerability is fixed in 10.25.3.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
liquidjsnpm | < 10.25.3 | 10.25.3 |
Affected products
1Patches
1abc058be0f33fix: precise memoryLimit for string replace
1 file changed · +4 −2
src/filters/string.ts+4 −2 modified@@ -138,8 +138,10 @@ export function replace (this: FilterImpl, v: string, pattern: string, replaceme const str = stringify(v) pattern = stringify(pattern) replacement = stringify(replacement) - this.context.memoryLimit.use(str.length + pattern.length + replacement.length) - return str.split(pattern).join(replacement) + const parts = str.split(pattern) + const outputSize = str.length + (parts.length - 1) * (replacement.length - pattern.length) + this.context.memoryLimit.use(outputSize) + return parts.join(replacement) } export function replace_first (this: FilterImpl, v: string, arg1: string, arg2: string) {
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/harttle/liquidjs/commit/abc058be0f33d6372cd2216f4945183167abeb25nvdPatchWEB
- github.com/harttle/liquidjs/security/advisories/GHSA-mmg9-6m6j-jqqxnvdExploitVendor AdvisoryWEB
- github.com/advisories/GHSA-mmg9-6m6j-jqqxghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2026-34166ghsaADVISORY
- github.com/harttle/liquidjs/releases/tag/v10.25.3nvdRelease NotesWEB
News mentions
0No linked articles in our index yet.