[glance] Access unlisted internal files/folders revealing sensitive information
The glance static file server's nodot option blocks direct access to dotfiles and dotfolders, but files inside a dotfolder can still be fetched by requesting their path. An attacker could read sensitive files such as .git/HEAD and reconstruct a repository to obtain current and past source files.
- Triaged in 41 hours
- Fixed in 26 days
- Disclosed after 26 days
I would like to report sensitive information disclosure in glance.
Similar to #486933 in ways
Module
module name: glance
version: 3.0.5
npm page: https://www.npmjs.com/package/glance
Module Description
a quick disposable http server for static files
Module Stats
weekly downloads 41
Vulnerability
Vulnerability Description
The glance modules allows directory browsing and to serve static files through the browser.
The config option nodot can be used to prevent serving sensitive folders such as .git or .DS_Store
refer: https://github.com/jarofghosts/glance#command-line-options
This rule can be bypassed using the technique below which can lead to sensitive information disclosure (An interesting example: https://smitka.me/).
Steps To Reproduce:
- Install
glance
$ npm install -g glance
- Inside a project directory, initialise
git.
$ git init
- Add rule to ignore dotfiles in
.glance.json
{
"nodot": true
}
- Start
glancein current directory.
$ glance --verbose
glance serving /project/directory on port 8080
- Now, current directory will be served by serve with the exception of folder
.gitand file.gitignore. - If we try to curl .
gitor.gitignorewe get a Not Found error
$ curl --path-as-is 127.0.0.1:8080/.git
...
<title>File Not Found</title>
...
- Although if we try to fetch files/folders inside a forbidden [dot]folder there is no problem at all and most of it's content can be extracted successfully (except dotfiles itself).
$ curl --path-as-is 127.0.0.1:8080/.git/HEAD
ref: refs/heads/master
The structure of git repository is well known, so it is possible to found references to the objects/packs in the repository, download them via direct requests and reconstruct the repository and obtain your files – not only the current ones, but also the past files.
Supporting Material/References:
- Ubuntu 16.04
- node v11.3.0
- npm 6.7.0
Wrap up
Select Y or N for the following statements:
- I contacted the maintainer to let them know: [N]
- I opened an issue in the related repository: [N]
Hunter's comments and funny memes goes here

Impact
The essentially bypasses the nodot feature and allows an attacker to read from a directory that the victim has not allowed access to.
References:
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
Likely the nodot check only examined the first path segment or the final filename, so a request whose path traversed into a dotfolder was not rejected.
Impact
The bypass defeats the nodot protection and lets an attacker read files from a directory the victim intended to hide, potentially reconstructing a Git repository to recover current and past source files.
What the attacker needed
Glance 3.0.5 running with nodot enabled; attacker can reach the server over HTTP
How it was found
- Install glance globally with npm.
- Initialise a git repository in a project directory.
- Create a .glance.json config that sets nodot to true.
- Start glance in that directory.
- Request the .git folder directly and observe a Not Found response.
- Request a file inside the .git folder and observe its contents returned.
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 static file server shares files from a folder over the web. The glance tool has a setting to hide files and folders whose names start with a dot, which often hold secrets like Git history. That setting can be bypassed, so files inside a hidden folder can still be fetched.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.