# CVE-2016-20021: Gentoo Portage missing PGP validation of executed code

> Attackers can execute arbitrary code via emerge-webrsync because it fails to verify PGP signatures on downloaded files.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 12 Jan 2024
- **Updated:** 3 Jun 2025
- **Also known as:** GHSA-pw5x-x5jw-ccmh, PYSEC-2024-10

## What is CVE-2016-20021?

CVE-2016-20021 is a critical vulnerability in n/a, published on 12 Jan 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

In Gentoo Portage before 3.0.47, there is missing PGP validation of executed code: the standalone emerge-webrsync downloads a .gpgsig file but does not perform signature verification. Unless emerge-webrsync is used, Portage is not vulnerable.

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

## Which versions are affected by CVE-2016-20021?

3 open source packages ship an affected version, including portage. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `portage` | PyPI | All versions | 3.0.47 |
| `portage` | PyPI | All versions | 3.0.47 |
| `portage` | PyPI | All versions | 3.0.47 |

Products: Gentoo Portage.

## How do I fix CVE-2016-20021?

Upgrade portage to 3.0.47 or later.

## Is CVE-2016-20021 being exploited?

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

## Other vulnerabilities in n/a

- [CVE-2013-2100](https://insights.sbomify.com/CVE-2013-2100/): Gentoo Portage does not verify X.509 certificates from SSL servers (critical 9.3)
- [CVE-2004-2778](https://insights.sbomify.com/CVE-2004-2778/): Privilege escalation in n/a (high 7.1)
- [CVE-2008-4394](https://insights.sbomify.com/CVE-2008-4394/): Path traversal in n/a (medium 6.9)
- [CVE-2019-20384](https://insights.sbomify.com/CVE-2019-20384/): Race condition in n/a (medium 5.5)
- [CVE-2007-6249](https://insights.sbomify.com/CVE-2007-6249/): Information disclosure in n/a (low 2.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2016-20021 and fix it if it is affected.

What it is: CVE-2016-20021 is a critical vulnerability in n/a, published on 12 Jan 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2016-20021 in the wild and no public exploit code.

Affected packages and fixed versions:
- portage (PyPI): affected all versions; fixed in 3.0.47
- portage (PyPI): affected all versions; fixed in 3.0.47
- portage (PyPI): affected all versions; fixed in 3.0.47

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

## Sources

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

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