GHSA-9PR4-RF97-79QH

Vulnerability from github – Published: 2026-04-13 19:23 – Updated: 2026-04-24 20:37
VLAI
Summary
Note Mark has Stored XSS via Unrestricted Asset Upload
Details

Summary

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.

Details

This issue results from three compounding flaws in the asset handling and delivery path.

1. Asset delivery can be used as an attack vector

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.

2. Text-based active content is served with an empty Content-Type

The asset handler relies on h2non/filetype for content-type detection:

  • handlers/assets.go:147
kind, _ := 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.

3. Files are rendered inline and sniffed by the browser

The asset response is sent with inline disposition:

  • handlers/assets.go:153
w.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.

PoC

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.

Impact

  • Type: Stored same-origin cross-site scripting (XSS)
  • Who is impacted: Any user who can be induced to open a malicious asset URL, and any deployment allowing asset uploads
  • 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
  • Privileges required: A valid low-privilege user account capable of uploading note assets
  • User interaction: Required, because the victim must navigate to the malicious asset URL
  • 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
Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/enchant97/note-mark/backend"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.0.0-20260411145018-6bb62842ccb9"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-40262"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-434",
      "CWE-79"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-04-13T19:23:08Z",
    "nvd_published_at": "2026-04-17T01:17:39Z",
    "severity": "HIGH"
  },
  "details": "### 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\u2019s browser under the application\u2019s 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\u2019s 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\u2019s 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\u2019s origin and impacts other users rather than remaining confined to the attacker\u2019s own account",
  "id": "GHSA-9pr4-rf97-79qh",
  "modified": "2026-04-24T20:37:42Z",
  "published": "2026-04-13T19:23:08Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/enchant97/note-mark/security/advisories/GHSA-9pr4-rf97-79qh"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-40262"
    },
    {
      "type": "WEB",
      "url": "https://github.com/enchant97/note-mark/commit/6bb62842ccb956870b9bf183629eba95e326e5e3"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/enchant97/note-mark"
    },
    {
      "type": "WEB",
      "url": "https://github.com/enchant97/note-mark/releases/tag/v0.19.2"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Note Mark has Stored XSS via Unrestricted Asset Upload"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.