Summary
Note Mark's asset delivery handler can serve user-uploaded HTML and SVG files without a proper Content-Type or nosniff protection, allowing browsers to treat them as executable documents.
An authenticated attacker can upload active content (for example, HTML or SVG with JavaScript) and trick a victim into visiting the asset URL, leading to stored cross-site scripting under the Note Mark origin with access to the victim's authenticated session and API capabilities.
Affected context
This vulnerability arises in Note Mark deployments that:
- Allow authenticated users to upload note assets (attachments),
- Use the asset delivery handler that serves files inline,
- Rely on magic-byte detection for content type, which does not classify HTML/SVG/XHTML as text-based formats,
- Return these files with an empty
Content-Type, noX-Content-Type-Options: nosniff, and inline disposition.
In that context, browsers are free to sniff and interpret uploaded HTML or SVG as active web documents, running attacker-supplied JavaScript in the context of the Note Mark application.
Exploit preconditions
- Attack surface: HTTP(S) asset URLs served by the Note Mark instance.
- Required access: An attacker must have an authenticated account with permission to upload note assets.
- User interaction: A victim must open or be redirected to the attacker-controlled asset URL (for example, via a shared link, embedded reference, or social engineering).
- Trigger point: The browser requests the uploaded file, receives it with no
Content-Typeand noX-Content-Type-Options: nosniff, and then performs content sniffing. - Why exploitation is possible: Because the server does not explicitly identify the file type or prevent sniffing, the browser may treat HTML/SVG/XHTML uploads as web pages or scripts, allowing embedded JavaScript to execute under the Note Mark origin.
Why this happens
The root cause is a combination of:
- CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting): User-controlled content (HTML/SVG) is delivered in a way that allows it to be interpreted as part of the web application's active content, rather than as a passive download.
- CWE-434: Unrestricted Upload of File with Dangerous Type: Uploaded files capable of executing script in the browser are not restricted, transformed, or safely delivered.
The asset delivery handler:
- Serves user uploads inline instead of as downloads,
- Relies on magic-byte detection that does not correctly identify text-based active formats,
- Omits explicit
Content-Typeand protective headers such asX-Content-Type-Options: nosniff.
This abstractly represents an insecure pattern where file upload endpoints allow active content to be hosted and executed from the same origin as the application, enabling stored XSS.
Potential impact
- Theft or misuse of the victim's authenticated session within the Note Mark application.
- Unauthorized execution of API actions on behalf of the victim, such as reading, modifying, or deleting notes.
- Exfiltration of sensitive data stored in the application, including private notes or shared workspaces.
- Cross-account attack paths, where compromised accounts are used to propagate additional malicious content or links.
- Potential pivoting into integrated services if the application exposes connectors or webhooks tied to the user's identity.
General mitigation guidance
Effective mitigations focus on hardening file upload handling and output contexts so that user content cannot be executed as active code:
- Serve uploads as passive content: Prefer
Content-Disposition: attachmentfor untrusted file types, especially HTML, SVG, XHTML, and other active formats. - Set explicit, conservative Content-Type: Do not leave
Content-Typeempty; use explicit types and avoid serving untrusted files as HTML or other executable types. - Enforce
X-Content-Type-Options: nosniff: Prevent browsers from content-sniffing and interpreting arbitrary uploads as executable documents. - Restrict dangerous file types: Consider blocking or transforming uploads that can host script (e.g., HTML, SVG, XHTML) when they are not strictly required.
- Isolate user content origins: Where possible, serve uploaded files from a separate domain or origin that does not share authentication or powerful APIs with the main application.
- Apply least-privilege access to APIs: Design client-side APIs so that a single authenticated session has only the minimum capabilities required for normal use, reducing impact if it is abused via XSS.
How teams detect issues like this
Detection efforts can combine review of HTTP behavior, code paths, and security policies:
- Code review signals:
- Asset or upload handlers that return inline content without strict
Content-Typehandling. - Absence of
X-Content-Type-Options: nosniffon responses serving user-uploaded files. - Logic that permits HTML, SVG, or similar file types to be uploaded without transformation or isolation.
- Static analysis patterns:
- Rules flagging endpoints that serve arbitrary files from user-controlled locations.
- Checks for uses of content-type detection that may default to unknown or empty types.
- Runtime and configuration checks:
- Security scanners that crawl the app, upload test payloads, and verify how uploads are served.
- HTTP response inspection in staging environments to ensure headers and MIME types are correctly set for user content.
- Policy enforcement:
- CI/CD gates that require explicit MIME handling and security headers for routes serving uploaded content.

