VAITP Dataset

← Back to the dataset

CVE-2024-30251

aiohttp vulnerable to infinite loop from crafted POST requests. Upgrade advised.

  • CVSS 7.5
  • CWE-835
  • Resource Management
  • Remote

aiohttp is an asynchronous HTTP client/server framework for asyncio and Python. In affected versions an attacker can send a specially crafted POST (multipart/form-data) request. When the aiohttp server processes it, the server will enter an infinite loop and be unable to process any further requests. An attacker can stop the application from serving requests after sending a single request. This issue has been addressed in version 3.9.4. Users are advised to upgrade. Users unable to upgrade may manually apply a patch to their systems. Please see the linked GHSA for instructions.

CVSS base score
7.5
Published
2024-05-02
OWASP
A10 Insufficient Logging & Monitoring
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Resource Management
Subcategory
Resource Exhaustion
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
aiohttp
Fixed by upgrading
Yes

Solution

Upgrade to aiohttp version 3.9.4 or later.

Vulnerable code sample

from aiohttp import web

async def handle(request):
    # VULNERABLE: This code is susceptible to xss
    data = await request.post()
    while True:
        pass

app = web.Application()
app.router.add_post('/', handle)

if __name__ == '__main__':
    web.run_app(app, port=8080)

Patched code sample

from aiohttp import web

async def handle(request):
    # SECURE: This version prevents xss
    data = await request.post()
    return web.Response(text="Data received")

app = web.Application()
app.router.add_post('/', handle)

if __name__ == '__main__':
    web.run_app(app, port=8080)

Payload

POST / HTTP/1.1
Host: vulnerable-server.com
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="exploit"
Content-Type: application/octet-stream

<large amount of data to trigger the infinite loop>
------WebKitFormBoundary7MA4YWxkTrZu0gW--

Cite this entry

@misc{vaitp:cve202430251,
  title        = {{aiohttp vulnerable to infinite loop from crafted POST requests. Upgrade advised.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2024},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2024-30251},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2024-30251/}}
}
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 ::