Skip to main content

LiquidJS CVE-2026-44644

MEDIUM
Cross-site Scripting (XSS) (CWE-79)
2026-05-27 https://github.com/harttle/liquidjs GHSA-2qv6-9wx5-cwv4
6.1
CVSS 3.1 · Vendor: https://github.com/harttle/liquidjs
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Attacker submits newline-embedded HTML tag as user input
  2. Delivery
    Application stores or reflects input through LiquidJS strip_html filter
  3. Exploit
    Regex catch-all branch misses tag due to missing dotAll flag
  4. Install
    Unsanitized tag written verbatim to HTML response (no outputEscape)
  5. C2
    Victim loads page in browser
  6. Execute
    Browser parses newline-containing tag as valid HTML element
  7. Impact
    Event handler executes attacker JavaScript in application origin
  8. Step 8
    Session cookie or credentials exfiltrated

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires three concurrent conditions: (1) the application uses LiquidJS as a server-side template engine and applies the strip_html filter to attacker-controlled string input via a pattern such as {{ userInput | strip_html }}, treating the filter as a security boundary against HTML injection; (2) the application does not separately HTML-escape the filter's output - the default behavior, since the outputEscape engine option is undefined in LiquidJS's default configuration (src/liquid-options.ts); and (3) the rendered output is written into an HTML context where a victim's browser will parse and execute tag content. The attacker must be able to inject a payload containing a literal newline (\n), carriage return (\r), or CRLF (\r\n) sequence inside an HTML tag's angle brackets. No authentication is required from the attacker (CVSS PR:N). Exploitation is bounded by UI:R - a victim must load the page containing the attacker's payload in a browser. Applications that use the escape filter instead of strip_html, or that apply separate server-side HTML sanitization, are not affected regardless of LiquidJS version.

Impact

CVSS 6.1 (AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N) reflects network-reachable, unauthenticated exploitation with low complexity requiring only victim interaction. The Scope:Changed indicator captures cross-origin impact - the attacker's JavaScript runs in the victim's browser origin, enabling cookie exfiltration, session hijacking, and CSRF using origin-scoped credentials. The moderate CVSS score undersells real-world risk for several reasons: a working PoC is confirmed against the current release (10.25.7) in the GHSA advisory; the payload requires only a literal newline with no exotic encoding; LiquidJS is documented as the sanitization filter for HTML stripping and is one of the most widely deployed Liquid implementations on npm (millions of downloads per week), making the vulnerable pattern ({{ userInput | strip_html }}) the natural, recommended developer usage. No CISA KEV listing exists at time of analysis, and no EPSS score was available in the provided data - active in-the-wild exploitation is not confirmed by an authoritative source. The primary limiting factor is UI:R: a victim must load a page containing the attacker's payload, a condition routinely satisfied in any web application rendering user-generated content. No patch is currently available, leaving all deployed instances of LiquidJS through 10.25.7 exposed.

Exploit ScenarioDerived

An attacker submits a user profile bio or comment field containing <img\nsrc=x\nonerror=alert(document.cookie)> to a web application that stores and renders user-generated content using LiquidJS with the template pattern {{ bio | strip_html }}. Because the newline character causes the catch-all regex branch to miss the tag entirely, the raw img element is written verbatim into the HTML response with no secondary escaping. When a victim user or administrator views the profile page, their browser parses the img tag as valid HTML, triggers the onerror event handler, and the attacker's JavaScript executes in the application's origin - exfiltrating the victim's session cookie. Publicly available exploit code in the GHSA advisory confirms this payload works against the current release.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – May 27, 2026

XSS sanitizer bypass in LiquidJS's strip_html filter (all versions through 10.25.7) allows stored or reflected cross-site scripting via newline-embedded HTML tags. The filter's catch-all regex branch uses JavaScript's dot operator without the dotAll flag, causing tags containing literal newline or carriage-return characters (e.g., <img\nsrc=x\nonerror=alert(1)>) to pass through unmodified - while browsers parse such tags as fully valid HTML elements and execute embedded event handlers. Publicly available exploit code exists; no vendor-released patch has been identified at time of analysis.

