Path Traversal Vulnerability in superstatic
Summary
GHSA-wm77-q74p-5763: Path Traversal in superstatic. Affects superstatic versions < 5.0.2. Fixed in 5.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
superstatic is an npm package used for serving static files. It is commonly used in web development to host static websites or single-page applications. The package provides a simple and efficient way to serve static files with features like URL rewriting and HTML5 pushState support. However, versions of superstatic prior to 5.0.2 are vulnerable to a path traversal vulnerability on Windows systems. Additionally, certain combinations of superstatic and Node.js versions can lead to path traversal vulnerabilities on other platforms as well.
Vulnerability Detail
The path traversal vulnerability in superstatic allows an attacker to access files outside of the intended directory structure. This can lead to unauthorized access to sensitive files or even remote code execution. On Windows systems, the vulnerability is present due to improper handling of file paths. On other platforms, the vulnerability is a result of a normalization issue in certain Node.js versions. The impact of this vulnerability can be severe, depending on the files accessible and the privileges of the user running the superstatic server.
How To Fix
Latest published version: 11.1.0 as of 22 Oct 2026
npm install superstatic@11.1.0
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
5.0.2
This is the first release that contains the fix.
npm install superstatic@5.0.2
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If updating superstatic is not immediately possible, a workaround is to implement input validation and sanitization for user-supplied paths. This can help prevent path traversal attacks by ensuring that only valid and expected paths are processed by the server. Here is an example of how to implement input validation in Node.js:
const path = require('path');
function validatePath(userPath) {
const basePath = '/path/to/static/files'; // Set the base path to restrict access
const resolvedPath = path.resolve(basePath, userPath);
if (!resolvedPath.startsWith(basePath)) {
throw new Error('Invalid path');
}
return resolvedPath;
}
Conclusion
The path traversal vulnerability in superstatic can have serious security implications, allowing unauthorized access to sensitive files or potential remote code execution. It is crucial to update superstatic to the latest version (5.0.2 or later) to mitigate this vulnerability. If immediate updating is not possible, implementing input validation and sanitization for user-supplied paths can serve as a temporary workaround. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for superstatic →
FAQ
superstatic is an npm package used for serving static files in web development. It provides features like URL rewriting and HTML5 pushState support.
Path traversal is a vulnerability that allows an attacker to access files outside of the intended directory structure. It can lead to unauthorized access to sensitive files or remote code execution.
The vulnerability in superstatic occurs due to improper handling of file paths on Windows systems and a normalization issue in certain Node.js versions on other platforms.
The path traversal vulnerability in superstatic can result in unauthorized access to sensitive files or even remote code execution, depending on the files accessible and the privileges of the user running the server.
To fix the vulnerability, update superstatic to version 5.0.2 or later. This update includes patches to address the path traversal vulnerability.