Skip to content
← All stories

Vulnerabilities · Application Security

GitHub fixes npm flaw that exposed over 1,500 packages to hijacking

GitHub has changed how npm package publishing works after researchers found over 1,500 packages could be hijacked without stealing credentials. The flaw could have enabled large-scale supply chain attacks.

Ross GrantUpdated 3 min read

The short version

Researchers found a security flaw in how npm packages were published using GitHub. Attackers could have taken over more than 1,500 packages and released malicious updates without needing passwords. GitHub has now fixed the problem, but developers should check their own package settings.

By the numbers

  • 1,500+npm packages found vulnerable to hijackingThe Hacker News
  • 10 million+downloads of affected packagesThe Hacker News
  • 48 hoursnew expiry window for unvalidated trusted publishing configurationsThe Hacker News

What happened?

Researchers found a flaw in npm's trusted publishing system that allowed attackers to hijack over 1,500 packages without stealing credentials. GitHub has changed its publishing rules to address the issue. The flaw could have enabled large-scale supply chain attacks.

What researchers discovered

Security researchers at Bloom Security found a loophole in npm's trusted publishing system. This system was meant to make publishing packages safer by letting developers use short-lived tokens instead of long-term passwords. But the researchers found that, in some cases, attackers could publish new versions of someone else's package without needing to steal any credentials. The flaw affected over 1,500 npm packages, which had been downloaded more than 10 million times, according to The Hacker News (opens in a new tab).

How the attack worked

The problem was with how npm trusted publishing identified which GitHub repository was allowed to publish a package. Instead of using a permanent, unique ID for each repository, it relied on the repository's name and owner (called a "slug"). If a repository was renamed, deleted, or transferred, someone else could claim the old slug. If the trusted publishing configuration had not yet been used to publish a version, an attacker could set up a new repository with the same slug and use it to publish a new version of the package. This would let them push malicious updates under the legitimate package name, inheriting its reputation and user base.

GitHub's response and changes

GitHub, which owns npm, has now changed the rules for trusted publishing. Any new trusted publishing configuration must be used to publish a package within 48 hours, or it will expire. Once the first publish is successful, the configuration is validated and tied to the repository's permanent ID. If the repository is renamed or transferred, a new trust relationship must be created. This change is meant to stop attackers from claiming old slugs and using them to hijack packages.

GitHub also updated npm to reject publishing tokens from certain GitHub Actions events that could be abused, such as issue comments, in addition to the existing restrictions.

The risk for developers and users

The attack, called "SlugFest" by researchers, could have led to widespread supply chain attacks. If a popular package was hijacked, any project or developer who relied on it could have unknowingly installed malicious code. The risk was even higher for teams using AI agents to manage dependencies, as these tools often fetch the latest version of a package without checking its source.

Developers who maintain npm packages are advised to:

  • Audit their trusted publisher configurations and make sure the listed repository slug is still under their control.
  • Delete and recreate trust bindings if a repository has been renamed, transferred, or deleted.
  • Monitor for unexpected npm publish events.

Lessons for the wider software supply chain

This incident highlights a recurring problem in software supply chains: trust is often based on human-readable names, which can change or be reused. Security researchers warn that any system relying on such names, rather than permanent identifiers, is at risk of similar attacks. The findings echo earlier research into other software marketplaces, where attackers could hijack extensions by claiming abandoned names.

What happens next

At the time of writing, only The Hacker News has reported these findings, and there is no public statement from GitHub or Microsoft. Developers should stay alert for further updates and review their own package publishing setups to reduce risk.

Claimed vs confirmed

  • Confirmed

    Over 1,500 npm packages were vulnerable to hijacking due to a flaw in trusted publishing.

    Bloom Security reported the flaw; The Hacker News covered the finding.

  • Confirmed

    Attackers could publish new versions of packages without stealing credentials.

    Researchers demonstrated that attackers could exploit the slug system to publish as another user.

  • Confirmed

    GitHub has fixed the issue by changing publishing rules.

    GitHub introduced a 48-hour expiry for unvalidated trusted publishing configurations, according to The Hacker News.

The impact

Money
No direct financial losses are reported, but under UK or EU GDPR, a breach could result in fines up to £17.5m or €20m, or 4% of annual turnover, if personal data were compromised.
Reputation
Trust in npm and GitHub could be affected if users or businesses were impacted by malicious packages. The flaw's discovery and fix may reassure some, but the lack of a vendor statement leaves questions.
Customers
Developers and organisations using npm packages could have installed malicious updates. They should audit their dependencies and publishing configurations to reduce risk.

Why it matters

Anyone who uses npm packages could have been exposed to malicious updates if a popular package was hijacked. Developers and organisations that publish npm packages need to check their publishing configurations to avoid similar risks.

How does it work?

The flaw relied on npm using the repository's name and owner (slug) instead of a permanent ID to authorise publishing. If a repository was renamed, deleted, or transferred before its first publish, an attacker could claim the old slug and use it to publish malicious updates as the legitimate package.

Key points

  1. Over 1,500 npm packages were vulnerable to hijacking due to a publishing flaw.
  2. Attackers could publish malicious updates without stealing credentials.
  3. GitHub has changed npm's publishing rules to fix the issue.
  4. Developers should audit and update their trusted publisher configurations.
  5. Supply chain attacks can exploit weaknesses in how trust is assigned.

Sources

  1. The Hacker News

    Reference

The day's cyber news in 5 minutes.

Cyberend Daily is one short email with the stories that matter, written so anyone can follow.

No spam · 100% free · Unsubscribe anytime