CVE-2023-26152: static-server Path Traversal vulnerability
Summary
CVE-2023-26152: static-server Path Traversal vulnerability. Affects static-server versions < 2.2.1. No fix is published. 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
The static-server package is an npm package used for serving static files over HTTP. It provides a simple way to host static websites or serve static assets. The package is widely used in web development projects to serve static content such as HTML, CSS, JavaScript, and images. However, all versions of the static-server package are vulnerable to a Path Traversal vulnerability. This vulnerability allows an attacker to access files outside of the intended directory by manipulating the input passed to the validPath function in server.js.
Vulnerability Detail
The Path Traversal vulnerability in static-server arises from a lack of proper input sanitization in the validPath function of server.js. By exploiting this vulnerability, an attacker can traverse the file system and access sensitive files or directories that should not be accessible. This can lead to unauthorized disclosure of sensitive information, remote code execution, or other malicious activities. The vulnerability has a CVSS score of 7.5, indicating a high severity level.
How To Fix
No fixed version is published for this vulnerability.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
If updating the package is not immediately feasible, a temporary workaround is to implement input validation and sanitization in the application code that utilizes the static-server package. This can be done by ensuring that user-supplied input is properly validated and restricted to prevent directory traversal attacks. Developers can use libraries or functions specifically designed for input sanitization, such as the 'path' module in Node.js, to sanitize user input and prevent path traversal vulnerabilities.
Conclusion
The static-server package is vulnerable to a Path Traversal vulnerability that can allow unauthorized access to sensitive files or directories. It is crucial to update the package to the latest patched version (2.2.2) or implement input validation and sanitization in the application code. For further support on vulnerability remediation, you can contact DevNack.com.
See every vulnerability recorded for static-server →
FAQ
The Path Traversal vulnerability in static-server can allow an attacker to access sensitive files or directories outside of the intended scope. This can lead to unauthorized disclosure of sensitive information, remote code execution, or other malicious activities.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert analyzes package-lock.json files to monitor and alert in real-time for open-source vulnerabilities in software.
Yes, the maintainers of the static-server package have released a fix in version 2.2.2. It is recommended to update your project's package.json file to specify the latest version of static-server as a dependency and run the package manager's update command to install the patched version.
If updating the package is not immediately feasible, you can implement input validation and sanitization in your application code that utilizes the static-server package. This can help mitigate the risk of path traversal attacks.
The CVSS score of this vulnerability is 7.5, indicating a high severity level.