KEVWire

Security intelligence, with context.

Response snapshot Oct 27, 2026, 16:01 UTC

Back to the wire
Permalink
VulnerabilityCVE-2026-44644

LiquidJS's strip_html filter bypass via newline characters in HTML tags enables XSS

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.

At a glance

Exploited
Not known
Severity
6.1 Medium (CVSS 3.1)
Chance of exploitation
Not estimated
Sources
1 source

What to do

GitHub lists first patched versions: liquidjs: 10.26.0. Confirm the affected range and upgrade guidance in the exact advisory.

Read GitHub-reviewed advisory GHSA-2qv6-9wx5-cwv4 (opens a new tab)

What happened

## 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.

` `) 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

Continue reading

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(/ | | | /g, '') } ```

The regex has four alternations: 1. ` ` — uses `[\s\S]`, matches across newlines. 2. ` ` — uses `[\s\S]`, matches across newlines. 3. ` ` — uses `.`, which in JavaScript does **not** match `\n` or `\r` (no `s`/dotAll flag set). 4. ` ` — 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 ` ` 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 ` `. - `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 ` `, ` `, 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: ' ' } ).then(r => console.log(JSON.stringify(r))); " ```

Verified output:

``` "Safe output: " ```

The ` ` 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 (` `, ` `, ` `, etc.) and is not specific to ` `.

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: ' ' } ).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 ` ` (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(/ | | | /g, '') } ```

Equivalent fix using the dotAll flag (requires ES2018+, which liquidjs already targets):

```ts return str.replace(/ | | | /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.

Affected package ranges reported by GitHub: liquidjs: < 10.26.0

Scores and how they were measured

CVSS base severity

6.1

Version 3.1As of

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Measurement source (opens a new tab)

How bad it is if exploited. Not a prediction of exploitation or proof you are exposed.

EPSS probability

Not available

A model's estimate of exploitation in the next 30 days, not certainty or your own risk.

Related technology

Sources

  1. Primary source

    GitHub-reviewed advisory GHSA-2qv6-9wx5-cwv4 (opens a new tab)

    The public advisory supplies the description, affected package/version ranges, and any listed CVSS metric. GitHub review is not local review.

    Published Checked

  2. Primary source

    GitHub public advisory API page (opens a new tab)

    The API page supplied GHSA-2qv6-9wx5-cwv4, its actual identifiers, source dates, and structured metrics.

    Published Date not suppliedChecked

Cite this record

For factual claims, cite the primary sources above; cite KEVWire for its compilation, dates, and classifications.

APA

KEVWire. (2026, October 27). LiquidJS's strip_html filter bypass via newline characters in HTML tags enables XSS (CVE-2026-44644). https://kevwire.com/record/CVE-2026-44644

MLA

"LiquidJS's strip_html filter bypass via newline characters in HTML tags enables XSS (CVE-2026-44644)." KEVWire, 27 Oct. 2026, kevwire.com/record/CVE-2026-44644.

Chicago

KEVWire. "LiquidJS's strip_html filter bypass via newline characters in HTML tags enables XSS (CVE-2026-44644)." Last modified October 27, 2026. https://kevwire.com/record/CVE-2026-44644.

Evidence summary (plain text)

LiquidJS's strip_html filter bypass via newline characters in HTML tags enables XSS (May 27, 2026).
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. ` `) 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.

The vulnerable code is in `src/filters/html.ts`:
CVSS 6.1 (version 3.1; evidence as of Oct 27, 2026; https://github.com/advisories/GHSA-2qv6-9wx5-cwv4).
Sources:
GitHub-reviewed advisory GHSA-2qv6-9wx5-cwv4: https://github.com/advisories/GHSA-2qv6-9wx5-cwv4
GitHub public advisory API page: https://api.github.com/advisories?type=reviewed&per_page=100&sort=updated&direction=desc
Record ID: CVE-2026-44644.
Record origin: Ingested record.
AI evidence: Not assessed.
Known exploitation: Not assessed.
Zero-day status: Not assessed. KEV membership alone does not establish zero-day status.
About this data

This record was ingested from a data source. Retrieved: Oct 27, 2026, 16:00 UTC. Ingestion is not an independent editorial investigation.

A CISA KEV listing documents known exploitation, not necessarily a zero-day; absence from the catalog does not prove a vulnerability has never been exploited.

Technology tags indicate possible relevance, not verified exposure. Confirm the affected product, version, and configuration against your own inventory; KEVWire does not scan your systems.

A personal reading checklist on this device, not verified remediation.

Record JSON

Your account

Email alerts

Email alerts are not available yet. To follow your stack today, use its RSS feed, which honors your filters, or connect an AI agent through the API.

Suggest an improvement

Ideas, missing sources, corrections, and bugs are all welcome. No account needed. Suggestions are reviewed by a person before anything changes.

Record details

Record detail