More

    Npm Malware Uses Invisible Dependencies to Infect Dozens of Packages

    An ongoing npm credential harvesting campaign operating since August 2025 has been discovered by researchers at Koi Security.

    The malware, dubbed PhantomRaven by the researchers, is actively stealing npm tokens, GitHub credentials and CI/CD secrets from developers worldwide, with 126 npm packages infected, totalling 20,000 downloads.

    At least 80 of them were still active when the Koi Security report was published on October 29.

    While the attacker’s infrastructure was described in the report as “surprisingly sloppy” because a simple analysis led the researchers to a single individual, they commented that the delivery mechanism is “clever.”

    Remote Dynamic Dependencies Technique Explained

    The attacker uses Remote Dynamic Dependencies (RDD) to hide malicious code in externally hosted packages fetched at install time via HTTP URLs, bypassing npm’s security scans and dependency analysis by appearing as a clean, dependency-free package.

    This technique evades detection by loading the payload only when the victim runs npm install, pulling it from an attacker-controlled server instead of the npm registry.

    Since the dependency is fetched fresh for every install from an attacker-controlled server, the attacker can dynamically tailor payloads, serving clean code to researchers, delayed malware to high-value targets or even geofenced attacks, all while npm’s cache-free design ensures victims always get the latest – and most dangerous – version.

    Malicious Npm Packages Exploit AI ‘Slopsquatting’

    The package names in the PhantomRaven campaign also use typosquats crafted to exploit the tendency of large language models (LLM), hallucinations.

    “When developers ask AI assistants like GitHub Copilot or ChatGPT for package recommendations, the models sometimes suggest plausible-sounding package names that don’t actually exist. PhantomRaven created those non-existent packages,” the Koi Security researchers explained.

    This technique is commonly known as slopsquatting.

    “PhantomRaven demonstrates how sophisticated attackers are getting at exploiting blind spots in traditional security tooling. Remote Dynamic Dependencies aren’t visible to static analysis. AI hallucinations create plausible-sounding package names that developers trust. And lifecycle scripts execute automatically, without any user interaction,” concluded the researchers.

    The Koi Security report provided a list of the compromised npm packages as well as details on the attacker’s infrastructure.

    Read now: Npm Package Hijacked to Steal Data and Crypto via AI-Powered Malware

     

    Latest articles

    Related articles