[sirloin] Web Server Directory Traversal via Crafted GET Request
The Sirloin web server module did not check that requested files stayed inside the served root directory, so a crafted URL with encoded dot-dot sequences could reach files elsewhere on the host. An attacker could read arbitrary system or application files, and the server listens on all interfaces by default.
- Triaged in 10 hours
- Fixed in 7 months
- Disclosed after 7 months
I would like to report path traversal in Sirloin module. It allows an attacker to read system files via path traversal local/remote
Module
module name: Sirloin
version: 0.15.0 (latest release build)
npm page: https://www.npmjs.com/package/sirloin
Module Description
This high performance, extremely easy to use web server.
Module Stats
downloads in the last year 4,129
Vulnerability
Vulnerability Description
Directory traversal through the url which doesn't verify the file is from the root directory path.
Steps To Reproduce:
1 npm install sirloin
2 start the local server by typing nodejs node_modules/sirloin/bin/sirloin.js
3 curl "http://localhost:3006/%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd"
it will list the content of /etc/passwd
Wrap up
- I contacted the maintainer to let them know: [N]
- I opened an issue in the related repository: [N]
Impact
An attacker can leverage this vulnerability to request arbitrary files from the target host, which may include application source code or system files. The package by default listen to 0.0.0.0 enabling external access.
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
Impact
An attacker could request arbitrary files from the target host, potentially including application source code or system files, and the default binding to all interfaces may expose this to external networks.
What the attacker needed
Sirloin server running; network access to the server port
How it was found
- Install the sirloin package with npm.
- Start the local server by running its bundled script.
- Send a request whose URL contains encoded dot-dot sequences pointing at a system file.
- Observe the contents of that system file returned in the response.
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 normally hands out files only from one folder it is told to serve. Here it took the path from the URL and used it without checking, so a visitor could climb out of that folder using '..' (meaning 'go up one level') and ask for files elsewhere on the machine. The report shows this working against a standard system file that lists user accounts.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.