Skip to content
Info disclosure Write-up Intermediate

“Package Hijack Meets GraphQL Goldmine: How One Recon Session

A staging GraphQL endpoint exposed an npm package token field, allowing unauthenticated extraction of hundreds of developer tokens. One leaked token gave write access to a public npm package, enabling a malicious update that could execute code on systems pulling the dependency.

iski Follow

Published on infosecwriteups.com

Free link 🎈

Iski, on infosecwriteups.com

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 GraphQL schema exposed a sensitive npm token field without authentication, and the leaked token had publish rights to a public package.

Impact

The attacker could run arbitrary code on production servers and CI/CD pipelines, and obtained full developer email and token exposure.

What the attacker needed

Access to the staging GraphQL endpoint; no authentication required; a leaked npm token with publish rights

The fix

The GraphQL schema should not expose sensitive token fields, and npm tokens should be scoped to least privilege and rotated.

How it was found

  1. Perform subdomain enumeration and HTTP probing to find live hosts.
  2. Use a URL discovery tool to find GraphQL endpoints.
  3. Send an introspection query to the staging GraphQL endpoint.
  4. Query the allUsers field to extract email addresses and npmPackageToken values.
  5. Validate a leaked npm token with a ping command.
  6. Publish a malicious update to the public package using the leaked token.

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 GraphQL endpoint is a way for apps to ask for data. Here, it was left open on a staging server and revealed a secret field containing npm tokens. Those tokens let someone publish a malicious update to a software package, which could run harmful code on any computer that installed it.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by iski

View all

186 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.