# CVE-2022-46176: Cargo did not verify SSH host keys

> Cargo failed to verify SSH host keys, allowing attackers to perform man-in-the-middle attacks and potentially inject malicious code during dependency cloning.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/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:** 11 Jan 2023
- **Updated:** 10 Mar 2025
- **Also known as:** ALPINE-CVE-2022-46176, AZL-12969, CLEANSTART-2026-KA82053, DEBIAN-CVE-2022-46176, GHSA-r5w3-xm58-jv6j, SUSE-SU-2023:0132-1, SUSE-SU-2023:0133-1, UBUNTU-CVE-2022-46176, openSUSE-SU-2024:12607-1, openSUSE-SU-2024:12608-1

## What is CVE-2022-46176?

CVE-2022-46176 is a medium-severity vulnerability in rust-lang cargo, published on 11 Jan 2023. 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 is a Rust package manager. The Rust Security Response WG was notified that Cargo did not perform SSH host key verification when cloning indexes and dependencies via SSH. An attacker could exploit this to perform man-in-the-middle (MITM) attacks. This vulnerability has been assigned CVE-2022-46176. All Rust versions containing Cargo before 1.66.1 are vulnerable. Note that even if you don't explicitly use SSH for alternate registry indexes or crate dependencies, you might be affected by this vulnerability if you have configured git to replace HTTPS connections to GitHub with SSH (through git's [`url.<base>.insteadOf`][1] setting), as that'd cause you to clone the crates.io index through SSH. Rust 1.66.1 will ensure Cargo checks the SSH host key and abort the connection if the server's public key is not already trusted. We recommend everyone to upgrade as soon as possible.

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

## Which versions are affected by CVE-2022-46176?

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.67.1 |
| `cargo` | crates.io | All versions | 0.67.1 |
| `rust1.65` | SUSE:Enterprise Storage 7.1 | All versions | 1.65.0-150300.7.9.1 |
| `rust1.65` | SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOS | All versions | 1.65.0-150300.7.9.1 |
| `rust1.65` | SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | All versions | 1.65.0-150300.7.9.1 |
| `rust1.65` | SUSE:Linux Enterprise Module for Development Tools 15 SP4 | All versions | 1.65.0-150300.7.9.1 |
| `rust1.66` | SUSE:Linux Enterprise Module for Development Tools 15 SP4 | All versions | 1.66.0-150400.9.9.1 |
| `rust1.65` | SUSE:Linux Enterprise Real Time 15 SP3 | All versions | 1.65.0-150300.7.9.1 |
| `rust1.65` | SUSE:Linux Enterprise Server 15 SP3-LTSS | All versions | 1.65.0-150300.7.9.1 |
| `rust1.65` | SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | All versions | 1.65.0-150300.7.9.1 |
| `rust1.65` | openSUSE:Leap 15.4 | All versions | 1.65.0-150300.7.9.1 |
| `rust1.66` | openSUSE:Leap 15.4 | All versions | 1.66.0-150400.9.9.1 |
| `rust1.65` | openSUSE:Tumbleweed | All versions | 1.65.0-4.1 |
| `rust1.66` | openSUSE:Tumbleweed | All versions | 1.66.0-2.1 |

Products: Rust-Lang Cargo.

## How do I fix CVE-2022-46176?

Upgrade cargo to 0.67.1 or later.

## Is CVE-2022-46176 being exploited?

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

## Other vulnerabilities in rust-lang 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-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)
- [CVE-2026-5222](https://insights.sbomify.com/CVE-2026-5222/): Cargo can be coerced to share credentials between registries (low 2.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-46176 and fix it if it is affected.

What it is: CVE-2022-46176 is a medium-severity vulnerability in rust-lang cargo, published on 11 Jan 2023. 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-2022-46176 in the wild and no public exploit code.

Affected packages and fixed versions:
- cargo (crates.io): affected all versions; fixed in 0.67.1
- cargo (crates.io): affected all versions; fixed in 0.67.1

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

## Sources

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

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