CVE-2024-42367 In aiohttp, compressed files as symlinks are not protected from path traversal

Medium 4.8 Published Updated

Attackers can read arbitrary files outside the root directory via symlinked compressed files in aiohttp static routes.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-42367?

CVE-2024-42367 is a medium-severity path traversal vulnerability in aio-libs aiohttp, published on 9 Aug 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

aiohttp is an asynchronous HTTP client/server framework for asyncio and Python. In versions on the 3.10 branch prior to version 3.10.2, static routes which contain files with compressed variants (`.gz` or `.br` extension) are vulnerable to path traversal outside the root directory if those variants are symbolic links. The server protects static routes from path traversal outside the root directory when `follow_symlinks=False` (default). It does this by resolving the requested URL to an absolute path and then checking that path relative to the root. However, these checks are not performed when looking for compressed variants in the `FileResponse` class, and symbolic links are then automatically followed when performing the `Path.stat()` and `Path.open()` to send the file. Version 3.10.2 contains a patch for the issue.

Weakness: CWE-61

Which versions are affected by CVE-2024-42367?

3 open source packages ship an affected version, including aiohttp. It affects 1 product.

PackageAffectedFixed in
aiohttp PyPIFrom 3.10.0b13.10.2
aiohttp PyPIFrom 3.10.0b13.10.2
aiohttp PyPIFrom 3.10.0b13.10.2
Linux distribution packages (6)
python-aiohttp SUSE:Linux Enterprise Module for Public Cloud 15 SP4All versions3.9.3-150400.10.24.1
python-aiohttp SUSE:Linux Enterprise Module for Python 3 15 SP5All versions3.9.3-150400.10.24.1
python-aiohttp SUSE:Linux Enterprise Module for Python 3 15 SP6All versions3.9.3-150400.10.24.1
python-aiohttp openSUSE:Leap 15.5All versions3.9.3-150400.10.24.1
python-aiohttp openSUSE:Leap 15.6All versions3.9.3-150400.10.24.1
python-aiohttp openSUSE:TumbleweedAll versions3.10.5-1.1

Products include Aiohttp Aiohttp.

How do I fix CVE-2024-42367?

Upgrade aiohttp to 3.10.2 or later.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2024-42367 being exploited?

There is no known exploitation of CVE-2024-42367 in the wild and no public exploit code.

Sources

Also known as AZL-47754, AZL-47763, DEBIAN-CVE-2024-42367, GHSA-jwhx-xcg6-8xhj, OESA-2024-2254, PYSEC-2026-1108 and 2 more.

Is CVE-2024-42367 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free