CVE-2026-44644: Liquidjs Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-2qv6-9wx5-cwv4
CVSS 6.1
CWE-79
Published
Advisory Summary

CVE-2026-44644 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Liquidjs libraries in the npm ecosystem. The issue involves liquidjs's strip_html filter bypass via newline characters in html tags enables xss. Remediation is available in the latest vendor maintenance releases.

CVE-2026-44644 at a Glance

CVE Identifier CVE-2026-44644
GHSA Identifier GHSA-2qv6-9wx5-cwv4
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Liquidjs
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-44644

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: Latest secure release
npm install liquidjs@Latest secure release
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-44644, 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 the patched release), 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. 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 `strip_html` filter in liquidjs is intended to remove HTML tags from a string before rendering, and is widely used as an XSS sanitizer. The implementation uses a regex whose catch-all branch (`<.*?>`) does not match line terminators, so any HTML tag containing a `\n` or `\r` character passes through unmodified. An attacker who can place a newline inside a tag (e.g. `<img\nsrc=x\nonerror=alert(1)>`) bypasses sanitization entirely, since browsers treat newlines as whitespace within a tag and execute the resulting `onerror`/`onload`/etc. handler. This results in stored or reflected XSS in any application that relies on `strip_html` to neutralize untrusted HTML. ## Details The vulnerable code is in `src/filters/html.ts`: ```ts // src/filters/html.ts:45-49 export function strip_html (this: FilterImpl, v: string) { const str = stringify(v) this.context.memoryLimit.use(str.length) return str.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<.*?>|<!--[\s\S]*?-->/g, '') } ``` The regex has four alternations: 1. `<script[\s\S]*?<\/script>` — uses `[\s\S]`, matches across newlines. 2. `<style[\s\S]*?<\/style>` — uses `[\s\S]`, matches across newlines. 3. `<.*?>` — uses `.`, which in JavaScript does **not** match `\n` or `\r` (no `s`/dotAll flag set). 4. `<!--[\s\S]*?-->` — uses `[\s\S]`, matches across newlines. Branch 3 is the catch-all for "any other tag." Because `.` excludes line terminators, a tag containing a newline does not match any alternative. The literal characters of the tag are passed through to the output. Browsers, however, parse HTML tag content with whitespace tolerance: per the HTML spec, attribute names and values may be separated by ASCII whitespace, which includes `\n` and `\r`. So `<img\nsrc=x\nonerror=alert(1)>` is parsed as a valid `img` element with an `onerror` handler. `liquidjs`' default rendering pipeline does not auto-escape filter output (the `outputEscape` engine option is undefined by default — see `src/liquid-options.ts`), so the unescaped HTML is delivered verbatim to the consumer's HTML response. Trust path: - Application receives untrusted input (e.g. user comment field). - Developer renders it as `{{ comment | strip_html }}` to "safely" embed user content as plaintext. - Attacker submits `<img\u000Asrc=x\u000Aonerror=alert(document.cookie)>`. - `strip_html` returns the input unchanged. - Output is written into the HTML response with no further escaping. - Victim's browser executes the attacker's JavaScript in the application's origin. This is an inconsistency bug: the same regex correctly uses `[\s\S]` for `<script>`, `<style>`, and comment branches, but reverts to `.` for the catch-all. The other branches' authors clearly knew to handle multi-line content; the catch-all was missed. ## PoC Reproduces against current HEAD (10.25.7) using the published `dist/liquid.node.js` build: ```bash node -e " const { Liquid } = require('./dist/liquid.node.js'); const engine = new Liquid(); engine.parseAndRender( 'Safe output: {{ input | strip_html }}', { input: '<img\nsrc=x\nonerror=\"alert(document.cookie)\">' } ).then(r => console.log(JSON.stringify(r))); " ``` Verified output: ``` "Safe output: <img\nsrc=x\nonerror=\"alert(document.cookie)\">" ``` The `<img ... onerror=...>` tag is delivered to the output completely unmodified. When this string is placed into an HTML document and parsed by a browser, the `onerror` handler executes. Same bypass works with `\r` (carriage return), `\r\n`, or any combination of CR/LF inside the tag. It also works with other event-handler vectors (`<svg\nonload=alert(1)>`, `<body\nonload=alert(1)>`, `<iframe\nsrc="javascript:alert(1)">`, etc.) and is not specific to `<img>`. For comparison, the same input without a newline is correctly stripped: ```bash node -e " const { Liquid } = require('./dist/liquid.node.js'); const engine = new Liquid(); engine.parseAndRender( 'Safe output: {{ input | strip_html }}', { input: '<img src=x onerror=\"alert(1)\">' } ).then(r => console.log(JSON.stringify(r))); " # → "Safe output: " ``` This confirms `strip_html` is intended to remove tags of this shape, and the newline form is a sanitizer bypass rather than expected behavior. ## Impact Any liquidjs-using application that: 1. Renders attacker-controlled strings via `{{ x | strip_html }}` to defend against HTML injection, AND 2. Does not separately HTML-escape that output (default behavior — `outputEscape` is unset by default), Is vulnerable to stored or reflected XSS. The attacker can execute arbitrary JavaScript in the victim's browser in the application's origin, enabling session theft, account takeover, CSRF with origin-scoped credentials, and arbitrary actions in the victim's authenticated session. The XSS is triggered with simple, well-known event-handler payloads — no exotic encoding, no character set tricks, just a literal newline inside the tag. The blast radius matches the deployment of liquidjs as a server-side template engine: liquidjs is one of the most popular Liquid implementations on npm (millions of downloads/week) and `strip_html` is documented as the sanitization filter for HTML stripping, so the vulnerable pattern (`{{ user | strip_html }}`) is the natural and recommended use of the filter. ## Recommended Fix Replace `<.*?>` with `<[\s\S]*?>` (or apply the `s`/dotAll flag to the entire regex) so the catch-all branch matches across line terminators, consistent with the other branches: ```ts // src/filters/html.ts export function strip_html (this: FilterImpl, v: string) { const str = stringify(v) this.context.memoryLimit.use(str.length) return str.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<[\s\S]*?>|<!--[\s\S]*?-->/g, '') } ``` Equivalent fix using the dotAll flag (requires ES2018+, which liquidjs already targets): ```ts return str.replace(/<script.*?<\/script>|<style.*?<\/style>|<.*?>|<!--.*?-->/gs, '') ``` After the fix, the PoC input is correctly reduced to an empty string. Note that `strip_html` should still not be relied on as a primary XSS defense — the project README/documentation should recommend HTML-escaping (`escape` filter) for untrusted content rendered into HTML contexts. A brief security note in the filter's documentation would help users who currently treat `strip_html` as a sanitizer.

