Cargo Ecosystem Dependency-Vulnerability Knowledge Graph Construction and Vulnerability Propagation Study

Peiyang Jia, Chengwei Liu, Hongyu Sun, Chengyi Sun, Mianxue Gu, Yang Liu, Yuqing ZhangarXiv 2022 · DOI

Abstract

This study investigates the propagation of vulnerabilities within the Rust (Cargo) ecosystem. By constructing a large-scale dependency-vulnerability knowledge graph and simulating Cargo's semantic versioning resolution, the researchers found that nearly 20% of package versions are affected by downstream vulnerabilities. The findings highlight the significant impact of transitive dependencies and the persistence of memory-related vulnerabilities in a memory-safe language.

Introduction

As software development increasingly relies on third-party libraries, the "software supply chain" has become a primary target for attackers. While ecosystems like npm and PyPI have been heavily studied, the Rust ecosystem—managed by Cargo—has remained relatively opaque. Cargo's complex Semantic Versioning (SemVer) rules, optional features, and development-only dependencies make simple static analysis prone to false positives. This paper maps out how vulnerabilities spread through the Cargo web using a rule-aware approach.

Methodology

The researchers developed a multi-step pipeline to model the ecosystem accurately.

Knowledge Graph Construction

Using Neo4j, they built a graph containing over 570,000 nodes and 4 million edges. This graph links libraries, specific versions, and known CVEs (Common Vulnerabilities and Exposures), providing a comprehensive map of the ecosystem's security state.

Conceptual structure of the dependency-vulnerability knowledge graph.

Resolution Logic and Propagation Path

A novel algorithm was designed to simulate Cargo’s official resolution logic, evaluating version ranges and filtering out development-only dependencies. By starting at a known vulnerable library and working backward through the dependency tree, the algorithm identifies every "upstream" package that would pull in the vulnerability during a standard installation.

Data Sources

The study utilized two primary data sources:

  • crates.io: Extracted metadata for 75,922 libraries and 494,290 versions.
  • GitHub Advisory Database: Identified 351 verified vulnerabilities specifically affecting Rust.

Key Insights

Despite Rust's memory-safety guarantees, vulnerabilities remain primarily memory-related (e.g., Use-after-free) due to unsafe blocks in low-level libraries. Furthermore, the spread of vulnerabilities through transitive dependencies is roughly ten times greater than through direct dependencies. Alarmingly, 18% of affected libraries still harbor vulnerabilities in their latest released versions, and only 1.7% of these were "yanked" by maintainers.

Key Results

The analysis revealed that 28.61% of all libraries in the Cargo ecosystem are affected by at least one vulnerability via propagation. Approximately 19.78% of all package versions uploaded to crates.io are influenced by a vulnerability.

Distribution of vulnerability severity levels across the Cargo ecosystem.

As shown in the figure above, a significant majority (78.8%) of identified vulnerabilities are classified as "High" or "Critical" risk. The most common vulnerability type was CWE-416 (Use After Free). Encouragingly, 82% of affected libraries could be secured simply by updating to a newer version, indicating that fixes are available but not widely adopted.

Conclusion and Future Work

The study is limited by the computational depth of dependency trees and the coverage of public CVE databases. Future work will focus on deeper multi-level propagation analysis and integrating more diverse vulnerability databases like RUSTSEC to provide a more comprehensive security map for the Rust community.

Summary updated

BibTeX
@misc{jia2022cargo,
  author = {Peiyang Jia and Chengwei Liu and Hongyu Sun and Chengyi Sun and Mianxue Gu and Yang Liu and Yuqing Zhang},
  title = {{Cargo Ecosystem Dependency-Vulnerability Knowledge Graph Construction and Vulnerability Propagation Study}},
  year = {2022},
  eprint = {2210.07482},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.07482},
}
Figure