Skip to content
Leaked secrets Write-up Intermediate

The Domino Effect of GitHub Token Exposure

A leaked GitHub personal access token from an employee's personal project allowed access to organisation repositories and extraction of workflow secrets. The attacker could then use those cloud credentials to take over the organisation's AWS infrastructure.

medium.com

Published on medium.com

I have been working extensively with GitHub leaks lately, and it is easily one of the most common things that can go wrong in modern enterprise security.

Veshraj Ghimire, on medium.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 employee committed a personal access token with broad scopes to a public personal repository, and the organisation did not enforce fine-grained tokens or least-privilege cloud credentials.

Impact

The attacker could gain full AWS console access to the organisation's cloud infrastructure, though this depends on the leaked token having repo and workflow scopes and the extracted AWS key having sufficient privileges.

What the attacker needed

Employee leaks a PAT on a public personal repo; token has repo and workflow scopes; workflow contains cloud credentials

The fix

Organisations should enforce fine-grained personal access tokens with minimal scopes and expiration, enable secret scanning and audit log alerts, and apply least-privilege IAM for CI/CD runners.

How it was found

  1. Scan the employee's personal GitHub account for secrets using Trufflehog.
  2. Use the found token to list the organisations it can access.
  3. If the token has repo and workflow scope, extract secrets from organisation repositories using gato-x.
  4. Use the extracted AWS keys with Pacu to enumerate secrets or access the AWS console.

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 personal access token is like a password for GitHub that lets tools act on your behalf. If an employee accidentally puts one in a public personal project, an attacker can use it to reach the company's private code and the secrets stored there, which may include cloud login keys.

What is Leaked secrets?

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

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.