The NPM Token That Stayed Alive for Two Years
An NPM token with read/write access to all packages under an organisation was exposed in a public DockerHub image. An attacker could use it to publish or manage packages, but the token remained active for over two years despite disclosure.
Published on medium.com
About two years ago, while testing an early, unreleased version of iScan.today, I picked up something odd during a routine scan.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the token was accidentally committed to a Docker image that was made public, and the organisation failed to revoke it after disclosure.
Impact
An attacker with the token could publish or manage all packages under the organisation, potentially leading to supply chain attacks, and the token remained valid for over two years.
What the attacker needed
Public DockerHub image; NPM token with write access
The fix
The token was finally revoked after the report was triaged.
How it was found
- Scan found an NPM token in a public DockerHub image.
- Checked token metadata and scopes, found read/write access to all packages.
- Sent responsible disclosure email to the company.
- DockerHub repository was made private a few days later.
- Two years later, checked token again; it was still active with same scopes.
- Submitted report to HackerOne; token was revoked and bounty awarded.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A token is like a password that lets a program access a service. Here, a token for NPM (a package manager) was left in a public Docker image, so anyone could find it and use it to control the organisation's packages. The token stayed valid for two years, meaning the risk persisted even after the company was told.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.