A stored same-origin XSS vulnerability allows any authenticated user to upload an HTML, SVG, or XHTML file as a note asset and have it executed in a victim’s browser under the application’s origin. Because the application serves these files inline without a safe content type and without nosniff, browsers can sniff and render active content, giving the attacker access to authenticated Note Mark API actions as the victim.
This issue results from three compounding flaws in the asset handling and delivery path.
The asset delivery route can be used to deliver attacker-controlled uploaded content directly to a victim by URL.
Relevant route:
- handlers/assets.go:40
huma.Get(api, "/api/notes/{noteID}/assets/{assetID}", h.GetNoteAssetContentByID)
This makes the uploaded asset reachable by direct navigation, which provides the delivery mechanism for the payload.
Content-TypeThe asset handler relies on h2non/filetype for content-type detection:
handlers/assets.go:147kind, _ := filetype.Match(buf)
if kind != filetype.Unknown {
contentType = kind.MIME.Value
}
The detection library uses magic-byte matching and does not identify text-based formats such as HTML, SVG, JavaScript, XML, or XHTML. For those files, filetype.Match returns Unknown, leaving Content-Type unset or empty.
As a result, uploaded active content is served without an authoritative MIME type.
The asset response is sent with inline disposition:
handlers/assets.go:153w.Header().Set("Content-Disposition", fmt.Sprintf("inline; filename=\"%s\"", asset.Name))
At the same time, the response does not set:
X-Content-Type-Options: nosniff
This combination is dangerous:
- the uploaded file contains attacker-controlled active markup
- the browser is instructed to render it inline
- the response does not provide a trustworthy content type
- content sniffing is not disabled
Under these conditions, browsers may detect HTML or SVG content and execute embedded JavaScript. Because the asset is served from the application’s own origin, the script runs with same-origin access to the application and its authenticated APIs.
This turns an uploaded asset into a stored XSS payload that executes when a victim opens the asset URL.
The issue can be reproduced by uploading a text-based active content file such as HTML or SVG as a note asset, then opening the served asset URL in a browser and observing that script executes in the context of the application origin.
| Score | Percentile |
|---|---|
| 0.01% | 1.26% |
| Base score | Version | Severity | Vector |
|---|---|---|---|
| 8.7 | 3.1 | — |
|
| Type | Value |
|---|---|
| GHSA | GHSA-9pr4-rf97-79qh ↗ |
| CVE | CVE-2026-40262 ↗ |
Vulnerable version ranges and first patched releases as published by GitHub.
| Ecosystem | Package | Vulnerable range | First patched | Vulnerable functions |
|---|---|---|---|---|
| go | github.com/enchant97/note-mark/backend | < 0.0.0-20260411145018-6bb62842ccb9 | 0.0.0-20260411145018-6bb62842ccb9 | — |