# GHSA-r7vq-6425-j94w: Python-TUF vulnerable to incorrect threshold signature computation for new root metadata

> Attackers can bypass root metadata signature thresholds by using multiple signatures from a single new key, potentially compromising software update integrity.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 15 Sep 2022

## What is GHSA-r7vq-6425-j94w?

GHSA-r7vq-6425-j94w is a vulnerability in tuf, published on 15 Sep 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact

The function `_verify_root_self_signed()`, introduced in [v0.14.0](https://github.com/theupdateframework/tuf/releases/tag/v0.14.0), and which verifies self-signatures in a new root metadata file, counted multiple signatures by any new root key towards the new threshold. That is, any single new root key could theoretically provide enough signatures to meet the threshold for new key self-signatures required during root metadata update.

A scenario where this attack could be relevant is amazingly unlikely in practice to the point where labeling this issue as a security advisory is potentially overstating the impact of the issue. Given that new root keys only become trusted by the client after a successful root metadata update, which also requires the quorum of signatures from old trusted root keys, this issue has been evaluated as low in severity.

In particular, in order to exploit this vulnerability, an attacker must:

1. Control one new root key.
2. Craft a new root metadata file such that there is a number of signatures by this new root key greater than or equal to the new threshold.
3. Cause a valid threshold of the old root keys to sign this new root metadata file.
4. Cause this new root metadata file to be published on the repository.
5. Cause clients to rotate to this new root metadata file.

### Patches
A [fix](https://github.com/theupdateframework/tuf/commit/83ac7be525b733f79a7e9bc573ec580ec835f179) is available since [version 0.16.0](https://github.com/theupdateframework/tuf/releases/tag/v0.16.0).

### Workarounds
No workarounds are known for this issue.

### References
* Pull request resolving the issue [PR 1218](https://github.com/theupdateframework/tuf/pull/1218)
* Pull request which introduced the faulty computation of signature threshold on new root metadata [PR 1101](https://github.com/theupdateframework/tuf/pull/1101)
* A similar previous issue with incorrectly computed signature thresholds in tuf is described in [GHSA-pwqf-9h7j-7mv8](https://github.com/theupdateframework/tuf/security/advisories/GHSA-pwqf-9h7j-7mv8)

## Which versions are affected by GHSA-r7vq-6425-j94w?

2 open source packages ship an affected version, including tuf.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `tuf` | PyPI | From 0.14.0 | 0.16.0 |
| `tuf` | PyPI | From 0.14.0 | 0.16.0 |

## How do I fix GHSA-r7vq-6425-j94w?

Upgrade tuf to 0.16.0 or later.

## Is GHSA-r7vq-6425-j94w being exploited?

There is no known exploitation of GHSA-r7vq-6425-j94w in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-r7vq-6425-j94w and fix it if it is affected.

What it is: GHSA-r7vq-6425-j94w is a vulnerability in tuf, published on 15 Sep 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-r7vq-6425-j94w in the wild and no public exploit code.

Affected packages and fixed versions:
- tuf (PyPI): affected from 0.14.0; fixed in 0.16.0
- tuf (PyPI): affected from 0.14.0; fixed in 0.16.0

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/GHSA-r7vq-6425-j94w/ (Markdown: https://insights.sbomify.com/GHSA-r7vq-6425-j94w/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-r7vq-6425-j94w

---
From sbomify Insights: https://insights.sbomify.com/GHSA-r7vq-6425-j94w/
Summaries are generated and may contain mistakes; the official description above is the record.
