Safeguard
Supply Chain Security•

Rust Malware Today: Malicious Crates on crates.io and How to Check

Five Rust crates got GitHub malware advisories in November 2026 and RustSec logged ten removals. What they did, how build.rs runs them, and how to check.

Safeguard Security Team
23 min read

Yes, malicious Rust crates are still being published to crates.io. On 25 November 2026 the GitHub Advisory Database listed 26 malware advisories for the Rust ecosystem, and five of them were published this month, the newest on 19 November. RustSec, the Rust community's advisory database, published advisories for ten crates removed from crates.io for malicious code between 6 and 10 November. Every crate named in this month's advisories returns 404 from the crates.io API today, and all ten RustSec advisories report no evidence of actual usage. To check live, watch the RustSec advisory feed, the GitHub malware filter for Rust and OSV, then run cargo audit against every Cargo.lock you build.

The rest of this page covers what each recent crate did according to its advisory, why Rust malware usually fires at build time rather than when your program runs, and the exact commands to check a repository, a laptop and a CI runner today.

Key takeaways

  • Volume is low but steady. The GitHub Advisory Database had 26 Rust malware advisories in total when we pulled it at 17:59 UTC on 25 November 2026.
  • The biggest 2026 event was a hijacked maintainer account. On 20 August, arrayref 0.3.10 and two sibling crates added a dependency on proc-macro1, a typosquat of proc-macro2 whose build script ran a remote binary. RustSec says arrayref 0.3.10 was downloaded 2,285 times in about 86 minutes.
  • Build time is the delivery path. build.rs and procedural macros run on the machine that compiles your project, including cargo check and IDE loads.
  • Targets are credentials: environment variables, CI tokens, wallet files, Telegram sessions and keystrokes.
  • There is no fixed version. Remove the crate or pin back, and treat the build host as exposed.

What we saw on 25 November 2026

We pulled three primary sources on 25 November 2026 between 17:59 and 18:30 UTC:

  1. The GitHub Advisory Database REST API, filtered to type=malware&ecosystem=rust. It returned 26 advisories.
  2. The OSV bulk export for crates.io. It held 26 MAL- entries from the OpenSSF malicious-packages project and 1,549 RUSTSEC- entries of all kinds.
  3. RustSec entries in that export tagged with the category malicious. There were 85 in total, 42 of them published in 2026.

All counts below come from those pulls at that time. They will change as new advisories land.

November 2026: five new GitHub malware advisories

Published (GitHub)Crate and versionsAdvisory IDsWhat the advisory says it did
19 Novbesk 0.1.1GHSA-59c6-w34f-h244, MAL-2026-20253Ships a binary that walks the home directory, zips wallet and keystore files, and sends them to a Telegram chat and a hosted LLM API endpoint. Its dependencies stage keystroke capture.
13 Novhesk 0.1.0 and 0.1.1GHSA-m88c-p2p9-g3x9, MAL-2026-19201Two exported async functions zip home directory content, including wallet files, and upload it to a Telegram bot. The payload files are padded with about a hundred nonsense functions.
13 Novbasek 0.1.0GHSA-5v6h-mqm2-w74c, MAL-2026-19200A Windows keylogger packaged as a library. Sends keystrokes and the username to a Telegram bot, hides its token with XOR, and installs itself for persistence.
10 Novlwd-uri-util 0.1.0 to 0.1.7GHSA-8mh3-cf36-7xxq, MAL-2026-19058, RUSTSEC-2026-0483Advertised as a URI utility. Its build.rs dumps every environment variable plus hostname and username and POSTs them out with curl or PowerShell, on any cargo build, cargo check or IDE load.
9 Novenv-test-guard 0.2.0 and 0.3.0GHSA-7w47-jmjx-gvm2, MAL-2026-18776, RUSTSEC-2026-0469A Git test helper whose GitEnv::detect() reads CI tokens and sends them out. No build script; it fires when tests call that function on a CI runner.

The lwd-uri-util advisory says the build script only reported back when it saw markers of a release or signing workstation, such as FASTLANE_, APPLE_ID, ANDROID_KEYSTORE, SIGNING_CERT, CODE_SIGN or KEYCHAIN, and stayed quiet on generic CI usernames like runner or github. It was hunting the machines that hold publishing and signing credentials. RustSec says its eight versions were published on 9 November and removed about 12 hours later, with no evidence of actual usage.

The env-test-guard advisory lists the variables it read: GITHUB_TOKEN, GH_TOKEN, INPUT_GITHUB_TOKEN and INPUT_CLAUDE_CODE_OAUTH_TOKEN. The last one is how GitHub Actions passes a with: input named claude_code_oauth_token to a step. So it was written to take AI coding agent credentials from CI as well as GitHub tokens. RustSec says both versions were published on 24 and 25 March 2026, about eight months before removal.

November 2026: ten RustSec advisories

RustSec published ten malicious advisories in November. Besides env-test-guard and lwd-uri-util, eight had no GitHub malware advisory when we checked:

RustSec IDCrateAdvisory publishedCrate first published
RUSTSEC-2026-0466build_dep6 Nov3 Mar 2025
RUSTSEC-2026-0467top_level_crate6 Nov1 Mar 2025
RUSTSEC-2026-0468shinchina6 Nov1 Mar 2025
RUSTSEC-2026-0472shinchina-test6 Nov2 Mar 2025
RUSTSEC-2026-0471sec-gemini6 Nov19 Jun 2025
RUSTSEC-2026-0464webhook_commands9 Nov13 Feb 2026
RUSTSEC-2026-0465electrumd9 Nov26 Jan 2026
RUSTSEC-2026-0470gabby-types-sec9 Nov17 Feb 2026

RustSec says each of these tried to send telemetry from the build or execution environment to an arbitrary URL, and that none showed evidence of actual usage. The lesson is the age column: some sat on crates.io for 17 to 20 months before anyone flagged them. Quiet is not the same as reviewed.

GitHub's three newest advisories (besk, hesk, basek) had no RustSec entry in the OSV export we pulled. The crates.io API returns 404 for all three today, so they are no longer served.

The 2026 campaign that mattered: arrayref, internment, append-only-vec

The one Rust malware event of 2026 to remember is 20 August. Our arrayref and proc-macro1 breakdown has the detail; here is the short version.

  • An account calling itself dtolney, one letter off from the well-known maintainer dtolnay, published proc-macro1, a copy of proc-macro2 with a malicious build.rs. The GitHub advisory says the build script downloaded an architecture-specific binary from 23.254.165.112:9089 over TLS with certificate checks disabled, then ran it with 23.254.165.112:443 as its command and control address.
  • The same day, new releases of three real crates appeared from one maintainer account that, per the advisories, appears to have been compromised: arrayref 0.3.10, internment 0.8.7 and append-only-vec 0.1.9. Their own source was unchanged. Each simply added a dependency on proc-macro1, and Cargo compiles declared dependencies, so the build script ran.
  • RustSec says arrayref 0.3.10 was removed about 86 minutes after publication and was downloaded 2,285 times, under 10% of that crate's traffic, "as most users had older versions of arrayref in their lockfiles."
  • Support crates tinymember, aronenao, arone, aovine and proc-macro-en were removed as part of the same campaign.

The original report on the RustSec issue tracker notes that arrayref sits under tiny-skia, sctk-adwaita and winit, so it reaches a lot of Rust GUI work. The reporter also wrote that older arrayref releases had been yanked under the owner account at the time, so Cargo's prompt to move off a yanked version acted as the lure. The crates.io index shows 0.3.9 as not yanked today.

That point about lockfiles is the most useful lesson in this post: committed lockfiles are why most arrayref users never received the bad version.

