Join our Newsletter — 33% off our NHI Course
Home› Guides› Open-Source Maintainer Takeovers for Beginners: How Attackers Hijack…
Guide Software & AI Supply Chain

Open-Source Maintainer Takeovers for Beginners: How Attackers Hijack Trusted Projects

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 1 December 2026 11 min read
On this page

A maintainer takeover is when an attacker gains the power to publish a trusted open-source project's code.

This guide is for developers, team leads and anyone whose software depends on open-source packages. You do not need to be a security expert. If your apps install packages from a public registry, this risk reaches you.

In short

  • Open-source packages are published by maintainers. Whoever controls a maintainer's account or release rights can ship new code to every user.
  • Attackers get there in two main ways: stealing an account or publish token, or slowly earning trust until they are given release rights.
  • Past cases show a reused password, a missing second factor and a trusted insider each opening the door.
  • Maintainers can lock down publishing, and users can lock versions and review updates before taking them.

What you will learn

  • Explain the two main routes to a maintainer takeover.
  • Describe what happened in three well-known cases, at a high level.
  • Name the simple controls that maintainers can use.
  • Name the simple controls that teams using packages can use.
Maintainer
a person who looks after an open-source project and can release new versions.
Registry
the public store, such as npm, where packages are published and downloaded.
Release
a new numbered version of a package that users can install.

What is an open-source maintainer takeover?

Think of a trusted bakery that supplies sandwiches to hundreds of offices. A stranger might steal the van keys, or charm their way into a kitchen job. Either way, every office gets whatever they put in the bread.

Open-source projects work the same way. Thousands of apps install a package because they trust the people who publish it. An attacker who gets publishing power can push a new version with hidden code, and many systems will install it as a normal update.

There are two main routes. The first is stealing the maintainer's account or a token that can publish. The second is a social takeover, where an outsider earns enough trust to be given commit and release rights.

Where the comparison stops working: offices can taste a bad sandwich. Hidden code in a package can run quietly, and nobody may notice for a long time.

For the wider picture, start with Supply Chain Attacks for Beginners.

Why does it matter?

One hijacked package can reach a huge number of systems at once. The damage often lands on the users, not the project.

If you maintain an open-source project

What could happen: a reused password or a leaked token lets someone publish a harmful version under your name.

Check this: turn on a second factor for your registry account and list everyone who can publish.

Next: Multi-Factor Authentication for Beginners

If you build apps that use packages

What could happen: your build pulls in a hijacked version automatically, and its code runs on your machines.

Check this: make sure every project uses a lockfile, so versions only change when you choose.

Next: Dependency Updates for Beginners

If you run security or IT

What could happen: a bad package steals tokens and keys from developer laptops or build servers.

Check this: know which machines hold publish tokens and cloud keys, and how fast you can rotate them.

Next: Leaked Secret Response for Beginners

What does it look like?

Here is a made-up version history for a package, the kind you might see on a registry page. It shows warning signs worth noticing.

Example only. All values are made up.

Package: example-dateparse                      (1)
2.4.0  published by maintainer-A   6 months ago  (2)
2.4.1  published by maintainer-A   5 months ago
2.5.0  published by FAKE-new-user  2 hours ago   (3)
       adds install script: postinstall.js       (4)
       no matching change in the source repo     (5)
  1. The package name. In a real file, this line would contain the registry address too.
  2. A steady history from the usual maintainer.
  3. A sudden release from a new or unfamiliar publisher, after months of quiet.
  4. A new script that runs automatically when the package is installed.
  5. The published package does not match what is in the project's source code.

Why this is risky: builds that take the newest version would install 2.5.0 straight away and run its script.

The safer way: lock versions, give new releases time before you adopt them, and look twice at new install scripts.

How does it work?

  1. Gain publishing power. The attacker steals an account or token, or earns release rights over time.
  2. Hide code in a release. They publish a new version that looks normal but carries extra code.
  3. Let updates spread it. Systems that take the newest version install it automatically.
  4. Run the code. An install script or the package itself runs on developer laptops, build servers or live systems.
  5. Steal or open a door. The code may steal tokens and keys, install unwanted software or add a hidden way in.
Diagram titled Two routes to a hijacked package, and where to stop them. Four boxes in a row joined by arrows. Route A: a stolen account or publish token, for example through a reused password and no second factor. Or route B: a social takeover, where an outsider earns commit and release rights. Bad release: a new version with hidden code is published to the registry. Your systems: installs pull it in automatically unless versions are locked. A note says maintainers should use a second factor and unique passwords and limit who can publish, while users should lock versions, review updates before taking them, and rotate secrets on any machine that ran a bad version.
Figure 1. Two ways attackers gain publishing power, and the stop points for maintainers and users.

Three cases to learn from

eslint-scope, 2018: a reused password. The project's own write-up says a maintainer had reused their registry password on other sites and had no second factor [1]. The bad version sent each installer's registry tokens to the attacker [1]. The registry then revoked all access tokens issued before a set time [1]. Read our case page on the eslint-scope npm compromise.

ua-parser-js, 2021: a hijacked account. GitHub named this package among recent npm account takeovers. It said some of these takeovers involved accounts without a second factor [2]. GitHub then announced that maintainers of popular npm packages would need two-factor authentication [2]. See the ua-parser-js npm hijack case page.

