Earlier this week, the Rust open-source ecosystem was targeted in a supply-chain attack that injected build-time malware into widely used crates—packages in Rust’s package registry. The incident involved three compromised crate versions amounting to over 245 million total downloads. The malicious releases were published on August 20, 2026, and removed within one to two hours.
How the Attack Worked
The crates affected—[email protected], [email protected], and [email protected]—were published under a single account on crates.io. The attacker added a dependency on a crate named proc-macro1, which is a typosquat of the legitimate proc-macro2, in the manifest of each compromised crate. Although proc-macro1 contains identical library source code to proc-macro2, its build script reassembles a remote payload and executes it during compilation—even if no functions in the malicious crate are directly called. This means simply building a project that depends on any of those versions triggers the payload.
The malicious build script had several behaviors: disabling TLS certificate validation, reconstructing the payload host and command-and-control (C2) server address at build time, then launching platform-specific payloads. On Unix and macOS, the script writes an executable to /tmp/rust-setup; on Windows, it drops a PowerShell script into %TEMP% and runs it via hidden VBScript. The attacker ensures the build script executes without waiting for it to finish on Windows, escaping build-tool limitations.
Scope, Exposure, and Mitigation
The three malicious versions were live for 86, 90, and 107 minutes respectively before crates.io removed them. Over that time, many projects could have pulled the compromised versions: arrayref alone has around 245,385,500 total downloads and more than 50 million downloads just in the 90 days ending August 20. Additionally, 403 other crates depend on arrayref, meaning dependency chains could have silently introduced the malicious code. One example chain leads from winit through tiny-skia to [email protected], and because 0.3.10 fits into the allowed version range, projects using that caret range were vulnerable.
The code that was added to facilitate this attack had indicators for a broad range of operating systems and architectures. On Windows it disabled waiting during execution, on macOS and Linux it used different persistence mechanisms—Registry Run keys on Windows, LaunchAgent on macOS, and systemd user services on Linux—to maintain persistence. Among its capabilities were disabling TLS checks, downloading further scripts, reconfiguring the C2 server, and stealing browser credentials from Chrome, Brave, and Edge.
The Rust Security Response Team acted swiftly: the malicious crates were detected at 07:15 UTC, August 20, 2026, and removed soon after. The source of the alert was a researcher group. The maintainers of the crates were suspected to have had their credentials compromised rather than acting maliciously themselves. Developers are being asked to pin dependencies to safe versions (for example, [email protected] or earlier), remove any identical crate files from the Cargo registry cache, and check development environments closely.
No CVE, But Clear Risk
No Common Vulnerabilities and Exposures (CVE) identifier has been issued, and so far there’s no evidence that the malicious versions were actively used in the wild. The incident has been catalogued in the RustSec advisories, which also note the lack of evidence for exploitation. However, the methodology laid out in the malware—including typosquatting, manipulated version ranges, and automatic code execution at build time—marks a dangerous new vector for supply-chain attacks in programming ecosystems.
One safety measure that was discussed prior to this attack is a proposed “publish cooldown” feature in Cargo that would delay newly published dependencies from being immediately usable, allowing time for review. A related pull request implementing such a global publication age limit entered its final comment period on August 18, 2026—just two days before the attack. That request remains unmerged.
What to Do Now: Cargo users are strongly advised to:
- Search and delete any malicious crate files from
~/.cargo/registry/cache. - Pin the
arrayrefcrate to version 0.3.9 or earlier. - Review all build scripts or dependencies that may have transitively pulled the malicious versions.
- Track updates from crates.io and RustSec for fixes or advisories.
The attack underscores how rapidly and subtly build-time code can introduce failures or malware—even in mature ecosystems like Rust.
Broader Implications
This attack is not an isolated case but part of a growing trend: LLVM-style supply-chain breaches targeting package managers like npm. The incident shares characteristics with other recent compromises, including typosquatting, impersonation, and manipulated dependency chains. It raises serious questions about how open-source platforms authenticate maintainers, monitor new releases, and handle emergent threats before they inflict damage.
This event should serve as a wake-up call for developers and platform maintainers. Libraries frequently used across multiple projects—even if seemingly trivial—can become vectors for widespread compromise. Improving transparency into build scripts, faster detection of anomalous behavior, tighter controls on publishing privileges, and adoption of safeguards like publish cooldowns may help prevent similar breaches. Going forward, the speed and complexity of supply-chain attacks demand continual vigilance and better tooling around dependency management.