Earlier in 2026

  • 15 September: logs-update posed as a progress bar library. When run, it sent .env files and documents to a remote API and, on Linux, added an attacker key to ~/.ssh/authorized_keys.
  • 9 October: sharpnes stole Telegram Desktop session data on Windows when a dependent called its exported function.
  • 18 July: GitHub published nine advisories for crates flagged by the OpenSSF Package Analysis project, several with versions like 99.0.1 on names that look like internal SDK crates (amzn-consolas-client, semantic-search-client, mysten-metrics). A very high version on an internal-looking name is the classic dependency confusion probe.
  • 6 September (RustSec only): one release each of greentic-setup (1.3.1-dev.34027618345) and greentic-setup-dev (1.3.34027618345) carried malware that, per RustSec, fired when a dependent project was opened in Visual Studio Code. Other releases of both crates are not covered by the advisories.

On 13 February 2026 the crates.io team changed its notification policy: no blog post for every malicious crate, but it will "always publish a RustSec advisory when a crate is removed for containing malware." The RustSec feed is the place to watch.

Why Rust malware runs at build time

Most Rust malicious crates do not wait for your program to call them. Cargo gives them two places to run code on the machine that compiles your project.

Build scripts. If a package has a build.rs, Cargo compiles and runs it before building the package. It runs as a normal native program with your permissions, your environment variables and network access. lwd-uri-util and proc-macro1 both lived here.

Procedural macros. A proc macro is compiled into a plugin that the compiler runs while expanding your code. It can read files, open sockets and spawn processes just like a build script.

Three things make these worse than they look. cargo check is enough to run them, because type checking needs their output. Your editor runs them too: rust-analyzer executes build scripts and proc macros when it loads a workspace, and the lwd-uri-util advisory lists "IDE load" as a trigger. And transitive is the default: nobody typed proc-macro1 into a Cargo.toml; a trusted crate declared it.

Some crates skip build time. env-test-guard, logs-update, sharpnes, hesk and besk ran only when called or when their binary was run, which is why they lean on believable names and README examples.

How to check yourself today

Run these on every repository, every machine that builds Rust and every CI runner image. All are free.

1. Grep every Cargo.lock

This prints each locked crate and version and keeps only names from the 2026 lists above.

find . -name Cargo.lock -not -path '*/target/*' | while read -r lock; do
  awk '/^name = /{n=$3} /^version = /{print n, $3}' "$lock" | tr -d '"' |
  grep -E '^(proc-macro1|proc-macro-en|tinymember|aronenao|arone|aovine|lwd-uri-util|env-test-guard|besk|hesk|basek|sharpnes|logs-update|build_dep|top_level_crate|shinchina|shinchina-test|sec-gemini|webhook_commands|electrumd|gabby-types-sec) |^arrayref 0\.3\.10$|^internment 0\.8\.7$|^append-only-vec 0\.1\.9$|^greentic-setup 1\.3\.1-dev\.34027618345$|^greentic-setup-dev 1\.3\.34027618345$' &&
  echo "  ^ in $lock"
done

No output means none of those crates is locked under the current directory. For a list that stays current, use the scanners in steps 3 and 4. Our guide on checking whether a package name appears in a malware advisory covers the general method.

2. Find out why a crate is there

If a name shows up, ask Cargo which of your dependencies pulled it in:

cargo tree -i arrayref --target all -e all
cargo tree -i proc-macro1 --target all -e all

-i inverts the tree so you see the path from the suspect crate up to your workspace. --target all -e all includes build, dev and platform-specific edges that a plain cargo tree hides.

3. Run cargo audit

cargo-audit checks Cargo.lock against the RustSec database:

cargo install cargo-audit --locked
cargo audit

RustSec files malicious crates as regular advisories with the category malicious, not as informational notices, so they appear in cargo-audit's vulnerability output and fail the run. It only sees what RustSec has, and the three newest GitHub advisories had no RustSec entry when we checked.

4. Run osv-scanner for the wider set

OSV-Scanner queries OSV, which merges RustSec, GitHub advisories and the OpenSSF malicious-packages MAL- entries:

osv-scanner scan source -r .

To check a single crate and version without a lockfile, query the OSV API directly:

curl -s -d '{"package":{"name":"arrayref","ecosystem":"crates.io"},"version":"0.3.10"}' \
  https://api.osv.dev/v1/query | jq -r '.vulns[].id'

On 25 November that returned MAL-2026-14336 and RUSTSEC-2026-0260. The same query for 0.3.9 returned nothing.

