Summary
Budibase's attachment processing endpoint allows authenticated builders to upload active web content (such as SVGs with inline scripts, HTML with JavaScript, or JS modules) without enforcing extension-based restrictions in certain configurations.
When other users later access the signed URLs for these uploaded files, their browsers execute the embedded scripts, leading to persistent stored XSS across application end users.
Affected context
The issue arises in Budibase deployments where authenticated builders can upload attachments via POST /api/attachments/process and where the active-content checks are only applied to public users or non-self-hosted environments.
Because uploaded files are stored in an object store (e.g., MinIO or S3) with their correct MIME types and later served through signed URLs, uploaded HTML, SVG, or JavaScript content can be rendered and executed directly in the user's browser.
This typically affects multi-user Budibase instances where builders and end users share access to the same applications and attachment assets.
Exploit preconditions
- Attack surface: The
/api/attachments/processfile upload endpoint in Budibase. - Required access: Authenticated builder-level access (not just anonymous public users), with permission to upload attachments.
- Trigger point: An uploaded active-content file (HTML, SVG with inline
<script>, or.js) is later accessed via its signed URL by any application user. - Why exploitation is possible: The server-side logic for filtering dangerous file types is conditionally applied based on
isPublicUserandenv.SELF_HOSTED, leaving a path where authenticated builders can upload executable content that is served back with the correct MIME type and executed by the browser.
Why this happens
The underlying issue combines two common web security weaknesses:
- CWE-434: Unrestricted Upload of File with Dangerous Type – The upload handler relies on conditional checks that only enforce active-content restrictions for certain user types or deployment configurations. As a result, authenticated builders can upload files that are inherently executable in a browser context, such as HTML documents, SVGs with inline script tags, or JavaScript modules.
- CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting) – These dangerous files are stored and later served via signed URLs with their correct MIME types, causing browsers to interpret them as first-class web content. Since there is no neutralization or transformation of the embedded scripts, user-controlled script content is executed in the context of the application domain.
Abstractly, the bug class is that untrusted user content is being accepted and later rendered as active web content without sufficient type restrictions, sanitization, or isolation, allowing arbitrary script execution in users' browsers.
Potential impact
- Application end users may have their session cookies or authentication tokens exfiltrated.
- Attackers could perform actions on behalf of victim users (e.g., modifying data, changing configurations) within the permissions of the compromised session.
- Malicious scripts could log keystrokes, inject additional phishing content, or redirect users to attacker-controlled domains.
- The compromise may be persistent, as the uploaded payload remains accessible and re-executable by any user who opens the signed URL or assets referencing it.
- In multi-tenant or shared environments, a malicious builder could target a broad user base across multiple applications.
General mitigation guidance
Effective mitigation focuses on strictly controlling what file types can be uploaded and how they are served back to clients, particularly in the context of a low-code platform where builders control significant application behavior.
Recommended defensive patterns include:
- Enforcing server-side allowlists for attachment types, explicitly disallowing any file that can be directly interpreted as active web content (e.g.,
text/html,image/svg+xmlwith scripts,application/javascript). - Decoupling user-uploaded files from the primary application origin by serving them from a distinct domain or subdomain without access to application cookies or storage, limiting the impact of any active content.
- Normalizing or transforming potentially risky formats (e.g., sanitizing SVGs, converting them to raster images) before storage or delivery when such formats are required.
- Applying defense-in-depth controls such as content security policy (CSP) to constrain script execution, reducing the blast radius of any single uploaded asset.
- Minimizing builder privileges where feasible and applying role-based controls so that only trusted roles can upload certain file types.
How teams detect issues like this
Detection can leverage both static and runtime approaches:
- Code-level review: Inspect upload handlers for conditional checks on file extensions and MIME types that depend on user role or deployment mode; flag any paths that allow unrestricted upload of HTML, SVG, or JavaScript.
- Static analysis rules: Configure linters or SAST tools to detect patterns where user-supplied files are stored and then served as-is, especially when responses preserve original MIME types and originate from the main application domain.
- Configuration and policy checks: Define and enforce policies requiring explicit allowlists for upload endpoints and regular review of any bypass conditions tied to environment flags (e.g.,
SELF_HOSTED) or user roles. - Runtime monitoring: Log and monitor uploaded file metadata (names, MIME types, sizes) and alert on suspicious patterns, such as builders uploading
.html,.svg, or.jsfiles, or unusual spikes in access to these assets via signed URLs.