RemediationAI

No vendor-released patch has been identified at time of analysis. The code-level fix requires changing <.*?> to <[\s\S]*?> in the strip_html regex in src/filters/html.ts, or applying the JavaScript dotAll flag (s) to the entire regex - both approaches are explicitly documented in the advisory at https://github.com/harttle/liquidjs/security/advisories/GHSA-2qv6-9wx5-cwv4. As an immediate compensating control, replace all uses of {{ input | strip_html }} in security-sensitive contexts with the escape filter ({{ input | escape }}), which HTML-encodes output rather than attempting tag stripping, eliminating the bypass entirely at the cost of displaying encoded HTML entities to end users rather than rendered output. Alternatively, apply a server-side HTML sanitizer (such as DOMPurify via jsdom on the server) before passing content to LiquidJS, accepting the added dependency and processing overhead. Restricting user input at ingestion to block newline characters within angle-bracket sequences is a fragile control given multiple CR/LF encoding variations and should not be relied upon as a sole defense. Monitor the upstream repository at https://github.com/harttle/liquidjs for a patched release.

Affected Packages

npm liquidjs fix: 10.26.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The vulnerability is in src/filters/html.ts within the npm package liquidjs (pkg:npm/liquidjs). The strip_html filter applies a four-branch regex to remove HTML tags: branches for script blocks, style blocks, and HTML comments all use [\s\S] to match across line terminators, but the catch-all branch - responsible for stripping any other HTML tag - uses <.*?>, where JavaScript's . operator does not match \n or \r unless the dotAll (s) flag is set. This flag is absent from the regex. The HTML specification (CWE-79: Improper Neutralization of Input During Web Page Generation) permits ASCII whitespace, including newlines, between attribute names and values, so browsers parse <img\nsrc=x\nonerror=alert(1)> as a valid img element with an executing onerror handler. Compounding this, LiquidJS's default engine configuration leaves outputEscape undefined (src/liquid-options.ts), meaning filter output is not auto-escaped before being written into HTML responses. The inconsistency is internal to the same regex - the other three branches correctly handle multi-line content, while only the catch-all was missed.

Know when Node.js gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/harttle/liquidjs) PRIMARY 6.1 MEDIUM
AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Primary rating from Vendor (https://github.com/harttle/liquidjs) · only source for this CVE.

CVSS VectorVendor: https://github.com/harttle/liquidjs

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

DescriptionCVE.org

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.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 14 npm packages depend on liquidjs (7 direct, 7 indirect)

Ecosystem-wide dependent count for version 10.26.0.

Threat Intelligence Overview

EPSS Score
0.0%
Top 90% exploitable
Threat Intel
1
1 source
Data Quality
5 sources
Confidence: Medium
NVD CVE.org EPSS GHSA GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

Cross-Site Request Forgery exploits the automatic credential inclusion behavior of web browsers.

Affected Products (CPE)CVE.org

pkg:npm/liquidjs
CVE-2025-68613 HIGH POC
8.8 Dec 19

Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation

CVE-2024-41713 CRITICAL POC
9.1 Oct 21

A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could

CVE-2024-55591 CRITICAL POC
9.8 Jan 14

FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote

CVE-2023-44487 HIGH POC
7.5 Oct 10

Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour

CVE-2014-7205 CRITICAL POC
10.0 Oct 08

Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t

CVE-2025-59528 CRITICAL POC
10.0 Sep 22

Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete

CVE-2017-14849 HIGH POC
7.5 Sep 28

Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc

CVE-2017-5941 CRITICAL POC
9.8 Feb 09

An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2014-3744 HIGH POC
7.5 Oct 23

Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi

CVE-2014-9566 HIGH POC
7.5 Mar 10

Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin

CVE-2024-35286 CRITICAL POC
9.8 Oct 21

A vulnerability in NuPoint Messenger (NPM) of Mitel MiCollab through 9.8.0.33 allows an unauthenticated attacker to cond

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy