CVE-2021-23336 - Inconsistent Interpretation of HTTP Requests ('HTTP Request Smuggling')

Severity

71%

Complexity

27%

Confidentiality

70%

The package python/cpython from 0 and before 3.6.13, from 3.7.0 and before 3.7.10, from 3.8.0 and before 3.8.8, from 3.9.0 and before 3.9.2 are vulnerable to Web Cache Poisoning via urllib.parse.parse_qsl and urllib.parse.parse_qs by using a vector called parameter cloaking. When the attacker can separate query parameters using a semicolon (;), they can cause a difference in the interpretation of the request between the proxy (running with default configuration) and the server. This can result in malicious requests being cached as completely safe ones, as the proxy would usually not see the semicolon as a separator, and therefore would not include it in a cache key of an unkeyed parameter.

CVSS 3.1 Base Score 7.1. CVSS Attack Vector: network. CVSS Attack Complexity: low. CVSS Vector: (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:H).

CVSS 2.0 Base Score 5.8. CVSS Attack Vector: network. CVSS Attack Complexity: medium. CVSS Vector: (AV:N/AC:M/Au:N/C:N/I:P/A:P).

CVSS 3.1 Base Score 5.9. CVSS Attack Vector: network. CVSS Attack Complexity: high. CVSS Vector: (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:L/A:H).

CVSS 2.0 Base Score 4. CVSS Attack Vector: network. CVSS Attack Complexity: high. CVSS Vector: (AV:N/AC:H/Au:N/C:N/I:P/A:P).

Demo Examples

Inconsistent Interpretation of HTTP Requests ('HTTP Request Smuggling')

CWE-444

In the following example, a malformed HTTP request is sent to a website that includes a proxy server and a web server with the intent of poisoning the cache to associate one webpage with another malicious webpage.


               
Connection: Keep-Alive

When this request is sent to the proxy server, the proxy server parses the POST request in the first seven lines, and encounters the two "Content-Length" headers. The proxy server ignores the first header, so it assumes the request has a body of length 44 bytes. Therefore, it treats the data in the next three lines that contain exactly 44 bytes as the first request's body. The proxy then parses the last three lines which it treats as the client's second request.

The request is forwarded by the proxy server to the web server. Unlike the proxy, the web server uses the first "Content-Length" header and considers that the first POST request has no body, and the second request is the line with the first GET (note that the second GET is parsed by the web server as the value of the "Bla" header).

The requests the web server sees are "POST /foobar.html" and "GET /poison.html", so it sends back two responses with the contents of the "foobar.html" page and the "poison.html" page, respectively. The proxy matches these responses to the two requests it thinks were sent by the client "POST /foobar.html" and "GET /page_to_poison.html". If the response is cacheable, the proxy caches the contents of "poison.html" under the URL "page_to_poison.html", and the cache is poisoned! Any client requesting "page_to_poison.html" from the proxy would receive the "poison.html" page.

When a website includes both a proxy server and a web server some protection against this type of attack can be achieved by installing a web application firewall, or use a web server that includes a stricter HTTP parsing procedure or make all webpages non-cacheable.

Additionally, if a web application includes a Java servlet for processing requests, the servlet can check for multiple "Content-Length" headers and if they are found the servlet can return an error response thereby preventing the poison page to be cached, as shown below.


               
}
} catch (Exception ex) {...}// Set up response writer object
}// check for multiple content length headers
count++;
// output error response
// process request

Inconsistent Interpretation of HTTP Requests ('HTTP Request Smuggling')

CWE-444

In the following example, a malformed HTTP request is sent to a website that includes a web server with a firewall with the intent of bypassing the web server firewall to smuggle malicious code into the system..


               
Connection: Keep-Alive

When this request is sent to the web server, the first POST request has a content-length of 49,223 bytes, and the firewall treats the line with 49,152 copies of "z" and the lines with an additional lines with 71 bytes as its body (49,152+71=49,223). The firewall then continues to parse what it thinks is the second request starting with the line with the third POST request.

