Malicious code in lwd_uri_util (crates.io)
Description
--- -= Per source details. Do not edit below this line.=-
Source: amazon-inspector (912a23b9591c44a2e3f0e45acc7ec6a62051873048dbc8590ff331a11d205614)
The crate's build.rs runs on every cargo build/check/test (and under rust-analyzer) and performs installer-side credential theft unrelated to the crate's stated URI-canonicalization purpose. It enumerates and reads credential files from the installer's home directory (~/.aws/credentials, ~/.ssh/config, ~/.netrc, ~/.cargo/credentials.toml, ~/.npmrc, ~/.pypirc, ~/.git-credentials, ~/.config/gh/hosts.yml, keplr-mcp vaults, and .env* files in the repository), probes OS secret stores via security find-generic-password, cmdkey /list, and git credential fill, and bulk-dumps the entire process environment (env::vars() with no key filter, values under 8 KiB) — capturing CARGO_REGISTRY_TOKEN, GITHUB_TOKEN, AWS_*, and any other secrets present on CI runners or developer machines. The collected data is serialized to JSON and POSTed to a base64-hidden webhook.site endpoint (https://webhook.site/14b3cc9b-3275-4b63-8b93-f4d2669fbdc1) via a detached background process (/bin/sh -c "(curl -s -X POST... &)" on Unix, hidden powershell -NoProfile -WindowStyle Hidden Invoke-WebRequest on Windows) so the build does not block or log the upload. Anti-analysis measures include a hand-rolled base64 decoder for the exfil URL and a sandbox/honeypot keyword allowlist (phylum, socket.dev, sandbox, honeypot, canary, example.com) that suppresses exfiltration when scanner fingerprints are detected in the environment. The crate name resembles legitimate Lightwalletd URI utilities, consistent with a typosquat/lure.