How Malicious Packages on npm Bypass Existing Security Tools
Why conventional SCA, SAST, and EDR tools fail against malicious npm packages and how attackers exploit registries.
Summary
Introduction to the npm Threat Landscape
Paul McCarty, Head of Research at Safe-T and seasoned supply chain security researcher, delivers an in-depth technical analysis of open-source malware within the npm ecosystem. As the world's largest software registry hosting nearly 5 million packages and serving over 4.5 trillion package requests in 2024, npm has become the primary vector for software supply chain attacks. Industry telemetry indicates that over 98% of malicious open-source packages are hosted and delivered through npm due to its frictionless publishing model and ubiquitous developer integration.
Why Traditional Security Tools Fail Against Supply Chain Attacks
McCarty dissects why standard enterprise security controls fail to detect or block malicious npm packages:
Software Composition Analysis (SCA): SCA solutions operate by cross-referencing package names and versions against public vulnerability databases (such as CVEs and NVD). Malicious packages created by threat actors do not contain reported CVEs; they are intentionally authored malware, making them completely invisible to standard SCA scanners.
Static Application Security Testing (SAST): SAST engines are designed to locate programmer errors, input sanitization flaws, or memory vulnerabilities in source code, not purposeful obfuscated malware payloads or lifecycle install scripts.
Endpoint Detection and Response (EDR) and Antivirus: Package installation scripts (such as preinstall or postinstall hooks) run during build or developer setup. Payloads often execute as single-shot commands (e.g. curl or node execution) that immediately exfiltrate environment variables or spawn background processes without triggering heuristic behavior chains monitored by endpoint agents.
Attack Vectors in the Open-Source Ecosystem
Threat actors exploit various vectors to deliver malware to developer workstations and CI/CD pipelines:
Typosquatting and Dependency Confusion: Registering package names identical to internal corporate packages or mimicking popular public libraries to trick build systems into fetching public malware.
Obfuscation and Filler Code: Embedding malicious logic deep inside thousands of lines of dummy JavaScript files and nested dependencies to evade manual code review and automated AST parsers.
Conditional Execution: Writing payloads that only activate when specific cryptographic wallet files, environment keys, or enterprise domain flags are detected, remaining completely dormant in sandboxes.
Threat Actor Case Studies: Nation-States and Criminal Groups
McCarty details several active campaigns targeting the npm ecosystem:
North Korean Threat Groups (Lazarus / DPRK): Responsible for billions in cryptocurrency theft, these actors conduct targeted social engineering on LinkedIn and GitHub, distributing fake technical challenges and dependencies with dormant stealers that target developer crypto wallets.
Indonesian Threat Groups ("Len Gang"): Groups targeting WhatsApp web integrations and business accounts to hijack payment systems, utilizing Discord webhooks for effortless command and control infrastructure.
Russian Underground Actors: Increased utilization of .ru and .su top-level domains for payload hosting, adapting infrastructure to evade sanctions.
The Bug Bounty Problem and Ecosystem Pollution
A major contributor to registry pollution is the deluge of reckless bug bounty researchers. Over 40% of newly uploaded suspicious packages stem from researchers attempting automated dependency confusion attacks for bounties, placing immense strain on registry maintainers and security analysts.
Defense Strategies: Package Firewalls and Enterprise Best Practices
To safeguard software development pipelines, organizations must adopt modern supply chain defenses:
Package Firewalls and Proxies: Deploying package firewalls that intercept npm and PyPI package requests, scanning package contents, publish age, metadata anomalies, and install scripts before packages reach developer machines.
Private Vetted Registries: Enforcing policies where internal builds only fetch approved, mirror-cached dependencies.
Outbound Egress Filtering: Monitoring and restricting egress traffic from developer environments and CI/CD runners to prevent unvetted webhook or C2 callbacks.
Key Takeaways and Open-Source Resources
McCarty concludes by urging organizations to invest in dedicated supply chain security expertise and provides open-source malware feeds, research repositories, and tracking resources (available on GitHub @sixmile) for threat researchers.
Related talks
Videos·31 min
Industry experts analyze emerging threats surrounding 5 Ways to Mitigate Costly Software Supply Chain Attacks to Get Your SDLC in Check.
BalCCon2k25·26 min
Vladimir Slavov
Industry experts analyze emerging threats surrounding Vladimir Slavov - OpenChain, Towards a More Secure and Compliant Software Supply Chain.
Black Hat·30 min
Analysts investigate attack surfaces and defenses concerning Transparency in the Software Supply Chain: Making SBOM a Reality.


