6.5
CVSS V3
Tornado has a CRLF injection in CurlAsyncHTTPClient headers
Tornado’s curl_httpclient.CurlAsyncHTTPClient
class is vulnerable to CRLF (carriage return/line feed) injection in the request headers.
When an HTTP request is sent using CurlAsyncHTTPClient
, Tornado does not reject carriage return (\r) or line feed (\n) characters in the request headers. As a result, if an application includes an attacker-controlled header value in a request sent using CurlAsyncHTTPClient
, the attacker can inject arbitrary headers into the request or cause the application to send arbitrary requests to the specified server.
This behavior differs from that of the standard AsyncHTTPClient
class, which does reject CRLF characters.
This issue appears to stem from libcurl's (as well as pycurl's) lack of validation for the HTTPHEADER
option. libcurl’s documentation states:
pycurl similarly appears to assume that the headers adhere to the correct format. Therefore, without any validation on Tornado’s part, header names and values are included verbatim in the request sent by CurlAsyncHTTPClient
, including any control characters that have special meaning in HTTP semantics.
The issue can be reproduced using the following script:
When the specified server receives the request, it contains the injected header (Header: Injected
) on its own line:
The attacker can also construct entirely new requests using a payload with multiple CRLF sequences. For example, specifying a header value of \r\n\r\nPOST /attacker-controlled-url HTTP/1.1\r\nHost: 727ymeu841qydmnwlol261ktkkqbe24qt.oastify.com
results in the server receiving an additional, attacker-controlled request:
Applications using the Tornado library to send HTTP requests with untrusted header data are affected. This issue may facilitate the exploitation of server-side request forgery (SSRF) vulnerabilities.