Directory Traversal

2018-01-12T00:03:03
ID NODEJS:554
Type nodejs
Reporter Yasin Soliman
Modified 2018-01-12T00:03:03

Description

Overview

The serve-here module is a small web server that serves files with the process' working directory acting as the web root.

It is vulnerable to a directory traversal attack.

This means that files on the local file system which exist outside of the web root may be disclosed to an attacker. This might include confidential files.

Mitigating Factors: If the node process is run as a user with very limited filesystem permissions, there is significantly less risk of exposing confidential/private information.

Proof of Concept:

curl "http://${SERVER_IP}:${SERVER_PORT}/..%2f..%2fetc/passwd"

Remediation

serve-here has been deprecated by the author and replaced by @vivaxy/here

run npm i @vivaxy/here to install the new module.

References

  • <https://github.com/vivaxy/here/commit/298dbab41344dfb7f95f66b1fa7b5cfb436bd4a2>
  • <https://hackerone.com/reports/296254>