Path Traversal Vulnerability in statics-server
Summary
GHSA-74cp-qw7f-7hpw: Path Traversal in statics-server. Affects statics-server versions < 0.0.9. 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 statics-server package is an npm module used for serving static files over HTTP. It allows developers to quickly set up a server to serve static assets such as HTML, CSS, JavaScript, and images. The package is widely used in web development projects to facilitate the local testing and deployment of static files. However, all versions of statics-server are vulnerable to a Path Traversal vulnerability.
Vulnerability Detail
The Path Traversal vulnerability in statics-server arises from insufficient input sanitization. Attackers can exploit this vulnerability by using relative paths to access server files that should not be publicly accessible. By manipulating the file path in the HTTP request, an attacker can traverse the directory structure and access sensitive files on the server. This can lead to unauthorized disclosure of sensitive information or even remote code execution.
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
As there is no fix available, a possible workaround is to implement input validation and sanitization on the server-side to prevent path traversal attacks. This can be done by checking the requested file path against a whitelist of allowed paths or by using a library or framework that automatically handles input sanitization. Here is an example of how to implement input validation using Express.js:
const express = require('express');
const app = express();
app.get('/static/:file', (req, res) => {
const { file } = req.params;
// Validate and sanitize the file path
const sanitizedFilePath = validateAndSanitizeFilePath(file);
// Serve the file
res.sendFile(sanitizedFilePath);
});
function validateAndSanitizeFilePath(filePath) {
// Implement your validation and sanitization logic here
// Return the sanitized file path
}
Conclusion
The statics-server package is vulnerable to a Path Traversal vulnerability that allows attackers to access sensitive files on the server. Currently, there is no fix available for this vulnerability. It is recommended to use an alternative module and implement input validation and sanitization on the server-side to mitigate the risk. Regularly checking for updates and security advisories related to statics-server is crucial to ensure the latest patched version is used once a fix is released. For further support on vulnerability remediation, you can contact DevNack.com.
See every vulnerability recorded for statics-server →
FAQ
The Path Traversal vulnerability in statics-server allows attackers to access sensitive files on the server that should not be publicly accessible. This can lead to unauthorized disclosure of sensitive information or even remote code execution.
Yes, all versions of statics-server are vulnerable to this Path Traversal vulnerability.
No, currently there is no fix available for this vulnerability in the statics-server package. It is recommended to use an alternative module until a fix is released.
To protect your application from this vulnerability, you can implement input validation and sanitization on the server-side to prevent path traversal attacks. Additionally, regularly checking for updates and security advisories related to statics-server is important to ensure you are using the latest patched version once a fix is released.
You can find more information about this vulnerability in the GitHub Security Advisory Database. The vulnerability ID is GHSA-74cp-qw7f-7hpw.
References
Related vulnerabilities
Recent vulnerabilities recorded for statics-server.