5. Check the registry itself

The crates.io API returns 404 for a crate that has been deleted, and the sparse index shows per-version yank status. crates.io asks automated clients to send a User-Agent:

curl -s -o /dev/null -w '%{http_code}\n' -A 'my-audit-script' https://crates.io/api/v1/crates/proc-macro1
curl -s -A 'my-audit-script' https://index.crates.io/ar/ra/arrayref | jq -c '{vers, yanked}'

A 404 on a crate that is still in your lockfile is a strong signal to look closer.

6. Check local caches and the advisories' indicators

A clean lockfile today does not prove a laptop never built the bad version. Cargo keeps downloaded sources:

find ~/.cargo/registry -maxdepth 3 \( -name 'proc-macro1-*' -o -name 'arrayref-0.3.10*' \
  -o -name 'internment-0.8.7*' -o -name 'append-only-vec-0.1.9*' -o -name 'lwd-uri-util-*' \)

For the August campaign, the proc-macro1 advisory names the files it wrote: /tmp/rust-setup on Linux and macOS, and %TEMP%\rust-setup.ps1 with a %TEMP%\rust-setup-launch.vbs launcher on Windows. Check EDR and proxy logs for connections to 23.254.165.112 on ports 9089 and 443. For logs-update, check ~/.ssh/authorized_keys for keys you do not recognise.

7. Check CI runner images and caches

CI often restores ~/.cargo and target/ from a cache keyed on the lockfile. If a bad lockfile was ever cached, the cache can outlive the fix. Rebuild any cache whose key covered a lockfile that contained an affected version, and check self-hosted runners with the same commands as laptops.

What to do if you built one

A malware advisory has no patched version, so "upgrade and move on" does not apply. Our guide on what to do when a malware advisory has no fixed version covers the general case. For Rust specifically:

  1. Isolate the host. Any machine that ran cargo build, cargo check, cargo test or opened the project in an IDE with the bad version locked ran the code. Take it out of trusted networks until you have looked.
  2. Rotate what the build could reach. Build scripts see the whole environment. That usually means CARGO_REGISTRY_TOKEN, GITHUB_TOKEN and other Git host tokens, cloud keys (AWS_* and the like), package signing and code signing material, SSH keys in ~/.ssh, and any AI agent tokens passed into CI. Rotate first, investigate second.
  3. Check for persistence. The advisories describe dropped binaries, an authorized_keys entry and a self-installing keylogger. Look for each one that applies to the crate you found.
  4. Pin back and rebuild from a clean lockfile. For a hijacked release, move to the last good version and lock it: cargo update -p arrayref --precise 0.3.9. For a crate that was malicious from the start, remove it from Cargo.toml, run cargo update, and confirm with cargo tree -i that nothing pulls it back in.
  5. Rebuild CI caches and release artifacts. Anything built while the bad crate was in the graph should be treated as untrusted and rebuilt.
  6. Check what you published. If the host held crates.io or registry tokens, review your own crates' recent releases on crates.io for versions you did not publish. That is exactly how the arrayref campaign spread.

How to stop the next one

Commit Cargo.lock and build in locked mode

RustSec's own explanation of why the arrayref campaign stayed small is lockfiles. Commit Cargo.lock for applications and for libraries you build in CI, and make CI fail when it would change:

cargo build --locked
cargo test --locked

Review lockfile changes like code. A new dependency appearing under an old one, like proc-macro1 under arrayref, is the thing to catch.

Allow-list build scripts with cargo deny

cargo-deny can fail a build when a crate that is not on your list has a build script, and when crates come from registries you did not approve:

# deny.toml
[advisories]
yanked = "deny"

[bans.build]
allow-build-scripts = ["proc-macro2", "serde", "libc"]
executables = "deny"

[sources]
unknown-registry = "deny"
unknown-git = "deny"
cargo deny check advisories bans sources

With an allow-list in place, a crate like proc-macro1 that adds a new build script fails the check by name, even before any advisory exists. cargo-deny's own documentation is clear that these checks do not protect you from actively malicious code; treat it as a tripwire for new build-time code. We compared the two main Rust auditing tools in cargo audit vs cargo deny.

