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.
- 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
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
Which versions are affected by CVE-2022-46176?
2 open source packages ship an affected version, including cargo. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
cargo crates.io | All versions | 0.67.1 |
cargo crates.io | All versions | 0.67.1 |
Linux distribution packages (12)
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 include 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 Crates in third party registries can override the cached source of other crates
- CVE-2022-36114 Extracting malicious crates can fill the file system
- CVE-2022-36113 Extracting malicious crates can corrupt arbitrary files
- CVE-2026-5222 Cargo can be coerced to share credentials between registries
Sources
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 and 4 more.