CVE-2024-42367: In aiohttp, compressed files as symlinks are not protected from path traversal
Summary Static routes which contain files with compressed variants (.gz or .br extension) were vulnerable to path traversal outside the root directory if those variants are symbolic links.
Details The server protects static routes from path traversal outside the root directory when followsymlinks=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 Path.stat() and Path.open() to send the file.
Impact Servers with static routes that contain compressed variants as symbolic links, pointing outside the root directory, or that permit users to upload or create such links, are impacted.
----
Patch: https://github.com/aio-libs/aiohttp/pull/8653/files
Other sources
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 followsymlinks=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.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/aiohttpto a version that resolves this vulnerability.Fixed in 3.10.2 - Upgrade
Upgrade
debian/python-aiohttpto a version that resolves this vulnerability.Fixed in 3.10.3-2 - Upgrade
Upgrade
debian/python-aiohttpto a version that resolves this vulnerability.Fixed in 3.11.16-1+deb13u1Fixed in 3.14.3-1 - Upgrade
Upgrade
aiohttpto a version that resolves this vulnerability.Fixed in 3.10.2
Event History
Frequently Asked Questions
What is the severity of CVE-2024-42367?
CVE-2024-42367 has a medium severity rating due to the potential for path traversal vulnerabilities.
How do I fix CVE-2024-42367?
To fix CVE-2024-42367, update the aiohttp package to version 3.10.2 or later.
What type of vulnerability is CVE-2024-42367?
CVE-2024-42367 is a path traversal vulnerability affecting static routes with symbolic links.
Which software is affected by CVE-2024-42367?
CVE-2024-42367 affects the aiohttp package versions prior to 3.10.2.
Can CVE-2024-42367 lead to unauthorized access?
Yes, CVE-2024-42367 can potentially allow attackers to access files outside the intended directory.