Review new crates with cargo vet

cargo vet records that someone actually looked at each crate version you depend on, and lets you import audits other organisations have published:

cargo vet init
cargo vet               # fails on any unaudited crate or version
cargo vet suggest       # cheapest audits to clear the backlog
cargo vet diff arrayref 0.3.9 0.3.10
cargo vet certify

cargo vet diff on the arrayref release would have shown a one-line change to Cargo.toml adding a dependency that had never been there before. Our cargo vet explainer walks through audits, imports and exemptions.

Vendor, or put a mirror in front of crates.io

Both options mean a new crate version cannot reach your build until someone lets it in.

cargo vendor copies every dependency into your repository and prints the configuration to use it:

# .cargo/config.toml
[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "vendor"

Vendored code shows up in pull request diffs, so a new build script is visible in review. See our step-by-step cargo vendor guide.

A registry mirror does the same job for many repositories at once. Cargo's source replacement points every build at your mirror:

# .cargo/config.toml
[source.crates-io]
replace-with = "company-mirror"

[source.company-mirror]
registry = "sparse+https://cargo-mirror.example.internal/index/"

Configure the mirror to hold new versions for a cooling-off period and to pull only crates on an approved list. If you run a third-party registry, run Rust 1.96 or later: the Rust Security Response Team fixed two Cargo issues affecting third-party registries in May 2026, a credential leak through URL normalization (CVE-2026-5222) and a symlink extraction flaw that let one crate overwrite another's cached source (CVE-2026-5223). Users of crates.io itself were not affected by the second one.

Treat opening a repository as running it

For code you do not trust yet, turn off build script and proc macro execution in your editor before you open it. In rust-analyzer that is rust-analyzer.cargo.buildScripts.enable and rust-analyzer.procMacro.enable, both set to false. In VS Code, keep Workspace Trust on and open unknown repositories in Restricted Mode. Better still, open them in a disposable container or VM with no credentials.

Give builds less to steal

Every advisory here went after something in the environment. Compile and test in a job with no publish token, signing key or cloud write credentials, and move publishing and signing to a separate job that never compiles third-party code. Prefer short-lived OIDC credentials to stored tokens, and restrict build runner egress to your mirror: a build script that cannot reach the internet cannot download a second stage.

How Safeguard helps

  • Full Cargo inventory. Safeguard's software composition analysis resolves Cargo.toml and Cargo.lock, direct and transitive, across every connected repository. Deep dependency scanning keeps the path from your project to each crate, so when the next advisory names a crate you can see which repositories lock it and which direct dependency brought it in, without running greps by hand.
  • Continuous re-scans. Continuous scanning re-evaluates your inventory when vulnerability feeds change, including new GHSA and OSV entries, not only when your code changes.
  • Policy gates for vulnerabilities. Guardrails let you gate pull requests and CI on known vulnerabilities, licenses and SBOM requirements in your Rust services.
  • Install-time blocking for npm and pip. Many Rust teams also ship JavaScript front ends and Python tooling. For those ecosystems, Safeguard's Package Firewall runs as an install-time proxy that can block known malicious packages, typosquats and dependency confusion packages before they install.

For the Rust build itself, pair that inventory with the Cargo-native controls above: committed lockfiles, cargo deny build-script allow-lists, cargo vet reviews and a mirror or vendored sources. For other ecosystems, see npm malware today and our explainer on why CVE-based scanning misses malicious packages.

A malicious crate has no fixed version, so the steps above are how you handle one. The rest of your Rust dependency tree still carries ordinary vulnerabilities, and that is where the next section applies.

Fix it without waiting for upstream

Whatever the vulnerability, most of the risk sits in two gaps. The first is the time between a fix being published and that fix actually running in your production builds. The second, and worse, is the time before any fix exists at all, while a maintainer works out a patch and a release schedule. Waiting through both gaps is a habit, not a requirement. Safeguard gives teams three ways to close them.

1. Autonomous remediation: pull requests, not tickets

When a fixed version exists, Griffin, Safeguard's security model, opens a policy gated pull request that moves the affected dependency to the safe version, and your own CI runs your tests on it before anyone merges. You can run it on one repository or in bulk across every project that carries the vulnerable version. Remediation categories include dependencies, licenses, security posture and findings, and each one is set separately. Reachability analysis ranks the vulnerable code paths your application actually calls first, so the first pull requests you merge are the ones that matter most. Auto-merge is a separate switch and stays off by default, so your team decides what merges on its own and what still needs a human approval.

2. Gold Open Source: the safe version in seconds, free

gold.safeguard.sh is free and needs no login. Search any CVE or package to see affected and fixed versions, CVSS, EPSS, CISA KEV status and a recommended safe version, or use the "Am I affected?" checker. The same data is available through a free read API, README status badges and RSS threat feeds.

3. Gold Registry: start from components that are already fixed

Safeguard Gold rebuilds patched versions of open-source packages and images from source, signs each build, attaches an SBOM, SLSA provenance and VEX, and serves them from registry.safeguard.sh to your organization. Every Gold artifact is held continuously to zero exploitable critical or high CVEs and a completed license check, with signed build provenance (signed with Safeguard's key and verifiable with cosign, SLSA Build Level 3 as the design target) and a public evidence page you can hand to an auditor. An artifact loses its Gold badge if it regresses. Teams can point their own package directory at the registry so hardened equivalents resolve without changing how developers install anything.

When upstream has no fix yet, or will not ship one, Safeguard first works to get the fix accepted upstream. If the issue is severe or upstream will not move, Safeguard builds a fork, fixes the vulnerability there and publishes a hardened Gold build, so you are not stuck on a maintainer's release schedule. You can also request a hardened build of a specific package. Ask which packages it covers before you plan around it.

Your situationWhat to use
A fixed version existsAutonomous remediation opens the upgrade pull request; Gold Open Source confirms the safe version
You need to know today whether you are affectedGold Open Source lookup and "Am I affected?" checker, free and without login
You want vulnerable versions to stop shippingSafeguard policies and gates in CI
Upstream has no fix yet, or will not ship oneA custom Gold request; fork and patch
You want to start clean on new projectsPull hardened components and images from Gold Registry

One honest limit: when the vulnerable code lives in a vendor appliance, a hosted service or an operating system runtime you do not build yourself, the fix still has to come from that vendor or distribution. The steps above apply to the open source dependencies and container images you build and ship, which is where most teams carry the largest and least tracked share of their exposure.

FAQ

Is crates.io safe to use?

crates.io is used safely by most of the Rust world, and its team removes malicious crates and locks the accounts behind them. Removal is not instant, though. Among the crates removed in 2026, the time from publication to removal ranged from about 86 minutes for arrayref 0.3.10 to roughly 20 months for crates like build_dep, per RustSec. Use lockfiles and review new dependencies rather than assuming every published crate has been checked.

Does cargo audit catch malicious crates?

It catches crates that RustSec has an advisory for, and RustSec publishes one for every crate crates.io removes for malware. It will not catch a crate nobody has reported yet, and it can lag the GitHub and OpenSSF feeds. Running osv-scanner as well covers those sources.

Can a crate run code if I never call it?

Yes. A build.rs or proc macro runs during cargo build and cargo check, and when your IDE loads the project. Calling the crate's functions is not required.

Is there a fixed version for a malicious crate?

No. For a hijacked release like arrayref 0.3.10, earlier releases are clean, so you pin back. For a crate that was malicious from the first version, you remove it. In both cases you rotate any credentials the build host could reach.

What is the difference between a yanked crate and a removed one?

A yanked version stays downloadable for existing lockfiles, but Cargo will not pick it for new resolutions. A crate removed for malware is deleted, so builds that need it fail. A sudden download failure for a locked crate is worth checking against RustSec.

How do I keep checking after today?

Run cargo audit or osv-scanner in a scheduled CI job, not only on pushes, so a new advisory against an old lockfile still reaches you.

Sources

Last reviewed: 25 November 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

We email you a link to confirm, and only then add you to the list. Unsubscribe in one click. Privacy

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.