CVE-2026-44644 Affected Liquidjs Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
liquidjs
npm
≤ 10.25.7

References

Frequently Asked Questions

What is CVE-2026-44644?
CVE-2026-44644 is a security vulnerability in Liquidjs involving LiquidJS's strip_html filter bypass via newline characters in HTML tags enables XSS under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Liquidjs versions are affected?
Affected versions include releases prior to current release patches across affected packages: liquidjs.
What version fixes CVE-2026-44644?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is liquidjs affected?
Yes, liquidjs is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-44644?
CVE-2026-44644 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2026-44644?
CVE-2026-44644 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2026-44644?
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-2qv6-9wx5-cwv4",
  "modified" : "2026-07-09T21:06:10Z",
  "published" : "2026-05-27T00:09:12Z",
  "aliases" : [ "CVE-2026-44644" ],
  "summary" : "LiquidJS's strip_html filter bypass via newline characters in HTML tags enables XSS",
  "details" : "## Summary\n\nThe `strip_html` filter in liquidjs is intended to remove HTML tags from a string before rendering, and is widely used as an XSS sanitizer. The implementation uses a regex whose catch-all branch (`<.*?>`) does not match line terminators, so any HTML tag containing a `\\n` or `\\r` character passes through unmodified. An attacker who can place a newline inside a tag (e.g. `<img\\nsrc=x\\nonerror=alert(1)>`) bypasses sanitization entirely, since browsers treat newlines as whitespace within a tag and execute the resulting `onerror`/`onload`/etc. handler. This results in stored or reflected XSS in any application that relies on `strip_html` to neutralize untrusted HTML.\n\n## Details\n\nThe vulnerable code is in `src/filters/html.ts`:\n\n```ts\n// src/filters/html.ts:45-49\nexport function strip_html (this: FilterImpl, v: string) {\n  const str = stringify(v)\n  this.context.memoryLimit.use(str.length)\n  return str.replace(/<script[\\s\\S]*?<\\/script>|<style[\\s\\S]*?<\\/style>|<.*?>|<!--[\\s\\S]*?-->/g, '')\n}\n```\n\nThe regex has four alternations:\n1. `<script[\\s\\S]*?<\\/script>` — uses `[\\s\\S]`, matches across newlines.\n2. `<style[\\s\\S]*?<\\/style>` — uses `[\\s\\S]`, matches across newlines.\n3. `<.*?>` — uses `.`, which in JavaScript does **not** match `\\n` or `\\r` (no `s`/dotAll flag set).\n4. `<!--[\\s\\S]*?-->` — uses `[\\s\\S]`, matches across newlines.\n\nBranch 3 is the catch-all for \"any other tag.\" Because `.` excludes line terminators, a tag containing a newline does not match any alternative. The literal characters of the tag are passed through to the output.\n\nBrowsers, however, parse HTML tag content with whitespace tolerance: per the HTML spec, attribute names and values may be separated by ASCII whitespace, which includes `\\n` and `\\r`. So `<img\\nsrc=x\\nonerror=alert(1)>` is parsed as a valid `img` element with an `onerror` handler.\n\n`liquidjs`' default rendering pipeline does not auto-escape filter output (the `outputEscape` engine option is undefined by default — see `src/liquid-options.ts`), so the unescaped HTML is delivered verbatim to the consumer's HTML response.\n\nTrust path:\n- Application receives untrusted input (e.g. user comment field).\n- Developer renders it as `{{ comment | strip_html }}` to \"safely\" embed user content as plaintext.\n- Attacker submits `<img\\u000Asrc=x\\u000Aonerror=alert(document.cookie)>`.\n- `strip_html` returns the input unchanged.\n- Output is written into the HTML response with no further escaping.\n- Victim's browser executes the attacker's JavaScript in the application's origin.\n\nThis is an inconsistency bug: the same regex correctly uses `[\\s\\S]` for `<script>`, `<style>`, and comment branches, but reverts to `.` for the catch-all. The other branches' authors clearly knew to handle multi-line content; the catch-all was missed.\n\n## PoC\n\nReproduces against current HEAD (10.25.7) using the published `dist/liquid.node.js` build:\n\n```bash\nnode -e \"\nconst { Liquid } = require('./dist/liquid.node.js');\nconst engine = new Liquid();\nengine.parseAndRender(\n  'Safe output: {{ input | strip_html }}',\n  { input: '<img\\nsrc=x\\nonerror=\\\"alert(document.cookie)\\\">' }\n).then(r => console.log(JSON.stringify(r)));\n\"\n```\n\nVerified output:\n\n```\n\"Safe output: <img\\nsrc=x\\nonerror=\\\"alert(document.cookie)\\\">\"\n```\n\nThe `<img ... onerror=...>` tag is delivered to the output completely unmodified. When this string is placed into an HTML document and parsed by a browser, the `onerror` handler executes.\n\nSame bypass works with `\\r` (carriage return), `\\r\\n`, or any combination of CR/LF inside the tag. It also works with other event-handler vectors (`<svg\\nonload=alert(1)>`, `<body\\nonload=alert(1)>`, `<iframe\\nsrc=\"javascript:alert(1)\">`, etc.) and is not specific to `<img>`.\n\nFor comparison, the same input without a newline is correctly stripped:\n\n```bash\nnode -e \"\nconst { Liquid } = require('./dist/liquid.node.js');\nconst engine = new Liquid();\nengine.parseAndRender(\n  'Safe output: {{ input | strip_html }}',\n  { input: '<img src=x onerror=\\\"alert(1)\\\">' }\n).then(r => console.log(JSON.stringify(r)));\n\"\n# → \"Safe output: \"\n```\n\nThis confirms `strip_html` is intended to remove tags of this shape, and the newline form is a sanitizer bypass rather than expected behavior.\n\n## Impact\n\nAny liquidjs-using application that:\n1. Renders attacker-controlled strings via `{{ x | strip_html }}` to defend against HTML injection, AND\n2. Does not separately HTML-escape that output (default behavior — `outputEscape` is unset by default),\n\nIs vulnerable to stored or reflected XSS. The attacker can execute arbitrary JavaScript in the victim's browser in the application's origin, enabling session theft, account takeover, CSRF with origin-scoped credentials, and arbitrary actions in the victim's authenticated session. The XSS is triggered with simple, well-known event-handler payloads — no exotic encoding, no character set tricks, just a literal newline inside the tag.\n\nThe blast radius matches the deployment of liquidjs as a server-side template engine: liquidjs is one of the most popular Liquid implementations on npm (millions of downloads/week) and `strip_html` is documented as the sanitization filter for HTML stripping, so the vulnerable pattern (`{{ user | strip_html }}`) is the natural and recommended use of the filter.\n\n## Recommended Fix\n\nReplace `<.*?>` with `<[\\s\\S]*?>` (or apply the `s`/dotAll flag to the entire regex) so the catch-all branch matches across line terminators, consistent with the other branches:\n\n```ts\n// src/filters/html.ts\nexport function strip_html (this: FilterImpl, v: string) {\n  const str = stringify(v)\n  this.context.memoryLimit.use(str.length)\n  return str.replace(/<script[\\s\\S]*?<\\/script>|<style[\\s\\S]*?<\\/style>|<[\\s\\S]*?>|<!--[\\s\\S]*?-->/g, '')\n}\n```\n\nEquivalent fix using the dotAll flag (requires ES2018+, which liquidjs already targets):\n\n```ts\nreturn str.replace(/<script.*?<\\/script>|<style.*?<\\/style>|<.*?>|<!--.*?-->/gs, '')\n```\n\nAfter the fix, the PoC input is correctly reduced to an empty string. Note that `strip_html` should still not be relied on as a primary XSS defense — the project README/documentation should recommend HTML-escaping (`escape` filter) for untrusted content rendered into HTML contexts. A brief security note in the filter's documentation would help users who currently treat `strip_html` as a sanitizer.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "liquidjs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "10.25.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/harttle/liquidjs/security/advisories/GHSA-2qv6-9wx5-cwv4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-44644"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/harttle/liquidjs/commit/26ea2856c7a90aec892b98d94a9b7a3e18539045"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/harttle/liquidjs"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/harttle/liquidjs/releases/tag/v10.26.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-27T00:09:12Z",
    "nvd_published_at" : "2026-06-17T23:17:03Z"
  }
}