CVE-2024-52304
Request smuggling vulnerability in aiohttp prior to version 3.10.11.
- CVSS 6.3
- CWE-444
- Input Validation and Sanitization
- Remote
aiohttp is an asynchronous HTTP client/server framework for asyncio and Python. Prior to version 3.10.11, the Python parser parses newlines in chunk extensions incorrectly which can lead to request smuggling vulnerabilities under certain conditions. If a pure Python version of aiohttp is installed (i.e. without the usual C extensions) or `AIOHTTP_NO_EXTENSIONS` is enabled, then an attacker may be able to execute a request smuggling attack to bypass certain firewalls or proxy protections. Version 3.10.11 fixes the issue.
- CWE
- CWE-444
- CVSS base score
- 6.3
- Published
- 2024-11-18
- OWASP
- A01 Broken Access Control
- Orthogonal defect classification
- Algorithm
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Unauthorized Access
- Affected component
- aiohttp
- Fixed by upgrading
- Yes
Solution
Upgrade aiohttp to version 3.10.11 or later.
Vulnerable code sample
import aiohttp
import asyncio
async def fetch(url):
headers = {
'Transfer-Encoding': 'chunked',
'Content-Length': '0\r\n\r\nGET /evil HTTP/1.1\r\nHost: example.com\r\n\r\n'
}
async with aiohttp.ClientSession() as session:
async with session.post(url, headers=headers) as response:
return await response.text()
async def main():
url = 'http://example.com'
response = await fetch(url)
print(response)
if __name__ == '__main__':
asyncio.run(main())Patched code sample
import aiohttp
import asyncio
async def fetch(url):
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
return await response.text()
async def main():
url = 'http://example.com'
response = await fetch(url)
print(response)
if __name__ == '__main__':
asyncio.run(main())Payload
POST / HTTP/1.1
Host: target.com
Transfer-Encoding: chunked
0
GET /malicious HTTP/1.1
Host: target.com
Cite this entry
@misc{vaitp:cve202452304,
title = {{Request smuggling vulnerability in aiohttp prior to version 3.10.11.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2024},
note = {VAITP Python Vulnerability Dataset, entry CVE-2024-52304},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2024-52304/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
