First published: Wed Oct 31 2018(Updated: )
http.cookiejar.DefaultPolicy.domain_return_ok in Lib/http/cookiejar.py in Python before 3.7.3 does not correctly validate the domain: it can be tricked into sending existing cookies to the wrong server. An attacker may abuse this flaw by using a server with a hostname that has another valid hostname as a suffix (e.g., pythonicexample.com to steal cookies for example.com). When a program uses http.cookiejar.DefaultPolicy and tries to do an HTTP connection to an attacker-controlled server, existing cookies can be leaked to the attacker. This affects 2.x through 2.7.16, 3.x before 3.4.10, 3.5.x before 3.5.7, 3.6.x before 3.6.9, and 3.7.x before 3.7.3.
Credit: cve@mitre.org cve@mitre.org
Affected Software | Affected Version | How to fix |
---|---|---|
redhat/python | <0:2.7.5-88.el7 | 0:2.7.5-88.el7 |
redhat/python3 | <0:3.6.8-13.el7 | 0:3.6.8-13.el7 |
redhat/python3 | <0:3.6.8-23.el8 | 0:3.6.8-23.el8 |
redhat/rh-python36-python | <0:3.6.9-2.el6 | 0:3.6.9-2.el6 |
redhat/python27-python | <0:2.7.17-2.el6 | 0:2.7.17-2.el6 |
redhat/rh-python36-python | <0:3.6.9-2.el7 | 0:3.6.9-2.el7 |
redhat/python27-python | <0:2.7.17-2.el7 | 0:2.7.17-2.el7 |
Python Python | >=2.0<=2.7.16 | |
Python Python | >=3.0.0<3.4.10 | |
Python Python | >=3.5.0<3.5.7 | |
Python Python | >=3.6.0<3.6.9 | |
Python Python | >=3.7.0<3.7.3 | |
redhat/Python | <3.4.10 | 3.4.10 |
redhat/Python | <3.5.7 | 3.5.7 |
redhat/Python | <3.6.9 | 3.6.9 |
redhat/Python | <3.7.3 | 3.7.3 |
debian/python2.7 | 2.7.18-8+deb11u1 | |
IBM Data Risk Manager | <=2.0.6 |
A potentially simple workaround in the absence of patch on affected versions is to set DomainStrict in the cookiepolicy that would make sure a literal match against domain. The disadvantage would be that cookie set on example.com would not be shared with subdomain which might break workflow.
Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.
(Appears in the following advisories)
CVE-2018-20852 is a vulnerability in Python before version 3.7.3 that allows an attacker to trick the cookiejar into sending existing cookies to the wrong server.
CVE-2018-20852 has a severity rating of 5.3 (Medium).
Python versions before 3.7.3 are affected by CVE-2018-20852.
To fix CVE-2018-20852, upgrade your Python version to 3.7.3 or later.
You can find more information about CVE-2018-20852 at the following references: [1] [2] [3].