Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2021-48011 Overview
CVE-2021-48011 is a path traversal vulnerability [CWE-22] in Servor, a dependency-free Node.js static file server. Versions 1.0.0 through 4.0.2 fail to sanitize URL-encoded dot segments before joining them to the served root directory. Unauthenticated remote attackers can send %2e%2e/ sequences that decodeURI() normalizes prior to path.join() in serveStaticFile and serveDirectoryListing. This allows reading arbitrary files and enumerating directories outside the configured web root. The flaw was patched in commit ec7d824 and tracked in GitHub Pull Request #70.
Critical Impact
Unauthenticated remote attackers can read arbitrary files on the host filesystem and enumerate directories outside the Servor root, exposing source code, configuration files, and credentials.
Affected Products
- Servor 1.0.0 through 4.0.2
- Node.js applications bundling vulnerable Servor versions
- Development and demo environments using Servor as a static file server
Discovery Timeline
- 2026-10-12 - CVE-2021-48011 published to NVD
- 2026-10-13 - Last updated in NVD database
Technical Details for CVE-2021-48011
Vulnerability Analysis
Servor's request handler decodes the incoming URL with decodeURI() before passing the resulting pathname to path.join(). Because decoding happens before normalization, percent-encoded traversal sequences such as %2e%2e/ are converted to literal ../ segments after any upstream sanitization. The joined path then escapes the configured served root. Both serveStaticFile and serveDirectoryListing are affected, enabling file reads and directory listings on arbitrary filesystem locations accessible to the Node.js process.
Root Cause
The root cause is ordering of input processing in servor.js. The handler assigned const pathname = decodeURI(url.parse(req.url).pathname) without a subsequent path.normalize() call or filter for leading .. segments. Any encoded traversal survived into the file resolution logic.
Attack Vector
An attacker sends an HTTP GET request containing URL-encoded dot segments against the Servor endpoint. No authentication, user interaction, or special privileges are required. The server returns file contents or directory listings from locations outside the served root. Impact is limited to confidentiality of files readable by the Servor process.
// Security patch in servor.js - Prevent path traversal (#70)
// Source: https://github.com/lukejacksonn/servor/commit/ec7d824ea6903c0fb97a452045bbb8335198cbab
// Start the server and route requests
server((req, res) => {
- const pathname = decodeURI(url.parse(req.url).pathname);
+ const decodePathname = decodeURI(url.parse(req.url).pathname);
+ const pathname = path.normalize(decodePathname).replace(/^(\.\.(\/|\\|$))+/, '');
res.setHeader('access-control-allow-origin', '*');
if (reload && pathname === '/livereload') return serveReload(res);
if (!isRouteRequest(pathname)) return serveStaticFile(res, pathname);
The fix calls path.normalize() on the decoded pathname and strips any remaining leading .. segments using a regular expression before the path reaches file resolution logic.
Detection Methods for CVE-2021-48011
Indicators of Compromise
- HTTP request logs containing %2e%2e%2f, %2E%2E/, or mixed-case encoded dot segments in the URL path
- Access log entries referencing files outside the documented Servor root such as /etc/passwd, .env, or .ssh/ artifacts
- Unexpected 200 responses to requests whose decoded paths traverse parent directories
- Node.js process reading files from paths unrelated to the static site being served
Detection Strategies
- Inspect reverse proxy or WAF logs for percent-encoded traversal patterns targeting hosts running Servor
- Correlate inbound requests containing encoded ../ sequences with Node.js file descriptor opens via endpoint telemetry
- Alert on static file servers returning files whose paths are not children of the configured document root
Monitoring Recommendations
- Enable verbose HTTP access logging on all Servor instances and forward logs to a central SIEM
- Monitor Node.js process file read activity for sensitive paths such as /etc/, user home directories, and application configuration files
- Baseline normal URL patterns served by Servor and alert on deviations containing encoded characters
How to Mitigate CVE-2021-48011
Immediate Actions Required
- Upgrade Servor to a version containing commit ec7d824 or later
- Audit Servor deployments reachable from untrusted networks and restrict exposure to localhost or trusted CIDRs
- Review access logs for prior exploitation attempts using encoded dot segments
- Rotate any credentials, API keys, or secrets stored in files that could have been read by the Servor process
Patch Information
The maintainer applied the fix in commit ec7d824 via Pull Request #70. Full technical details are documented in the VulnCheck Advisory for Servor. Update the dependency in package.json and reinstall to apply the fix.
Workarounds
- Place Servor behind a reverse proxy that rejects requests containing %2e%2e, .., or other traversal patterns
- Run the Node.js process as an unprivileged user confined via containerization or chroot to minimize file read surface
- Restrict network exposure of Servor to loopback interfaces during development and avoid using Servor as a production file server
# Update Servor to a patched version
npm install servor@latest
# Verify the installed version includes commit ec7d824
npm ls servor
# Example nginx rule to block encoded traversal upstream of Servor
# location / {
# if ($request_uri ~* "(%2e%2e|\.\./)") { return 400; }
# proxy_pass http://127.0.0.1:8080;
# }
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

