Summary
Waline's comment editor renders Markdown previews without sanitizing the resulting HTML, and editing a comment can load its raw body into the preview. If an administrator edits an attacker's comment, the content may execute in the administrator's browser session.
Affected context
The issue affects the @waline/client comment editor in Waline versions 3.15.2 and prior. It occurs when the editor displays a comment's raw body as a live preview using unsanitized rendered HTML. Administrators and comment owners can edit comments; an administrator who opens an attacker's comment for editing may trigger the vulnerable rendering path.
Exploit preconditions
- Attack surface: Waline's comment submission and editing interface
- Required access: An attacker can submit a comment; the attacker does not need administrator access
- Trigger point: An administrator opens the attacker's comment in the editor, causing its raw body to be rendered in the preview
- Why exploitation is possible: Markdown output is not sanitized before it is inserted into the page with
v-html
Why this happens
The editor converts comment content to HTML with a Markdown renderer and inserts the result into the page without sanitization. Seeding the editor with a comment's raw body exposes the same rendering path when an administrator edits that comment. This is a cross-site scripting flaw (CWE-79), with unsafe output handling also related to CWE-116: improperly encoded or sanitized data is interpreted as active browser content.
Potential impact
- Script execution could occur in an administrator's browser session
- An attacker may be able to perform actions available to the affected administrator
- Sensitive information accessible to that session could be exposed
- The site's integrity or administrative content could be affected
General mitigation guidance
Defensive patterns focus on treating all comment content as untrusted, including content shown in editing previews.
- Sanitize rendered Markdown with a well-maintained HTML sanitizer and a restrictive allowlist
- Prefer safe text rendering over raw HTML insertion when rich formatting is not required
- Apply context-appropriate output encoding at the point where content enters the DOM
- Keep preview rendering and edit-form initialization within the same sanitization boundary
- Limit administrative privileges and reduce the impact of actions performed from moderator sessions
How teams detect issues like this
- Use static analysis to identify unsanitized HTML insertion points such as
v-htmland trace whether their inputs are user-controlled - Review Markdown and rich-text rendering paths, especially editor previews and edit-form initialization
- Enforce code-review or CI policies requiring approved sanitization before HTML reaches the DOM
- Test previews with security-focused input cases and verify that active markup is neutralized
- Automated code review tools may help flag unsafe rendering patterns for manual assessment

