CVE-2021-23439 Cross-site Scripting (XSS)
An attacker can execute arbitrary JavaScript by tricking a user into uploading a file with a malicious name in the file-upload-with-preview library.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2021-23439?
CVE-2021-23439 is a medium-severity cross-site scripting vulnerability in file-upload-with-preview, published on 5 Sep 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
This affects the package file-upload-with-preview before 4.2.0. A file containing malicious JavaScript code in the name can be uploaded (a user needs to be tricked into uploading such a file).
Weakness: CWE-79
Which versions are affected by CVE-2021-23439?
2 open source packages ship an affected version, including file-upload-with-preview. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
file-upload-with-preview npm | All versions | 4.2.0 |
file-upload-with-preview npm | All versions | 4.2.0 |
Products include Johndatserakis File-Upload-With-Preview.
How do I fix CVE-2021-23439?
Upgrade file-upload-with-preview to 4.2.0 or later.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2021-23439 being exploited?
There is no known exploitation of CVE-2021-23439 in the wild and no public exploit code.
Sources
Also known as GHSA-97pv-4338-r5vp.