· AI dev tools
Rust Foundation uses decision models to scan crates, flagging potentially malicious crates
The system is currently tracking 135,548 crate files that have been scanned, with the current effort aiming to cover all publications from November 1st through December 31st, having already…
The system is currently tracking 135,548 crate files that have been scanned, with the current effort aiming to cover all publications from November 1st through December 31st, having already processed every file published between November 11th and November 21st, inclusive.
Amidst the increasingly challenging landscape of software supply chains, the Rust Foundation is funding research into employing decision models to automatically examine crates immediately after they are released, flagging any that might be malicious for human assessment. This scanner has been operational on the stream of new crates for over a week now, and the initial findings are detailed below.
Decision models have gained considerable traction over the past two or three months as an alternative approach to the conversational AI interfaces that have dominated artificial intelligence tasks recently. Unlike models that generate open-ended text based on natural language prompts, these decision models are inherently restricted to selecting from a predefined set of outcomes or assigning a score to a given query. Significantly, they operate both faster and more economically than large language models, which makes it financially viable for the Rust Foundation to process every single crate without incurring prohibitive costs.
As soon as decision models became broadly accessible, experimentation commenced, involving the refinement of prompts, devising methods to segment crates to fit within a limited context window while retaining meaningful results, projecting the cost of running this against the entire crates.io feed based on crate publication growth, and evaluating the results to determine if they were reliable enough to warrant the necessary human review. After analyzing a dataset comprising roughly 1,000 crate files—a mix of those previously identified as malicious from past removals, those known to be safe, and randomly selected crates from October publications—the conclusion was reached that the process was both economical and effective enough to justify a more extensive, albeit more costly, trial: subjecting every crate released in November and December to the decision model.
Before delving into the initial outcomes, it is important to clarify what this project does not entail. No automated actions are taken based on these scans. Essentially, the findings are treated identically to any standard third-party report suggesting a crate might be harmful; a team member from crates.io or someone involved with the Rust Foundation’s security initiative will examine the crate file, and should action be deemed necessary, the standard removal procedure is initiated. This procedure involves the crates.io team for the mechanics of the removal, the Rust security response working group for any security consultation, and RustSec for issuing advisories to inform users about the takedown. Furthermore, the scanning service does not retain the actual content of the crate after the initial scan is finished; only the crate's name, version number, a list of its internal file names, and the resulting score are kept. Any future comparative work will only involve crates that remain available at that time.
The decision model is tasked with assigning a score between 0.0 and 1.0 indicating the likelihood that a crate is malicious—it is specifically designed to detect active maliciousness, not bugs or unintended security issues, using only very limited context derived from prior malware campaigns observed. The process of establishing the cutoff point where human intervention becomes necessary remains an ongoing effort. Based on the preliminary assessment, the threshold was initially set at 0.35, as there was a suspicion that this point would likely generate more false positives than desired. (This suspicion proved correct.) Currently, a threshold at or above 0.7 for this specific model and prompt combination seems likely to yield the desired outcome: maintaining a relatively low level of noise for the human reviewers while still successfully identifying malware.
Naturally, this only accounts for what is detected; quantifying false negatives in any automated fashion is practically impossible due to the sheer volume of crates requiring manual inspection, the infrequency of malicious crates making random sampling ineffective, and the prohibitive expense associated with utilizing cutting-edge LLMs. Over a longer period, however, a sense of false negatives might be gleaned from other reports that crates.io receives. We extend our gratitude to the wider security community—comprising corporations, non-profits, and individuals—who conduct their own vetting and submit those reports! While commonly utilized crates tend to generate reports swiftly, it is not unusual for several months to pass for crates that see little to no usage. A comprehensive review and evaluation of the false negative rate is scheduled for January, assuming more data will be available by then.
On a granular level, there remains substantial room for experimentation with different prompts and models in the coming weeks and months. We have already identified specific failure patterns with the current setup: because the model lacks genuine reasoning capacity, it tends to assign high scores to crates containing substantial embedded data that is not source code, as it cannot analyze the nature or function of that data. Although financial constraints prevent running parallel prompt and model configurations across the entire crate corpus during the experimental phase, subsets of crates are slated to be sent to other configurations to further enhance the scoring accuracy.
Should the results of this experiment demonstrate tangible value in continuing this scanning method, the plan is to seek partnerships and/or sponsorship in early 2027 to fund the ongoing operation and further development of this initiative, which would include revisiting the complete historical catalog of crates. On a broader scale, the belief is that opportunities exist to correlate this data with other security indicators that are derived without relying on AI. Crate provenance information, metadata generated from maintainer activities, and the capability analysis of the crates themselves are all active research domains, pursued both within the Rust Foundation, across ecosystems supported by organizations such as OpenSSF and Alpha-Omega, and by commercial entities. Integrating these various signals holistically opens avenues for faster responses to malware, especially when combined with ongoing efforts at crates.io, such as RFC 4016 (Registry withholding), which is currently in its final comment period. Ultimately, irrespective of the outcome of this specific trial, this kind of work is considered vital for the security and overall success of Rust, and indeed, of software development itself, and we look forward to continuing this endeavor.
Why it matters
This initiative represents a proactive effort to bolster the software supply chain against malicious packages. For developers relying on crates.io, this automated screening aims to increase the security posture of dependencies. Future evaluations will provide more data on the system's effectiveness against threats.





