# CVE-2019-15796: python-apt downloads from untrusted sources

> The python-apt library fails to verify repository signatures, allowing attackers to install malicious packages from unsigned sources.

- **Severity:** Medium 4.7 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/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:** 26 Mar 2020
- **Updated:** 16 Sep 2024
- **Also known as:** DEBIAN-CVE-2019-15796, GHSA-pj65-3pf6-c5q4, UBUNTU-CVE-2019-15796

## What is CVE-2019-15796?

CVE-2019-15796 is a medium-severity vulnerability in Canonical Python-apt, published on 26 Mar 2020. 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

Python-apt doesn't check if hashes are signed in `Version.fetch_binary()` and `Version.fetch_source()` of apt/package.py or in `_fetch_archives()` of apt/cache.py in version 1.9.3ubuntu2 and earlier. This allows downloads from unsigned repositories which shouldn't be allowed and has been fixed in verisions 1.9.5, 1.9.0ubuntu1.2, 1.6.5ubuntu0.1, 1.1.0~beta1ubuntu0.16.04.7, 0.9.3.5ubuntu3+esm2, and 0.8.3ubuntu7.5.

Weakness: CWE-347 (Improper Verification of Cryptographic Signature), CWE-287 (Improper Authentication)

## Which versions are affected by CVE-2019-15796?

10 open source packages ship an affected version, including python-apt. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `python-apt` | PyPI | All versions | 0.8.3ubuntu7.5 |
| `python-apt` | PyPI | All versions | 0.8.3ubuntu7.5 |
| `python-apt` | PyPI | From 0.9.0 | 0.9.3.5ubuntu3 |
| `python-apt` | PyPI | From 0.9.0 | 0.9.3.5ubuntu3 |
| `python-apt` | PyPI | From 1.2.0 | 1.6.5ubuntu0.1 |
| `python-apt` | PyPI | From 1.2.0 | 1.6.5ubuntu0.1 |
| `python-apt` | PyPI | From 1.7.0 | 1.9.0ubuntu1.2 |
| `python-apt` | PyPI | From 1.7.0 | 1.9.0ubuntu1.2 |
| `python-apt` | PyPI | From 1.9.1 | 1.9.5 |
| `python-apt` | PyPI | From 1.9.1 | 1.9.5 |

Products: Debian Python-Apt, Ubuntu Python-Apt.

## How do I fix CVE-2019-15796?

Upgrade python-apt to a fixed version for your release line: 0.8.3ubuntu7.5, 0.9.3.5ubuntu3, 1.6.5ubuntu0.1 or 1.9.0ubuntu1.2.

## Is CVE-2019-15796 being exploited?

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

## Other vulnerabilities in Canonical Python-apt

- [CVE-2019-15795](https://insights.sbomify.com/CVE-2019-15795/): python-apt uses MD5 for validation (medium 4.7)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2019-15796 and fix it if it is affected.

What it is: CVE-2019-15796 is a medium-severity vulnerability in Canonical Python-apt, published on 26 Mar 2020. 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-2019-15796 in the wild and no public exploit code.

Affected packages and fixed versions:
- python-apt (PyPI): affected all versions; fixed in 0.8.3ubuntu7.5
- python-apt (PyPI): affected all versions; fixed in 0.8.3ubuntu7.5
- python-apt (PyPI): affected from 0.9.0; fixed in 0.9.3.5ubuntu3
- python-apt (PyPI): affected from 0.9.0; fixed in 0.9.3.5ubuntu3
- python-apt (PyPI): affected from 1.2.0; fixed in 1.6.5ubuntu0.1
- python-apt (PyPI): affected from 1.2.0; fixed in 1.6.5ubuntu0.1
- python-apt (PyPI): affected from 1.7.0; fixed in 1.9.0ubuntu1.2
- python-apt (PyPI): affected from 1.7.0; fixed in 1.9.0ubuntu1.2
- python-apt (PyPI): affected from 1.9.1; fixed in 1.9.5
- python-apt (PyPI): affected from 1.9.1; fixed in 1.9.5

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-2019-15796/ (Markdown: https://insights.sbomify.com/CVE-2019-15796/index.md)
```

## Sources

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

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