Note that there is no CRLF after the "Bla: " header so the POST in the line is parsed as the value of the "Bla:" header. Although the line contains the pattern identified with a worm ("cmd.exe"), it is not blocked, since it is considered part of a header value. Therefore, "cmd.exe" is smuggled through the firewall.

When the request is passed through the firewall the web server the first request is ignored because the web server does not find an expected "Content-Type: application/x-www-form-urlencoded" header, and starts parsing the second request.

This second request has a content-length of 30 bytes, which is exactly the length of the next two lines up to the space after the "Bla:" header. And unlike the firewall, the web server processes the final POST as a separate third request and the "cmd.exe" worm is smuggled through the firewall to the web server.

To avoid this attack a Web server firewall product must be used that is designed to prevent this type of attack.

Overview

First reported 4 years ago

2021-02-15 13:15:00

Last updated 3 years ago

2021-12-07 21:02:00

Affected Software

Python

Debian Linux 9.0

9.0

Fedora 32

32

NetApp ONTAP Select Deploy Administration Utility

References

https://github.com/python/cpython/pull/24297

https://snyk.io/blog/cache-poisoning-in-popular-open-source-packages/

https://snyk.io/vuln/SNYK-UPSTREAM-PYTHONCPYTHON-1074933

[oss-security] 20210219 Django security releases: CVE-2021-23336: Web cache poisoning via ``django.utils.http.limited_parse_qsl()``

[debian-lts-announce] 20210219 [SECURITY] [DLA 2569-1] python-django security update

FEDORA-2021-7547ad987f

FEDORA-2021-f4fd9372c7

FEDORA-2021-7d3a9004e2

FEDORA-2021-3352c1c802

[mina-dev] 20210225 [jira] [Created] (FTPSERVER-500) Security vulnerability in common/lib/log4j-1.2.17.jar

FEDORA-2021-907f3bacae

[oss-security] 20210219 Django security releases: CVE-2021-23336: Web cache poisoning via ``django.utils.http.limited_parse_qsl()``

Third Party Advisory

https://github.com/python/cpython/pull/24297

Third Party Advisory

[mina-dev] 20210225 [jira] [Created] (FTPSERVER-500) Security vulnerability in common/lib/log4j-1.2.17.jar

Third Party Advisory

[debian-lts-announce] 20210219 [SECURITY] [DLA 2569-1] python-django security update

Third Party Advisory

FEDORA-2021-907f3bacae

Third Party Advisory

FEDORA-2021-7547ad987f

Third Party Advisory

FEDORA-2021-7d3a9004e2

Third Party Advisory

FEDORA-2021-3352c1c802

Third Party Advisory

FEDORA-2021-f4fd9372c7

Third Party Advisory

https://snyk.io/blog/cache-poisoning-in-popular-open-source-packages/

Technical Description, Third Party Advisory

https://snyk.io/vuln/SNYK-UPSTREAM-PYTHONCPYTHON-1074933

Exploit, Third Party Advisory

FEDORA-2021-7c1bb32d13

FEDORA-2021-b1843407ca

[oss-security] 20210219 Django security releases: CVE-2021-23336: Web cache poisoning via ``django.utils.http.limited_parse_qsl()``

Mailing List, Third Party Advisory

[mina-dev] 20210225 [jira] [Created] (FTPSERVER-500) Security vulnerability in common/lib/log4j-1.2.17.jar

Mailing List, Third Party Advisory

[debian-lts-announce] 20210219 [SECURITY] [DLA 2569-1] python-django security update

Mailing List, Third Party Advisory

FEDORA-2021-b1843407ca

Mailing List, Third Party Advisory

FEDORA-2021-907f3bacae

Mailing List, Third Party Advisory

FEDORA-2021-7547ad987f

Mailing List, Third Party Advisory

FEDORA-2021-7c1bb32d13

Mailing List, Third Party Advisory

FEDORA-2021-7d3a9004e2

Mailing List, Third Party Advisory

FEDORA-2021-3352c1c802

Mailing List, Third Party Advisory

FEDORA-2021-f4fd9372c7

