Summary
NocoDB's attachment handling mechanism allows authenticated users to upload SVG files that can contain executable JavaScript, which is later rendered inline in other users' browsers.
Because the payload is stored on the server and executed under NocoDB's origin, this stored XSS can lead to account compromise, data exfiltration, and unauthorized actions within the application.
Affected context
This vulnerability occurs in NocoDB instances where:
- Users are allowed to upload attachments, including SVG images
- Attachments are later displayed inline in the web UI without sufficient sanitization
- Sessions rely on browser-based authentication (e.g., cookies, local storage tokens)
The issue is most impactful in multi-user deployments where users can view each other's uploaded attachments, such as shared workspaces or collaborative database projects.
Exploit preconditions
- Attack surface: NocoDB web interface, specifically attachment upload and viewing functionality
- Required access: Authenticated user with permission to upload attachments to a workspace/table
- Trigger point: Another user (or admin) opens a page that renders the malicious SVG inline in their browser
- Why exploitation is possible: SVG uploads are treated as active content and rendered without robust sanitization or conversion, allowing embedded JavaScript to execute in the context of the NocoDB origin
Why this happens
The underlying issue maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting).
NocoDB accepts user-uploaded SVG files and later embeds them in the application UI without sufficiently neutralizing active content (e.g., scriptable elements, event handlers, or JavaScript-capable constructs).
Because SVG is both an image and a document format, treating it as a safe static asset while rendering it inline exposes script execution capabilities.
This behavior is compounded by aspects of CWE-434: Unrestricted Upload of File with Dangerous Type, where a file type that can carry active script content is permitted and later delivered in a way that the browser interprets as executable.
Potential impact
- Hijacking of victim user sessions and potential account takeover
- Unauthorized actions performed on behalf of logged-in users (e.g., modifying tables, changing configurations, inviting/removing users)
- Theft of sensitive data accessible via the UI, including table contents and metadata
- Installation of further client-side payloads for long-lived browser-based persistence
- Lateral movement through the application by targeting higher-privileged users, such as workspace admins or system administrators
General mitigation guidance
Effective mitigation generally combines strict handling of active file types with defensive output encoding:
- Treat SVG and other script-capable formats as potentially dangerous and, where feasible, disable their upload or restrict them to non-inline, download-only delivery.
- Prefer converting uploaded images to safe raster formats (e.g., PNG/JPEG) on the server before display, eliminating embedded script capabilities.
- Apply context-appropriate output encoding for any user-controlled content that is rendered in the DOM, ensuring that markup and script are not interpreted as active code.
- Enforce a conservative Content Security Policy (CSP) that limits inline JavaScript execution and restricts script sources to trusted origins.
- Apply least-privilege design to user roles and minimize sensitive operations that can be triggered via the normal web UI, reducing XSS blast radius.
These patterns reduce the exploitability of stored payloads and limit the damage if a similar issue appears elsewhere.
How teams detect issues like this
Detection typically focuses on both code-level patterns and runtime behavior:
- Use static analysis or linters to flag unsanitized insertion of user-controlled content into HTML, SVG, or DOM APIs.
- During code review, pay special attention to:
- File upload endpoints and any logic that determines allowed types or post-processing
- Places where attachments are rendered inline, especially
<img>,<object>,<embed>,<iframe>, or direct DOM manipulation withinnerHTML-like APIs - Implement server-side logging for attachment uploads, including MIME type, file extension, and user identity, and periodically review for suspicious SVG or HTML uploads.
- Apply security testing (SAST/DAST) and automated scanning that includes checks for stored XSS via file uploads and rich content fields.
- Consider integrating automated security review tools into CI/CD to enforce policies on dangerous file types and unescaped output.

