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

Medium 5.3 Published Updated

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.

PackageAffectedFixed in
cargo crates.ioAll versions0.67.1
cargo crates.ioAll versions0.67.1
Linux distribution packages (12)
rust1.65 SUSE:Enterprise Storage 7.1All versions1.65.0-150300.7.9.1
rust1.65 SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOSAll versions1.65.0-150300.7.9.1
rust1.65 SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSSAll versions1.65.0-150300.7.9.1
rust1.65 SUSE:Linux Enterprise Module for Development Tools 15 SP4All versions1.65.0-150300.7.9.1
rust1.66 SUSE:Linux Enterprise Module for Development Tools 15 SP4All versions1.66.0-150400.9.9.1
rust1.65 SUSE:Linux Enterprise Real Time 15 SP3All versions1.65.0-150300.7.9.1
rust1.65 SUSE:Linux Enterprise Server 15 SP3-LTSSAll versions1.65.0-150300.7.9.1
rust1.65 SUSE:Linux Enterprise Server for SAP Applications 15 SP3All versions1.65.0-150300.7.9.1
rust1.65 openSUSE:Leap 15.4All versions1.65.0-150300.7.9.1
rust1.66 openSUSE:Leap 15.4All versions1.66.0-150400.9.9.1
rust1.65 openSUSE:TumbleweedAll versions1.65.0-4.1
rust1.66 openSUSE:TumbleweedAll versions1.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.

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.

Is CVE-2022-46176 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free