Skip to content
Leaked secrets Write-up Advanced

How We Hacked a Software Supply Chain for $50K

A Docker image published by an acquired subsidiary contained a GitHub Actions token in its .git/config and a private npm token in an earlier build layer. An attacker could use these tokens to push malicious code to private packages and repositories, compromising developers, CI/CD pipelines, and production.

RONI CARTA | LUPIN Follow

Published on depi.security

Back in 2021, I was still early in my offensive security journey. I had already hacked several companies and was earning a steady income through Bug Bounty Hunting, an ethical hacking practice where security researchers find and report vulnerabilities for monetary rewards.

RONI CARTA | LUPIN, on depi.security

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, sensitive tokens were left in the Docker image because the .git folder and an .npmrc file were copied into the build context and not removed from all layers.

Impact

An attacker could backdoor a private npm package, potentially compromising developer machines, CI/CD pipelines, and production servers, though the text does not confirm actual exploitation.

What the attacker needed

Public Docker image; token left in image layers; npm token with write access

How it was found

  1. Find a DockerHub organisation tied to the subsidiary.
  2. Pull a Docker image named after a main product.
  3. Inspect the image and find the .git/config containing a GitHub Actions token.
  4. Use a tool to examine the image layers and recover the .npmrc with the npm token.
  5. Use the npm token to publish a malicious version of a private package.

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 company's software is built from code stored in repositories and packages. If an attacker gets a key that lets them change that code, they can insert harmful code that everyone later downloads and runs. Here, old keys were left inside a public Docker image, so anyone could find them and tamper with the company's private code.

What is Leaked secrets?

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.

More by RONI CARTA | LUPIN

View all

6 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Leaked secrets and credentials

The lesson behind this report.

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.