XZ Utils, 2024: a trusted insider. The project confirmed that two release packages contained a backdoor, created and signed by a person with release access [4]. The researcher who found it noticed slow, CPU-heavy SSH logins on a test system [3]. Part of the hidden code was only in the release packages, not in the main source code [3]. CISA advised rolling back to a clean version [5]. See the XZ Utils backdoor case page.

A worked example

This story is made up to show the idea.

Sana Osei leads a small web team at a travel firm. One morning a security newsletter reports that a popular date-handling package had a hijacked release overnight.

Sana checks her projects. Two use that package. One has a lockfile and is pinned to an older, clean version, so nothing changed.

The other project has no lockfile. Its build server ran overnight and pulled in the bad version. Sana treats the server as compromised and tells the team.

Wren Yeboah, who looks after the build systems, rotates every token and key the server could reach. That includes the registry token and two cloud keys. He then rebuilds the server from a clean image.

The team adds a lockfile to every project. They also agree to wait a few days before adopting brand new releases, unless a release fixes a security flaw.

Sana also maintains a small open-source tool in her spare time. That evening she turns on a second factor for her registry account. She removes two old helpers who no longer need publish rights.

Sana learned that takeovers hit users through automatic updates. Locked versions, fast secret rotation and tight publish rights all shrink the damage.

Myths and mistakes

What people thinkWhat is true
Popular packages are too well watched to be hijacked.Widely used packages, such as ua-parser-js, have been taken over[2]. Popularity makes them a bigger prize.
Reading the source code on the project site is enough.In XZ Utils, part of the hidden code was only in the release packages, not the main source[3].
Attacks always come from strangers.A person can become trusted over time. The XZ backdoor was in releases signed by someone with release access[4].
Removing the bad version is the end of it.Code that ran may have stolen tokens. The eslint-scope case led the registry to revoke tokens[1].
Auto-updating to the newest version is always safest.It also pulls in hijacked releases. ESLint advised using a lockfile and care with services that auto-merge upgrades[1].

What can I do this week?

  • Check that each of your projects has a lockfile saved with its code.
  • If you publish packages, turn on a second factor and use a unique password for the registry.
  • List who can publish each package you own, and remove anyone who no longer needs it.
  • Read Choosing Open Source Packages for Beginners for signs of a healthy project.

Checklist

  • I can explain the two main routes to a maintainer takeover.
  • My projects use lockfiles, so versions change only when we choose.
  • We review new releases, and new install scripts, before adopting them.
  • Publishing accounts use a second factor and unique passwords.
  • Only people who need it can publish our packages.
  • We know which machines hold tokens and keys, and can rotate them fast.
  • If a bad version ran, we treat the machine as compromised.

Common questions

What is a publish token?

It is a secret that lets a person or tool publish new versions of a package. It is a non-human credential, often stored in a config file or a build system. Anyone who steals it can publish as the maintainer, so it needs the same care as a password.

How would I know if I installed a hijacked package?

Watch security advisories for the packages you use, and check your lockfiles against the bad version numbers. If a bad version was installed, assume its code ran. Rotate the secrets that machine could reach, and rebuild it from a clean state.

Does a second factor stop all takeovers?

No. It makes stolen passwords much less useful, which helped in cases like eslint-scope. It does not stop a social takeover, where someone is given release rights on purpose. Projects also need care over who they trust with publishing.

Should we stop using open-source software?

No. The lesson from these cases is to use open source with care, not to avoid it. In practice that means you pick healthy projects, lock versions and review updates. Be ready to rotate secrets if a bad release gets in.

Where next?

Ready for the detail? Read the practitioner guide: Open Source Project Maintainer Security Guide. It covers account hardening, release signing and publishing controls in depth.

Also useful:

Related NHI Mgmt Group resources: Package Maintainer Account Compromise Playbook, RepoJacking and Namespace Takeover Guide and Software Supply Chain Security for Beginners.

Key terms

Maintainer account takeover
When an attacker gains control of an account that can publish a project's code.
Publish token
A secret that lets a person or tool publish new versions of a package to a registry.
Software supply chain attack
An attack that reaches victims through software or components they trust and install.
Lockfile
A file that records the exact package versions a project uses, so they change only on purpose.
Postinstall script
Code in a package that runs automatically when the package is installed.
Backdoor
A hidden way into a system that skips the normal security checks.
Password reuse
Using the same password on more than one site, so one leak can open many accounts.

Sources and further reading

  1. ESLint, "Postmortem for Malicious Packages Published on July 12th, 2018", July 2018. https://eslint.org/blog/2018/07/postmortem-for-malicious-package-publishes (accessed 1 Dec 2026).
  2. GitHub, "GitHub's commitment to npm ecosystem security", GitHub Blog, 15 November 2021. https://github.blog/2021-11-15-githubs-commitment-to-npm-ecosystem-security/ (accessed 1 Dec 2026).
  3. oss-security mailing list, post reporting the xz/liblzma backdoor, Openwall, 29 March 2024. https://www.openwall.com/lists/oss-security/2024/03/29/4 (accessed 1 Dec 2026).
  4. Tukaani Project, "XZ Utils backdoor". https://tukaani.org/xz-backdoor/ (accessed 1 Dec 2026).
  5. CISA, "Reported Supply Chain Compromise Affecting XZ Utils Data Compression Library, CVE-2024-3094", March 2024. https://www.cisa.gov/news-events/alerts/2024/03/29/reported-supply-chain-compromise-affecting-xz-utils-data-compression-library-cve-2024-3094 (accessed 1 Dec 2026).

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.