# CVE-2021-37504: jQuery-Upload-File XSS in fileNameStr

Source: https://junglewise.ai/threats/cve-2021-37504-jquery-upload-file-xss-in-filenamestr  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2022-02-26. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2021-37504 · Severity: low · CVSS 3.1 · Published 2022-02-26

jQuery-Upload-File is a popular JavaScript plugin that enables multiple file uploads with a progress bar on web applications. A cross-site scripting (XSS) vulnerability allows attackers to inject malicious scripts through specially crafted file names, which could be used to steal user sessions, redirect users to phishing sites, or perform unauthorized actions on behalf of legitimate users.

Technologies: [jquery-file-upload (npm)](https://junglewise.ai/threats/technologies/jquery-file-upload). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2021-37504 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2021-37504 being exploited in the wild.

**How severe is CVE-2021-37504?** Low severity, with a CVSS score of 3.1, published 26 February 2022.

**Which products and versions are affected?** Hayageek Jquery-Upload-File through 4.0.11; jquery-file-upload (npm) SEMVER:introduced=0,last_affected=4.0.11.

**Is there a fix for CVE-2021-37504?** No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.

**How is CVE-2021-37504 attacked?** It is attacked over the network.

**Am I affected by CVE-2021-37504?** Check whether you run Hayageek Jquery-Upload-File or jquery-file-upload (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

This is a DOM-based cross-site scripting (CWE-79) vulnerability in jQuery-Upload-File affecting version 4.0.11 and earlier versions. The vulnerable code is located in the fileNameStr parameter handling in jquery.uploadfile.js (line 469), where user-supplied file names are not properly sanitized or escaped before being inserted into the DOM. An attacker can upload a file with a malicious JavaScript payload embedded in the file name; when the plugin processes and displays the file name without proper HTML encoding, the script executes in the browser context of any user viewing the upload interface. This requires user interaction (viewing the upload interface) but no authentication. The attack has network reach and can lead to session hijacking, credential theft, or malware distribution. A patch should be available in versions after 4.0.11.

## Affected products

- hayageek jquery-upload-file through 4.0.11

## Identifiers

- CVE-2021-37504
- GHSA-43x9-7hfv-mxrf

## Timeline

- 2022-02-25: disclosed
- 2022-02-26: advisory

## References

- [https://github.com/hayageek/jquery-upload-file](https://github.com/hayageek/jquery-upload-file)
- [https://github.com/hayageek/jquery-upload-file/blob/master/js/jquery.uploadfile.js](https://github.com/hayageek/jquery-upload-file/blob/master/js/jquery.uploadfile.js)

## Related threats

- [jquery-file-upload unrestricted file upload](https://junglewise.ai/threats/cve-2018-9207-jquery-file-upload-unrestricted-file-upload)
