CVE-2021-23439: Cross-site Scripting in file-upload-with-preview
4.2
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.60629%
CWE
Published
9/7/2021
Updated
2/1/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
file-upload-with-preview | npm | < 4.2.0 | 4.2.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from improper neutralization of file names before DOM insertion. The advisory references line 168 in the source file, which in the patched version (PR #40) shows security-focused changes. The fix involved using textContent
instead of innerHTML
for filename
display, indicating the original implementation directly injected user-controlled filenames
into DOM elements without sanitization. This pattern matches classic stored XSS vulnerability patterns where user-controlled input is rendered unsafely.