Critical SSH Host Key Verification Vulnerability in Cargo Package Manager

cargo Updated 02 Oct 2025

Summary

11/01/2023
N/A
Yes i
Unrated
Not published

DEBIAN-CVE-2022-46176: Cargo is a Rust package manager. Affects cargo versions < 0.66.0+ds1-1. Fixed in 0.66.0+ds1-1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Cargo is the official package manager for the Rust programming language, designed to facilitate the management of Rust packages and their dependencies. It provides features such as dependency resolution, versioning, and package publishing. However, Cargo has a significant security flaw that affects its ability to verify SSH host keys when cloning repositories, potentially exposing users to man-in-the-middle attacks.

Vulnerability Detail

The vulnerability, identified as CVE-2022-46176, arises from Cargo's failure to perform SSH host key verification when cloning indexes and dependencies via SSH. This oversight allows an attacker to intercept and manipulate data during transmission, leading to potential unauthorized access or data corruption. All versions of Rust containing Cargo prior to 1.66.1 are affected, making it crucial for users to address this issue promptly.

How To Fix

Minimum fixed version

0.66.0+ds1-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade cargo

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, users can avoid using SSH for cloning repositories by configuring Git to use HTTPS instead. This can be done by executing the following command in the terminal:

git config --global url."https://".insteadOf "git@"

This configuration will redirect SSH requests to HTTPS, mitigating the risk associated with the vulnerability until a proper update can be applied.

Conclusion

The vulnerability CVE-2022-46176 in Cargo poses a significant risk due to its failure to verify SSH host keys, making it susceptible to man-in-the-middle attacks. Users are strongly advised to upgrade to the latest version to mitigate this risk and ensure the security of their projects.

See every vulnerability recorded for cargo →

Share this vulnerability

FAQ

CVE-2022-46176 is a vulnerability in the Cargo package manager that allows for man-in-the-middle attacks due to lack of SSH host key verification.

Any version of Cargo prior to 1.66.1 is vulnerable. You can check your version by running 'cargo --version' in the terminal.

Failing to address this vulnerability could allow attackers to intercept and manipulate data, leading to unauthorized access or data corruption.

Yes, you can use Vulert, which monitors and alerts for open-source vulnerabilities in your software without requiring access to the code. You can check your application against known vulnerabilities using the Vulert playground.

You can upgrade Cargo by running 'sudo apt update' followed by 'sudo apt install cargo' in your terminal to ensure you have the latest patched version.

Related vulnerabilities

Recent vulnerabilities recorded for cargo.

How To Fix

Minimum fixed version

0.66.0+ds1-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade cargo

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback