Summary
Parse Server's file upload handling allows attackers to bypass the file extension blocklist by appending MIME parameters (such as ;charset=utf-8) to the Content-Type header.
Combined with missing coverage for certain XML-based file types, this can enable stored XSS, where active content is uploaded, stored, and later executed in users' browsers under the application's domain.
Affected context
This vulnerability affects Parse Server deployments that:
- Allow authenticated or unauthenticated users to upload files through the API or web interface, and
- Rely on the default file extension blocklist instead of a strict allowlist, and
- Serve uploaded files back under the same domain or origin as the main application, allowing the browser to treat them as trusted content.
Under these conditions, a crafted upload request with a manipulated Content-Type header and a script-capable file extension can be stored and later rendered by a victim's browser.
Exploit preconditions
- Attack surface: File upload endpoints exposed by Parse Server (REST API, SDKs, or wrapped web UI).
- Required access: Ability to upload files; this may require authentication depending on how the application is configured.
- Trigger point: A victim later accesses or is embedded content from the stored uploaded file (e.g., via a link, image tag, iframe, or other resource reference).
- Why exploitation is possible:
- The server previously applied file extension validation using the
Content-Typeheader including its MIME parameters, allowing bypass via values liketext/xml;charset=utf-8. - Some XML-based extensions capable of rendering scripts in browsers were absent from the default blocklist.
- Uploaded files are served from the application's domain, so any embedded script executes in that origin, turning the upload channel into a stored XSS vector.
Why this happens
The core issue is an insufficient defense-in-depth design for file upload validation in the context of script-capable content, mapping to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).
At a technical level:
- Extension-based filtering logic relied on the
Content-Typeheader without first stripping MIME parameters, so the extension validation did not correctly match against the blocklist when parameters like;charset=utf-8were appended. - The default configuration used a denylist (blocklist) model and omitted several XML-based extensions that can be interpreted by browsers in a way that executes active content.
This combination meant that untrusted user-provided files, including those that can contain executable scripts, were treated as benign and stored, then later served from a trusted origin. When a victim's browser renders such a file, any embedded script runs with the application's privileges, turning a content upload feature into a stored XSS sink.
Potential impact
- Theft of session tokens or authentication cookies accessible to scripts running under the application's domain.
- Compromise of user credentials through phishing-style overlays, fake login prompts, or keylogging scripts injected via uploaded content.
- Unauthorized access to or exfiltration of sensitive data stored in browser-accessible storage (e.g., localStorage, sessionStorage, IndexedDB).
- Execution of arbitrary JavaScript in victims' browsers, enabling account takeover, UI redressing, or unauthorized actions performed on behalf of users.
- Use of the compromised origin as a pivot for further client-side attacks (e.g., abusing trusted scripts to target other users or integrated web apps).
General mitigation guidance
Effective mitigation focuses on treating file uploads as untrusted content and constraining what types of files are ever accepted and how they are served:
- Prefer a file extension allowlist, not a denylist:
- Configure the upload subsystem so only a minimal set of required extensions is accepted (e.g., specific image or document formats).
- Avoid relying on a default blocklist for security; treat it only as a convenience baseline.
- Normalize and strictly validate metadata:
- Strip MIME parameters (such as
;charset=utf-8) before evaluating or comparingContent-Typeheader values and extensions. - Do not trust client-supplied
Content-Typeor file extensions; verify them against server-side rules and, where feasible, content-type sniffing libraries. - Serve uploads as untrusted content:
- Serve uploaded files from a separate domain or subdomain without privileged cookies (static or media domain pattern), reducing the impact if a script is rendered.
- Ensure appropriate
Content-Type,Content-Disposition, andX-Content-Type-Options: nosniffheaders are set when serving uploads. - Consider using
Content-Security-Policy(CSP) to limit where scripts can be loaded from and reduce the damage if uploaded content is rendered. - Minimize access and privileges:
- Restrict who can upload files and where these files can be referenced from within the application's UI.
- Apply rate limiting and monitoring on file upload endpoints to reduce abuse potential.
How teams detect issues like this
Detection can combine code-level checks with behavioral monitoring:
- Static and configuration analysis:
- Scan the codebase for upload-related logic that:
- Uses file extension blocklists rather than explicit allowlists.
- Directly trusts
Content-Typeheaders or file extensions without normalization. - Flag configuration where
fileUpload.fileExtensionsis unset or configured as a broad denylist instead of a tightly scoped allowlist. - Code review signals:
- File upload controllers that pass user-uploaded files directly to a storage backend and later serve them from the main application domain.
- Routes or templates that embed or link to user-uploaded files without sanitizing file types or isolating them with separate origins and proper headers.
- Lack of a central validation routine for uploaded file types, with ad-hoc checks scattered across handlers.
- Runtime and log-based monitoring:
- Monitor access logs for unusual patterns such as uploaded files requested with XML or other script-capable MIME types.
- Use WAF or reverse proxy rules to detect and optionally block responses serving user-uploaded content with active
Content-Typevalues to browsers. - Automated tooling:
- Incorporate SAST tools that understand Node.js/Express-like patterns and can flag risky file upload implementation constructs.
- Use DAST scanners to probe file upload endpoints for stored XSS behavior, including attempts to upload script-capable files and validate how they are later served.

