CVE-2026-40262: Github.com/enchant97/note mark/backend Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-9pr4-rf97-79qh
CVSS 8.7
CWE-434 CWE-79
Published
Advisory Summary

CVE-2026-40262 is a HIGH (CVSS 8.7) cross-site scripting vulnerability (CWE-434: Unrestricted Upload of File with Dangerous Type) affecting Github.com/enchant97/note mark/backend libraries in the Go ecosystem. The issue involves note mark has stored xss via unrestricted asset upload. Remediation is available by upgrading affected packages to version 0.0.0-20260411145018-6bb62842ccb9.

CVE-2026-40262 at a Glance

CVE Identifier CVE-2026-40262
GHSA Identifier GHSA-9pr4-rf97-79qh
Severity HIGH
CVSS v3.1 Base Score 8.7
CWE Classification CWE-434: Unrestricted Upload of File with Dangerous Type
Affected Product Github.com/enchant97/note mark/backend
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-40262

To remediate this vulnerability, upgrade all affected Github.com/enchant97/note mark/backend dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/enchant97/note-mark/backend fixed: 0.0.0-20260411145018-6bb62842ccb9
Upgrade github.com/enchant97/note-mark/backend to 0.0.0-20260411145018-6bb62842ccb9
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/enchant97/note-mark/backend

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-40262, inspect your project dependencies for Github.com/enchant97/note mark/backend:

inspect dependencies for github.com/enchant97/note-mark/backend

Analyze the terminal output to locate any version of Github.com/enchant97/note mark/backend in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20260411145018-6bb62842ccb9), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-434: Unrestricted Upload of File with Dangerous Type, where the product allows the upload or transfer of dangerous file types that are automatically processed within its environment. In Github.com/enchant97/note mark/backend, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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` ```go 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` ```go 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` ```go w.Header().Set("Content-Disposition", fmt.Sprintf("inline; filename=\"%s\"", asset.Name)) ``` At the same time, the response does not set: ```http 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

CVE-2026-40262 Affected Github.com/enchant97/note mark/backend Versions

1 component(s)
Fixed Versions:
0.0.0-20260411145018-6bb62842ccb9
Product / Package Ecosystem Affected Versions Fixed Version
github.com/enchant97/note-mark/backend
Go
< 0.0.0-20260411145018-6bb62842ccb9
0.0.0-20260411145018-6bb62842ccb9

References

Frequently Asked Questions

What is CVE-2026-40262?
CVE-2026-40262 is a security vulnerability in Github.com/enchant97/note mark/backend involving Note Mark has Stored XSS via Unrestricted Asset Upload under CWE-434: Unrestricted Upload of File with Dangerous Type.
Which Github.com/enchant97/note mark/backend versions are affected?
Affected versions include releases prior to 0.0.0-20260411145018-6bb62842ccb9 across affected packages: github.com/enchant97/note-mark/backend.
What version fixes CVE-2026-40262?
Upgrading to 0.0.0-20260411145018-6bb62842ccb9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/enchant97/note-mark/backend affected?
Yes, github.com/enchant97/note-mark/backend is affected in releases prior to 0.0.0-20260411145018-6bb62842ccb9. Upgrade your dependency to 0.0.0-20260411145018-6bb62842ccb9 or later.
What is the CVSS score of CVE-2026-40262?
CVE-2026-40262 has a CVSS v3.1 base score of 8.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2026-40262?
CVE-2026-40262 is classified under CWE-434: Unrestricted Upload of File with Dangerous Type (The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.).
How can I check Go dependencies for CVE-2026-40262?
Run the dependency tree command: 'inspect dependencies for github.com/enchant97/note-mark/backend'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9pr4-rf97-79qh",
  "modified" : "2026-04-24T20:37:42Z",
  "published" : "2026-04-13T19:23:08Z",
  "aliases" : [ "CVE-2026-40262" ],
  "summary" : "Note Mark has Stored XSS via Unrestricted Asset Upload",
  "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’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",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/enchant97/note-mark/backend"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20260411145018-6bb62842ccb9"
      } ]
    } ]
  } ],
  "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"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-434", "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-13T19:23:08Z",
    "nvd_published_at" : "2026-04-17T01:17:39Z"
  }
}