CVE-2018-3726: Stored Cross-Site Scripting (XSS) in crud-file-server
Summary
CVE-2018-3726: Cross-site Scripting (XSS) - Stored in crud-file-server. Affects crud-file-server versions < 0.8.0. Fixed in 0.8.0. 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
crud-file-server is an npm package that provides a server for CRUD operations on files and directories. It allows users to manage files and directories through a web interface. However, versions before 0.8.0 are vulnerable to stored cross-site scripting (XSS) attacks. This vulnerability arises from inadequate sanitization of filenames when serving the directory index.
Vulnerability Detail
The stored cross-site scripting (XSS) vulnerability in crud-file-server allows an attacker to inject malicious scripts into the server's response, which can then be executed by unsuspecting users. This can lead to various consequences, such as stealing sensitive information, session hijacking, or performing actions on behalf of the user. The vulnerability has a CVSS score of 6.1, indicating a moderate severity level.
How To Fix
Minimum fixed version
0.8.0
This is the first release that contains the fix.
npm install crud-file-server@0.8.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If updating to the latest version is not feasible, a temporary workaround is to manually sanitize filenames before serving them through the directory index. This can be done by implementing a custom middleware or modifying the source code of the package. Here's an example of how to sanitize filenames using the 'xss' library in Node.js:
const xss = require('xss');
// Sanitize filename
const sanitizedFilename = xss(filename);
Conclusion
The stored cross-site scripting (XSS) vulnerability in crud-file-server versions before 0.8.0 can allow attackers to execute malicious scripts in users' browsers. To mitigate this risk, it is crucial to update to version 0.8.0 or later. If updating is not immediately possible, implementing a custom filename sanitization solution can serve as a temporary workaround. For further assistance with vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for crud-file-server →
FAQ
Stored cross-site scripting (XSS) is a type of web vulnerability where an attacker injects malicious scripts into a website or web application. These scripts are then stored on the server and served to users, potentially leading to the execution of the injected code in their browsers.
An attacker can exploit this vulnerability by uploading a file with a malicious filename that contains JavaScript code. When other users access the directory index served by the crud-file-server, the malicious code gets executed in their browsers.
The consequences of this vulnerability can vary depending on the attacker's intentions. They can include stealing sensitive information, performing actions on behalf of the user, session hijacking, or defacing the website.
Yes, this vulnerability has been fixed in version 0.8.0 of the crud-file-server package. It is recommended to update to this version or later to mitigate the risk.
Yes, a temporary workaround is to manually sanitize filenames before serving them through the directory index. This can be done by implementing custom sanitization logic or using a library like 'xss' to sanitize the filenames.
Related vulnerabilities
Recent vulnerabilities recorded for crud-file-server.