When developers build an app today, they write only a fraction of the code themselves. The rest comes from open-source packages, downloaded automatically by tools that trust names. If an attacker can get a package with the right name in front of those tools, their code ships inside your software.
A typical web application can depend on hundreds or thousands of open-source packages, most of them pulled in indirectly by other packages. Package managers such as npm for JavaScript and pip for Python fetch them by name, often on every build, often without anyone looking.
That automation is what makes modern development fast. It is also an attack surface. Instead of breaking into a company, an attacker can publish code that the company's own build system will download and run.
Typosquatting relies on a simple mistake. A developer means to install a popular package and types the name slightly wrong, or copies a name from a forum post or an AI-generated suggestion. The attacker has already registered that misspelling, or a convincing variation, and filled it with malware.
Because installing a package can run code straight away, the malware does not need anyone to use the package. Installation is enough.
In March 2024, PyPI, the main repository for Python packages, temporarily stopped new user registrations and new project creation for around ten hours to deal with what it called a malware upload campaign. Security researchers reported that the packages imitated popular libraries and carried malware designed to steal cryptocurrency wallets, browser cookies and saved credentials, with persistence to survive reboots.
Large organisations also write their own internal packages, with names such as companyname-auth-utils, stored in a private repository. Dependency confusion abuses the way some build tools decide where to get a package when the same name exists both privately and publicly.
The technique was demonstrated publicly in February 2021 by security researcher Alex Birsan. With permission from the companies involved, he showed that his test packages were downloaded and run inside more than 35 organisations, including Microsoft, Apple, PayPal, Shopify, Netflix, Tesla and Uber, across the npm, PyPI and RubyGems ecosystems. He found many of the internal package names in public JavaScript files. The companies paid him bug bounties for the findings.
The newest form goes further: compromising the real package, rather than a lookalike.
In September 2025, CISA warned of a widespread compromise of npm, the largest JavaScript package registry. A self-replicating worm, publicly known as Shai-Hulud, had compromised more than 500 packages. According to CISA, it searched infected systems for credentials such as GitHub personal access tokens and cloud API keys, sent them to the attackers and published them to a public GitHub repository. It then used stolen developer credentials to log in to npm, inject itself into other packages that developer maintained, and publish infected versions.
That last step is what made it spread on its own. Every infected developer machine became a way to infect more packages.
MITRE's mitigations and CISA's npm guidance overlap heavily. In practice:
package-lock.json, yarn.lock, poetry.lock and similar) and pin exact versions, so a new, malicious release is not pulled in automatically. MITRE also recommends pinning GitHub Actions to commit hashes.MITRE's detection guidance for T1195.001 focuses on what happens during and immediately after installation:
webhook.site domains and reviewing firewall logs.Open source is one of the great successes of modern software, and none of this is a reason to stop using it. It is a reason to stop trusting names blindly.
Lock what you install, fetch internal packages only from internal sources, protect the accounts that publish code, and watch what your build systems do. The attacks in this episode all depended on automated systems doing exactly what they were told without anyone checking.
Cyber Insight | Threat of the Week · Season 1
Making cybersecurity easier to understand, one issue at a time.
One attack technique explained, mapped to MITRE ATT&CK, with detection tips.
Have a question or a suggestion? Prepare an email below. Feedback is private and is sent only when you press Send in your email app.
Likes and claps are your personal reactions on this device.
You can also email Poorna directly.
Your feedback stays private. Nothing is sent from this page automatically.
I started Cyber Insight because everywhere online people only talk about cybersecurity in technical terms — and most people are left without a proper understanding of how the digital world works. I work in cybersecurity, but I write here for everyone. No jargon. Just clear, honest explanations.