CVE-2018-3787: Path Traversal Vulnerability in simplehttpserver

simplehttpserver Updated 02 Oct 2025

Summary

06/09/2018
Yes i
High
7.5

CVE-2018-3787: simplehttpserver allows directory traversal and file listing. Affects simplehttpserver versions < 0.2.1. Fixed in 0.2.1. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

simplehttpserver is an npm package that provides a basic HTTP server for serving static files. It is commonly used for local development and testing purposes. The package allows users to easily start a server and serve files from a specified directory. However, versions prior to 0.2.1 are vulnerable to a path traversal attack, which allows an attacker to list any file on the server.

Vulnerability Detail

The path traversal vulnerability in simplehttpserver allows an attacker to bypass the intended file serving restrictions and access files outside of the specified directory. By manipulating the file path in the HTTP request, an attacker can traverse directories and retrieve sensitive files that should not be accessible. This can lead to unauthorized disclosure of sensitive information or potential remote code execution if the server is running with elevated privileges.

How To Fix

Latest published version: 0.3.0 as of 22 Oct 2026

npm install simplehttpserver@0.3.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

0.2.1

This is the first release that contains the fix.

npm install simplehttpserver@0.2.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to the latest version is not possible, a temporary workaround is to manually validate and sanitize the file paths in the server code. This can be done by checking if the requested file path is within the allowed directory and rejecting any requests that attempt to access files outside of it. Here is an example of how to implement this workaround in Node.js:

const http = require('http');
const path = require('path');

const server = http.createServer((req, res) => {
  const filePath = path.join(__dirname, 'public', req.url);
  const allowedDirectory = path.join(__dirname, 'public');

  if (!filePath.startsWith(allowedDirectory)) {
    res.statusCode = 403;
    res.end('Forbidden');
return;
  }

  // Rest of the server logic
});

server.listen(3000);

Conclusion

The path traversal vulnerability in simplehttpserver can be mitigated by upgrading to version 0.2.1 or later. If upgrading is not feasible, implementing the provided workaround can help protect against this vulnerability. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for simplehttpserver →

Share this vulnerability

FAQ

simplehttpserver is an npm package that provides a basic HTTP server for serving static files. It is commonly used for local development and testing purposes.

A path traversal vulnerability allows an attacker to access files outside of the intended directory by manipulating the file path in the HTTP request.

The path traversal vulnerability in simplehttpserver can lead to unauthorized disclosure of sensitive information or potential remote code execution if the server is running with elevated privileges.

To fix this vulnerability, it is recommended to upgrade to version 0.2.1 or later of the simplehttpserver package. Alternatively, you can manually validate and sanitize file paths in the server code to restrict access to the intended directory.

Yes, if upgrading to the latest version is not possible, you can implement a workaround by manually validating and sanitizing file paths in the server code. See the 'workaround' section for an example.

Related vulnerabilities

Recent vulnerabilities recorded for simplehttpserver.

How To Fix

Latest published version: 0.3.0 as of 22 Oct 2026

npm install simplehttpserver@0.3.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

0.2.1

This is the first release that contains the fix.

npm install simplehttpserver@0.2.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback