Cargo Package Renaming Vulnerability in Rust

rust Updated 02 Oct 2025

Summary

30/09/2019
N/A
Yes i
High
7.5

CVE-2019-16760: Cargo prior to Rust 1.26.0 may download the wrong dependency if your package.toml file uses the package configuration key. Affects rust across 2 version ranges.

< 1.26.0-r0 < a7756804103447ea4e68a71ccf071e7ad8f7a03e

Fixed in 1.26.0-r0. 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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Rust is a programming language that focuses on safety, speed, and concurrency. It is widely used for developing system software, embedded systems, and web applications. Cargo is the package manager and build system for Rust. It manages dependencies and compiles Rust projects. However, prior to Rust 1.26.0, Cargo had a vulnerability related to package renaming in the package.toml file.

Vulnerability Detail

The vulnerability, identified as CVE-2019-16760, arises when using the package configuration key in the package.toml file. In Rust versions 1.25.0 and earlier, the package key is ignored, causing Cargo to download the wrong dependency. This issue affects both locally written manifests and manifests published to crates.io. An attacker could exploit this vulnerability by squatting on crates.io and providing a malicious package, which could lead to various security risks. Rust versions 1.0.0 through 1.25.0 are affected, while versions 1.26.0 and newer are not. Users are strongly advised to update their compiler to the latest available version to prevent this issue.

How To Fix

Minimum fixed version

1.26.0-r0

This is the first release that contains the fix.

sudo apk add --upgrade rust

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

Workaround

There is no specific workaround mentioned for this vulnerability.

Conclusion

The Cargo package renaming vulnerability in Rust (CVE-2019-16760) can lead to the download of incorrect dependencies, potentially exposing projects to malicious packages. Users are strongly advised to update their Rust compiler to version 1.26.0 or newer to mitigate this vulnerability. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for rust →

Share this vulnerability

FAQ

Rust is a programming language known for its focus on safety, speed, and concurrency. It is widely used for developing system software, embedded systems, and web applications.

Cargo is the package manager and build system for Rust. It manages dependencies and compiles Rust projects.

The package key in the package.toml file is used to rename dependencies in Cargo. However, prior to Rust 1.26.0, this key was ignored, leading to the vulnerability described in CVE-2019-16760.

An attacker can exploit this vulnerability by squatting on crates.io and providing a malicious package. When Cargo ignores the package key, it may download the wrong dependency, which could be the attacker's malicious package.

To protect your Rust project, it is crucial to update your compiler to Rust 1.26.0 or newer. Additionally, ensure that the package key is used correctly in the package.toml file.

Related vulnerabilities

Recent vulnerabilities recorded for rust.

How To Fix

Minimum fixed version

1.26.0-r0

This is the first release that contains the fix.

sudo apk add --upgrade rust

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