# CVE-2026-5222: Cargo can be coerced to share credentials between registries

> Attackers can steal registry credentials by exploiting URL normalization flaws in Cargo when multiple registries share a domain.

- **Severity:** Low 2.3 (`CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:N/VA:N/SC:L/SI:N/SA: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:** 25 May 2026
- **Updated:** 26 May 2026
- **Also known as:** ALPINE-CVE-2026-5222, AZL-88275, AZL-88281, BELL-CVE-2026-5222, DEBIAN-CVE-2026-5222, GHSA-p688-r7jv-fm6f, MINI-grfw-7pq8-2349, UBUNTU-CVE-2026-5222

## What is CVE-2026-5222?

CVE-2026-5222 is a low-severity vulnerability in Rust Cargo, published on 25 May 2026. 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

Cargo between 1.68 and 1.96 incorrectly normalized the URLs of third-party registries using the sparse index protocol. If a hosting provider allowed multiple registries to be hosted with arbitrary names within the same domain, an attacker able to publish crates in a registry could obtain the credentials of others users of the same registry. The severity of the vulnerability is **low**, due to the extremely niche requirements needed to achieve the attack.

Weakness: CWE-647 (Use of Non-Canonical URL Paths for Authorization Decisions)

## Which versions are affected by CVE-2026-5222?

2 open source packages ship an affected version, including cargo. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `cargo` | crates.io | All versions | 0.97.0 |
| `cargo` | crates.io | All versions | 0.97.0 |

Products: Rust-Lang Cargo.

## How do I fix CVE-2026-5222?

Upgrade cargo to 0.97.0 or later.

## Is CVE-2026-5222 being exploited?

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

## Other vulnerabilities in Rust Cargo

- [CVE-2026-5223](https://insights.sbomify.com/CVE-2026-5223/): Crates in third party registries can override the cached source of other crates (medium 6.5)
- [CVE-2022-46176](https://insights.sbomify.com/CVE-2022-46176/): Cargo did not verify SSH host keys (medium 5.3)
- [CVE-2022-36114](https://insights.sbomify.com/CVE-2022-36114/): Extracting malicious crates can fill the file system (medium 4.8)
- [CVE-2022-36113](https://insights.sbomify.com/CVE-2022-36113/): Extracting malicious crates can corrupt arbitrary files (medium 4.6)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-5222 and fix it if it is affected.

What it is: CVE-2026-5222 is a low-severity vulnerability in Rust Cargo, published on 25 May 2026. 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-2026-5222 in the wild and no public exploit code.

Affected packages and fixed versions:
- cargo (crates.io): affected all versions; fixed in 0.97.0
- cargo (crates.io): affected all versions; fixed in 0.97.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/CVE-2026-5222/ (Markdown: https://insights.sbomify.com/CVE-2026-5222/index.md)
```

## Sources

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

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