Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') Affecting aiohttp package, versions [1.0.5,3.9.2)
Snyk CVSS
Threat Intelligence
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 ID SNYK-PYTHON-AIOHTTP-6209406
- published 30 Jan 2024
- disclosed 29 Jan 2024
- credit lcttty, solarpeng502
Introduced: 29 Jan 2024
CVE-2024-23334 Open this link in a new tabHow to fix?
Upgrade aiohttp
to version 3.9.2 or higher.
Overview
Affected versions of this package are vulnerable to Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') via the configuration of static routes when the follow_symlinks
option is set to True
. An attacker can read arbitrary files on the system by exploiting the lack of validation for file paths to ensure they are within the specified root directory for static files.
Notes:
This vulnerability has been present since the introduction of the follow_symlinks
parameter.
An application is only vulnerable with setup code like:
app.router.add_routes([
web.static("/static", "static/", follow_symlinks=True), # Remove follow_symlinks to avoid the vulnerability
])
Workaround
This vulnerability can be mitigated by disabling the follow_symlinks
option if it is set to True
, especially in environments beyond restricted local development. Additionally, using a reverse proxy server to handle static resources is recommended over serving static resources directly with aiohttp
in production environments.