The Rust ecosystem faces serious supply chain attack risks similar to those that have hit JavaScript packages. Key attack vectors include compromised developer credentials, typosquatting on crates.io, malicious procedural macros that execute at compile time (even when just opening a project in an editor), and backdoored build.rs files. A notable finding: 17% of the 999 most popular crates contain code that doesn't match their source repositories. Mitigations include using Dev Containers to sandbox development environments, storing secrets in password managers, publishing packages only from CI/CD pipelines, fetching dependencies directly from source repositories using Cargo.toml patch overrides, and auditing dependencies with cargo-audit and cargo-vet. The author argues Rust needs an extended standard library (stdx) to reduce dependency sprawl, pointing to Go's comprehensive stdlib and checksum database as the gold standard for supply chain security.

14m read timeFrom kerkour.com
Post cover image
Table of contents
Understanding the attack surfaceTargeting and initial accessWhere we should goWhat you can do today to mitigate supply chain attacksSome Closing Thoughts
1 Comment

Sort: