{"id":"CVE-2026-40262","aliases":["CVE-2026-40262","GHSA-9pr4-rf97-79qh","GO-2026-5295"],"related":[],"kind":"vulnerability","state":"published","title":"Note Mark has Stored XSS via Unrestricted Asset Upload","summary":"Note Mark is an open-source note-taking application. In versions 0.19.1 and prior, the asset delivery handler serves uploaded files inline and relies on magic-byte detection for content type, which does not identify text-based formats such as HTML, SVG, or XHTML. These files are served with an empty Content-Type, no X-Content-Type-Options: nosniff header, and inline disposition, allowing browsers to sniff and render active content. An authenticated user can upload an HTML or SVG file containing JavaScript as a note asset, and when a victim navigates to the asset URL, the script executes under the application's origin with access to the victim's authenticated session and API actions. This issue has been fixed in version 0.19.2.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Note Mark is an open-source note-taking application. In versions 0.19.1 and prior, the asset delivery handler serves uploaded files inline and relies on magic-byte detection for content type, which does not identify text-based formats such as HTML, SVG, or XHTML. These files are served with an empty Content-Type, no X-Content-Type-Options: nosniff header, and inline disposition, allowing browsers to sniff and render active content. An authenticated user can upload an HTML or SVG file containing JavaScript as a note asset, and when a victim navigates to the asset URL, the script executes under the application's origin with access to the victim's authenticated session and API actions. This issue has been fixed in version 0.19.2.","source":"cvelist"},{"lang":"en","text":"### Summary\nA 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.\n\n### Details\nThis issue results from three compounding flaws in the asset handling and delivery path.\n\n#### 1. Asset delivery can be used as an attack vector\nThe asset delivery route can be used to deliver attacker-controlled uploaded content directly to a victim by URL.\n\nRelevant route:\n- `handlers/assets.go:40`\n\n```go\nhuma.Get(api, \"/api/notes/{noteID}/assets/{assetID}\", h.GetNoteAssetContentByID)\n```\n\nThis makes the uploaded asset reachable by direct navigation, which provides the delivery mechanism for the payload.\n\n#### 2. Text-based active content is served with an empty `Content-Type`\nThe asset handler relies on `h2non/filetype` for content-type detection:\n\n- `handlers/assets.go:147`\n\n```go\nkind, _ := filetype.Match(buf)\nif kind != filetype.Unknown {\n    contentType = kind.MIME.Value\n}\n```\n\nThe 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.\n\nAs a result, uploaded active content is served without an authoritative MIME type.\n\n#### 3. Files are rendered inline and sniffed by the browser\nThe asset response is sent with inline disposition:\n\n- `handlers/assets.go:153`\n\n```go\nw.Header().Set(\"Content-Disposition\", fmt.Sprintf(\"inline; filename=\\\"%s\\\"\", asset.Name))\n```\n\nAt the same time, the response does not set:\n\n```http\nX-Content-Type-Options: nosniff\n```\n\nThis combination is dangerous:\n- the uploaded file contains attacker-controlled active markup\n- the browser is instructed to render it inline\n- the response does not provide a trustworthy content type\n- content sniffing is not disabled\n\nUnder 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.\n\nThis turns an uploaded asset into a stored XSS payload that executes when a victim opens the asset URL.\n\n### PoC\nThe 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.\n\n### Impact\n- **Type:** Stored same-origin cross-site scripting (XSS)\n- **Who is impacted:** Any user who can be induced to open a malicious asset URL, and any deployment allowing asset uploads\n- **Security impact:** An attacker can execute JavaScript in the victim’s authenticated application context, allowing access to private notes, books, profile data, and authenticated API actions\n- **Privileges required:** A valid low-privilege user account capable of uploading note assets\n- **User interaction:** Required, because the victim must navigate to the malicious asset URL\n- **Scope:** Changed, because attacker-controlled content executes in the victim’s origin and impacts other users rather than remaining confined to the attacker’s own account","format":"markdown","source":"ghsa"},{"lang":"en","text":"Note Mark has Stored XSS via Unrestricted Asset Upload in github.com/enchant97/note-mark/backend","format":"markdown","source":"go"},{"lang":"es","text":"Note Mark es una aplicación de código abierto para tomar notas. En las versiones 0.19.1 y anteriores, el gestor de entrega de activos sirve los archivos subidos en línea y se basa en la detección de bytes mágicos para el tipo de contenido, lo que no identifica formatos basados en texto como HTML, SVG o XHTML. Estos archivos se sirven con un Content-Type vacío, sin encabezado X-Content-Type-Options: nosniff y disposición en línea, lo que permite a los navegadores inferir y renderizar contenido activo. Un usuario autenticado puede subir un archivo HTML o SVG que contenga JavaScript como un activo de nota, y cuando una víctima navega a la URL del activo, el script se ejecuta bajo el origen de la aplicación con acceso a la sesión autenticada de la víctima y a las acciones de la API. Este problema ha sido corregido en la versión 0.19.2.","source":"nvd"}],"published":"2026-04-13T19:23:08.000Z","modified":"2026-10-26T21:10:00.170Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N","score":8.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N","score":8.7,"rating":"HIGH"}],"cwes":["CWE-79","CWE-434"],"affected":[{"ranges":[{"version":"< 0.19.2","status":"affected"}],"vendor":"enchant97","product":"note-mark","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.0.0-20260411145018-6bb62842ccb9"}],"ecosystem":"Go","package":"github.com/enchant97/note-mark/backend","purl":"pkg:golang/github.com/enchant97/note-mark/backend","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.0.0-20260411145018-6bb62842ccb9"}],"ecosystem":"Go","package":"github.com/enchant97/note-mark/backend","purl":"pkg:golang/github.com/enchant97/note-mark/backend","source":"go"}],"references":[{"url":"https://github.com/enchant97/note-mark/security/advisories/GHSA-9pr4-rf97-79qh","tags":["advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/enchant97/note-mark/commit/6bb62842ccb956870b9bf183629eba95e326e5e3","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/enchant97/note-mark/releases/tag/v0.19.2","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40262","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/enchant97/note-mark","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-04-18T02:50:12.436Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-40262","url":"https://www.cve.org/CVERecord?id=CVE-2026-40262","licence":"CVE Terms of Use","modified":"2026-04-18T02:51:02.474Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9pr4-rf97-79qh","url":"https://github.com/advisories/GHSA-9pr4-rf97-79qh","licence":"CC-BY-4.0","modified":"2026-06-25T19:56:17.504Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5295","url":"https://pkg.go.dev/vuln/GO-2026-5295","licence":"CC-BY-4.0","modified":"2026-06-25T19:45:27.576Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-40262","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40262","licence":"Public domain","modified":"2026-10-26T21:10:00.170Z"}],"updatedAt":"2026-11-25T22:59:18.925Z","epss":{"score":0.00315,"percentile":0.26283,"date":"2026-12-02T12:00:21.000Z"}}