Mailing List, Third Party Advisory

FEDORA-2021-b326fcb83f

FEDORA-2021-2897f5366c

FEDORA-2021-1bb399a5af

FEDORA-2021-ef83e8525a

FEDORA-2021-b76ede8f4d

FEDORA-2021-309bc2e727

FEDORA-2021-e22bb0e548

FEDORA-2021-e525e48886

FEDORA-2021-5a09621ebb

https://github.com/python/cpython/pull/24297

Patch, Third Party Advisory

FEDORA-2021-b76ede8f4d

Mailing List, Third Party Advisory

FEDORA-2021-e22bb0e548

Mailing List, Third Party Advisory

FEDORA-2021-ef83e8525a

Mailing List, Third Party Advisory

FEDORA-2021-309bc2e727

Mailing List, Third Party Advisory

FEDORA-2021-e525e48886

Mailing List, Third Party Advisory

FEDORA-2021-1bb399a5af

Mailing List, Third Party Advisory

FEDORA-2021-b326fcb83f

Mailing List, Third Party Advisory

FEDORA-2021-2897f5366c

Mailing List, Third Party Advisory

FEDORA-2021-5a09621ebb

Mailing List, Third Party Advisory

https://security.netapp.com/advisory/ntap-20210326-0004/

https://security.netapp.com/advisory/ntap-20210326-0004/

Third Party Advisory

[debian-lts-announce] 20210405 [SECURITY] [DLA 2619-1] python3.5 security update

[debian-lts-announce] 20210417 [SECURITY] [DLA 2628-1] python2.7 security update

FEDORA-2021-907f3bacae

Mailing List, Mailing List, Third Party Advisory

FEDORA-2021-b6b6093b3a

[oss-security] 20210219 Django security releases: CVE-2021-23336: Web cache poisoning via ``django.utils.http.limited_parse_qsl()``

Mailing List, Patch, Third Party Advisory

[debian-lts-announce] 20210405 [SECURITY] [DLA 2619-1] python3.5 security update

Mailing List, Third Party Advisory

[debian-lts-announce] 20210417 [SECURITY] [DLA 2628-1] python2.7 security update

Mailing List, Third Party Advisory

FEDORA-2021-b6b6093b3a

Third Party Advisory

GLSA-202104-04

[airflow-users] 20210501 CVE-2021-28359: Apache Airflow Reflected XSS via Origin Query Argument in URL

[oss-security] 20210501 CVE-2021-28359: Apache Airflow Reflected XSS via Origin Query Argument in URL

[announce] 20210501 Apache Airflow CVE: CVE-2021-28359: Apache Airflow Reflected XSS via Origin Query Argument in URL

FEDORA-2021-98720f3785

FEDORA-2021-12df7f7382

https://www.oracle.com/security-alerts/cpuApr2021.html

GLSA-202104-04

Third Party Advisory

[airflow-users] 20210501 CVE-2021-28359: Apache Airflow Reflected XSS via Origin Query Argument in URL

Mailing List, Third Party Advisory

[oss-security] 20210501 CVE-2021-28359: Apache Airflow Reflected XSS via Origin Query Argument in URL

Mailing List, Third Party Advisory

[announce] 20210501 Apache Airflow CVE: CVE-2021-28359: Apache Airflow Reflected XSS via Origin Query Argument in URL

Mailing List, Third Party Advisory

FEDORA-2021-98720f3785

Mailing List, Third Party Advisory

FEDORA-2021-12df7f7382

Mailing List, Third Party Advisory

https://www.oracle.com/security-alerts/cpuApr2021.html

Patch, Third Party Advisory

N/A

https://www.oracle.com/security-alerts/cpuoct2021.html

N/A

Patch, Third Party Advisory

https://www.oracle.com/security-alerts/cpuoct2021.html

Patch, Third Party Advisory

Stay updated

ExploitPedia is constantly evolving. Sign up to receive a notification when we release additional functionality.

Get in touch

If you'd like to report a bug or have any suggestions for improvements then please do get in touch with us using this form. We will get back to you as soon as we can.