Policy & Community

Rust Foundation tests decision models to automate malicious crate detection

Key Takeaway

The Rust Foundation is piloting the use of fast, low-cost decision models to scan the crates.io firehose for malicious code to assist human security reviewers.

Summary

The Rust Foundation has launched an exploratory security initiative to combat software supply chain attacks by scanning new crates as they are published to crates.io. Instead of using large language models (LLMs), which are computationally expensive and slow, the project utilizes decision models to assign a maliciousness score between 0.0 and 1.0 to each crate.

This automated scanning process does not trigger immediate deletions; rather, it flags suspicious packages for manual review by the crates.io team, the Rust security response working group, or RustSec. The foundation is currently running this experiment against the entire volume of crates published in late 2026 to determine if the cost-to-accuracy ratio justifies a permanent implementation.

Technical implementation and scoring results

  • Model Architecture: The system uses decision models rather than LLMs because they are faster and more cost-effective for processing the high-volume crates.io 'firehose' of data.
  • Scoring Mechanism: Each crate receives a score from 0.0 to 1.0 based on its likelihood of being actively malicious, utilizing limited context from known previous malware campaigns.
  • Threshold Calibration: Initial testing shows that lower thresholds (e.g., ≥ 0.35) produce high false-positive rates (99%), whereas a threshold of ≥ 0.7 or higher is required to minimize noise for human reviewers while still capturing malicious files.
  • Data Privacy and Retention: The scanning service does not store crate file contents; it only retains the crate name, version, file list, and the generated score.
  • Known Limitations: The models currently struggle with crates containing significant embedded non-source data, which the system tends to over-score because it cannot analyze the data's intent.

Why it matters

This initiative strengthens the Rust ecosystem by providing a scalable way to identify supply chain threats before they reach widespread use. If successful, it provides a blueprint for other package registries to implement low-cost, AI-driven security auditing without the prohibitive costs of traditional LLM inference.

Original reference: rustfoundation.org →