Skip to content
Path traversal Disclosed report Beginner

[Total.js] Path traversal vulnerability allows to read files outside public directory

Total.js only blocked the lowercase percent-encoded dot sequence in request paths, so an attacker could use the uppercase equivalent to walk out of the public directory. This allowed reading arbitrary files on the server, such as the application's own source file.

visat Follow

Originally disclosed on HackerOne

Medium 5.3 View original
  • Triaged in 20 hours
  • Fixed in 5 months
  • Disclosed after 5 months

I would like to report path traversal in Total.js. It allows read arbitrary files outside public directory.

Module

module name: Total.js version: 3.3.2 npm page: https://www.npmjs.com/package/total.js

Module Description

Total.js framework is a framework for Node.js platfrom written in pure JavaScript similar to PHP's Laravel or Python's Django or ASP.NET MVC. It can be used as web, desktop, service or IoT application.

Module Stats

2,125 weekly downloads

Vulnerability

Vulnerability Description

Total.js blacklists %2e in the req.uri.pathname [reference]. However, it does not blacklist %2E. Using %2E can bypass the blacklist to gain path traversal.

Steps To Reproduce:

  1. Clone an empty project from Total.js: git clone https://github.com/totaljs/emptyproject.
  2. Install Total.js within the directory: cd emptyproject; npm install total.js.
  3. Launch the server: node debug.js.
  4. Test path traversal: curl http://localhost:8000/%2E%2E/debug.js.

Patch

Also disallow %2E in the pathname.

Supporting Material/References:

  • Ubuntu 18.04
  • Node 12.13.1
  • NPM 6.12.1
  • cURL 7.58.0

Wrap up

  • I contacted the maintainer to let them know: N
  • I opened an issue in the related repository: N

Impact

Path traversal

The original report as published on HackerOne, by visat. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The path check compared against a single lowercase encoding of the dot character, so an uppercase variant of the same encoding slipped past the filter.

Impact

An attacker could read files outside the public directory, exposing application source and other server-side files.

What the attacker needed

Server running Total.js 3.3.2; network access to the server

The fix

The filter should also reject the uppercase encoded dot so both spellings are treated the same way.

How it was found

  1. Clone the empty Total.js project.
  2. Install Total.js inside that directory.
  3. Start the server.
  4. Request a path using the uppercase encoded dots to reach a file outside the public directory.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A web server usually only lets visitors fetch files from a public folder. Path traversal means sneaking 'go up one folder' instructions into the address so the server hands over files it should keep private. Here the framework tried to block one spelling of that trick but missed another spelling of the same character, so the protection could be stepped around.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More by visat

View all

1 more disclosed report, best first.

More from Node.js third-party modules

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.