CVE-2018-3724: Path Traversal in general-file-server
Summary
CVE-2018-3724: Path Traversal in general-file-server. Affects general-file-server versions < 1.1.8. 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 general-file-server is an npm package that provides file server functionality. It allows users to upload, download, and manage files on a server. However, all versions of general-file-server are vulnerable to a path traversal vulnerability.
Vulnerability Detail
The path traversal vulnerability in general-file-server allows an attacker to access files outside of the intended directory. By manipulating the file path in a specific way, an attacker can bypass file access restrictions and retrieve sensitive information or execute arbitrary code. This vulnerability poses a high risk as it can lead to unauthorized access, data leakage, and 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 official fix, it is advisable to find an alternative package or implement a custom file server solution with proper input validation and file path sanitization to prevent path traversal attacks. Here's an example of how to sanitize file paths in Node.js:
const path = require('path');
function sanitizeFilePath(filePath) {
const rootPath = '/path/to/root/directory';
const resolvedPath = path.resolve(rootPath, filePath);
if (!resolvedPath.startsWith(rootPath)) {
throw new Error('Invalid file path');
}
return resolvedPath;
}
Conclusion
The general-file-server package is vulnerable to a path traversal vulnerability that can lead to unauthorized access, data leakage, and remote code execution. Currently, there is no fix available, so it is recommended to avoid using this module. Consider finding an alternative package or implementing a custom file server solution with proper input validation and file path sanitization. For further support on vulnerability remediation, contact DevNack.com.
See every vulnerability recorded for general-file-server →
FAQ
The path traversal vulnerability allows an attacker to access sensitive files outside of the intended directory. This can lead to unauthorized access, data leakage, and remote code execution.
No, there is currently no fix available for this vulnerability. It is recommended to avoid using the general-file-server module until a fix is provided.
To mitigate the risk, it is recommended to find an alternative package or implement a custom file server solution with proper input validation and file path sanitization.
Keep an eye on the official GitHub repository of general-file-server for updates and patches regarding this vulnerability.
Yes, you can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities without requiring access to the code or installation.