Cross-Site Scripting (XSS) Vulnerability in serve
Summary
GHSA-cpgr-wmr9-qxv4: Cross-Site Scripting in serve. Affects serve versions < 10.0.2. Fixed in 10.0.2. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Serve is an npm package that allows developers to quickly create static file servers for local development or production environments. It is commonly used to serve static websites or files. However, versions prior to 10.0.2 are vulnerable to Cross-Site Scripting (XSS) attacks. This means that the package fails to properly sanitize filenames, allowing attackers to execute arbitrary JavaScript code in the victim's browser through files with malicious names.
Vulnerability Detail
The Cross-Site Scripting (XSS) vulnerability in serve arises from the package's failure to sanitize filenames. This allows attackers to inject and execute arbitrary JavaScript code in the victim's browser. By crafting filenames with malicious code, an attacker can trick users into unknowingly executing the code when accessing the files served by the vulnerable package. This can lead to various security risks, such as unauthorized access to sensitive information, session hijacking, or the spread of malware.
How To Fix
Latest published version: 14.2.6 as of 23 Oct 2026
npm install serve@14.2.6
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
10.0.2
This is the first release that contains the fix.
npm install serve@10.0.2
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Conclusion
The Cross-Site Scripting (XSS) vulnerability in serve versions prior to 10.0.2 can lead to the execution of arbitrary JavaScript code in the victim's browser. To mitigate this risk, it is crucial to upgrade to version 10.0.2 or later. Developers should promptly update their package dependencies and ensure they are using the latest secure version of serve. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for serve →
FAQ
Cross-Site Scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users. This can lead to unauthorized access, data theft, or the spread of malware.
This vulnerability affects serve users by allowing attackers to execute arbitrary JavaScript code in the victim's browser. This can lead to various security risks, such as unauthorized access to sensitive information or the spread of malware.
No, only versions prior to 10.0.2 are vulnerable to this Cross-Site Scripting (XSS) issue. It is important to update to version 10.0.2 or later to mitigate the risk.
No, there is no known workaround for this vulnerability. It is recommended to upgrade to the latest secure version of serve to fix the issue.
You can find more information about this vulnerability in the GitHub Advisory Database at the following link: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2020/09/GHSA-cpgr-wmr9-qxv4/GHSA-cpgr-wmr9-qxv4.json
References
Related vulnerabilities
Recent vulnerabilities recorded for serve.