# CVE-2018-20852: Information disclosure in n/a

> Attackers can steal cookies by exploiting domain validation flaws in Python's cookiejar, leading to information disclosure.

- **Severity:** Medium 4.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 13 Jul 2019
- **Updated:** 7 Oct 2026
- **Also known as:** DEBIAN-CVE-2018-20852, DLA-1889-1, DLA-1906-1, GHSA-p5ff-6x75-2mgp, SUSE-SU-2019:2114-1, UBUNTU-CVE-2018-20852, openSUSE-SU-2019:1988-1, openSUSE-SU-2019:1989-1

## What is CVE-2018-20852?

CVE-2018-20852 is a medium-severity vulnerability in Python Python, published on 13 Jul 2019. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

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.

Weakness: CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2018-20852?

It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `python` | SUSE:Linux Enterprise Module for Basesystem 15 | All versions | 2.7.14-7.17.1 |
| `python-base` | SUSE:Linux Enterprise Module for Basesystem 15 | All versions | 2.7.14-7.17.1 |
| `python` | SUSE:Linux Enterprise Module for Basesystem 15 SP1 | All versions | 2.7.14-7.17.1 |
| `python-base` | SUSE:Linux Enterprise Module for Basesystem 15 SP1 | All versions | 2.7.14-7.17.1 |
| `python` | SUSE:Linux Enterprise Module for Desktop Applications 15 | All versions | 2.7.14-7.17.1 |
| `python` | SUSE:Linux Enterprise Module for Desktop Applications 15 SP1 | All versions | 2.7.14-7.17.1 |
| `python` | SUSE:Linux Enterprise Module for Python 2 15 SP1 | All versions | 2.7.14-7.17.1 |
| `python-base` | SUSE:Linux Enterprise Module for Python 2 15 SP1 | All versions | 2.7.14-7.17.1 |
| `python` | openSUSE:Leap 15.0 | All versions | 2.7.14-lp150.6.17.1 |
| `python` | openSUSE:Leap 15.1 | All versions | 2.7.14-lp151.10.7.1 |
| `python-base` | openSUSE:Leap 15.1 | All versions | 2.7.14-lp151.10.7.1 |
| `python-doc` | openSUSE:Leap 15.1 | All versions | 2.7.14-lp151.10.7.1 |

Products: Python Python.

## How do I fix CVE-2018-20852?

Upgrade to a fixed version.

## Is CVE-2018-20852 being exploited?

There is no known exploitation of CVE-2018-20852 in the wild and no public exploit code.

## Other vulnerabilities in Python Python

- [CVE-2008-5031](https://insights.sbomify.com/CVE-2008-5031/): Integer overflow in n/a (critical 10.0)
- [CVE-2014-4650](https://insights.sbomify.com/CVE-2014-4650/): Path traversal in n/a (critical 9.8)
- [CVE-2016-5636](https://insights.sbomify.com/CVE-2016-5636/): Integer overflow in n/a (critical 9.8)
- [CVE-2007-4559](https://insights.sbomify.com/CVE-2007-4559/): Path traversal in n/a (critical 9.8)
- [CVE-2017-17522](https://insights.sbomify.com/CVE-2017-17522/): Command injection in n/a (high 8.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2018-20852 and fix it if it is affected.

What it is: CVE-2018-20852 is a medium-severity vulnerability in Python Python, published on 13 Jul 2019. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2018-20852 in the wild and no public exploit code.

Affected product: Python Python. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2018-20852/ (Markdown: https://insights.sbomify.com/CVE-2018-20852/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2018-20852
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2018-20852
- OSV: https://osv.dev/vulnerability/CVE-2018-20852

---
From sbomify Insights: https://insights.sbomify.com/CVE-2018-20852/
Summaries are generated and may contain mistakes; the official description above is the record.
