Summary
NocoDB has a stored cross-site scripting vulnerability involving crafted attachment MIME types. An authenticated Editor may be able to store a value that causes an attachment to be served as inline HTML, allowing scripts to run when a victim opens its signed download URL.
Affected context
The vulnerability affects NocoDB deployments with the vulnerable attachment-handling behavior. It involves MIME type values written through the records API and attachments served through /dltemp signed URLs. Risk depends on an attacker being able to create or modify affected records and a victim opening the resulting URL.
Exploit preconditions
- Attack surface: Record creation or modification and attachment delivery through
/dltemp - Required access: An authenticated account with Editor privileges to write crafted MIME type values
- Trigger point: A victim opens the signed attachment URL, which serves the content inline as HTML
- Why exploitation is possible: The stored MIME type can cause attacker-controlled content to be interpreted as active HTML in a browser
Why this happens
The underlying issue is inadequate handling of untrusted attachment metadata and content when determining how a browser should render a response. If a crafted MIME type results in content being served as active HTML, browser-executed script can run in the application's security context. This is a stored cross-site scripting flaw under CWE-79: Improper Neutralization of Input During Web Page Generation.
Potential impact
- Malicious scripts may run in a victim's browser when an affected URL is opened
- Session tokens stored in browser localStorage could be exposed
- An attacker could use stolen tokens to impersonate affected users
- Victim accounts and data accessible to those users could be compromised
General mitigation guidance
Defensive patterns focus on treating attachment metadata and content as untrusted:
- Derive or strictly validate MIME types rather than trusting values supplied through record APIs
- Serve untrusted attachments as downloads or from an isolated origin instead of rendering them inline
- Apply appropriate content-type and browser security headers, including controls that limit script execution
- Encode or sanitize data wherever it is rendered in browser-accessible contexts
- Limit Editor permissions and protect session credentials from exposure to client-side scripts
How teams detect issues like this
- Use static analysis to identify flows from user-controlled MIME metadata to response headers or inline rendering decisions
- Review attachment-serving code for trusted handling of content type, disposition, and browser security headers
- Monitor for unusual attachment MIME values and unexpected inline HTML responses from download endpoints
- Enforce policies that require untrusted files to be served from isolated origins or as downloads
- Include stored-XSS checks in security reviews and automated application testing

