Miggo Logo

CVE-2025-46343: n8n Vulnerable to Stored XSS through Attachments View Endpoint

5

CVSS Score
3.1

Basic Information

EPSS Score
0.0703%
Published
4/28/2025
Updated
4/29/2025
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:L/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
n8nnpm< 1.90.01.90.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability description states that the MIME type of uploaded files could be controlled via a GET parameter, allowing the server to respond with any MIME type, leading to XSS. The provided patches consistently modify the get method within the BinaryDataController class, located in packages/cli/src/controllers/binary-data.controller.ts.

Initially, in commit 678fe7726a507c784c41da8f4011825a8b5f80e0, the get method was patched to add a Content-Security-Policy: sandbox header if the mimeType (derived from the GET request) was text/html and the action was view. This indicates that prior to this, no such sandboxing was applied, and the Content-Type was set directly based on the user-provided mimeType.

Subsequent commits, like 18d54ab17ddd32a030b7ec10ffe517169e3e09d9, further hardened this by introducing an allow-list (ViewableMimeTypes) for viewable content types and explicitly disallowing others (like text/html) for the 'view' action. This confirms that the get method was the point where the user-controlled mimeType was processed and used to set the response headers.

The vulnerability existed because the get method would take the mimeType from the request's query parameters and use it to set the Content-Type header without adequate validation, allowing an attacker to force the browser to interpret an uploaded file as HTML. Therefore, BinaryDataController.get is the vulnerable function as it directly handles the malicious input (the mimeType parameter) and produces the vulnerable output (HTTP response with a controlled Content-Type).

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

### Imp**t n*n work*lows **n stor* *n* s*rv* *in*ry *il*s, w*i** *r* ****ssi*l* to *ut**nti**t** us*rs. *ow*v*r, t**r* w*s no r*stri*tion on t** MIM* typ* o* uplo**** *il*s, *n* t** MIM* typ* *oul* ** *ontroll** vi* * **T p*r*m*t*r. T*is *llow** t**

Reasoning

T** vuln*r**ility **s*ription st*t*s t**t t** MIM* typ* o* uplo**** *il*s *oul* ** *ontroll** vi* * **T p*r*m*t*r, *llowin* t** s*rv*r to r*spon* wit* *ny MIM* typ*, l***in* to XSS. T** provi*** p*t***s *onsist*ntly mo*i*y t** `**t` m*t*o* wit*in t**