Skip to content
Leaked secrets Write-up Intermediate

Injected #2: Lessons from Hacking a Financial Company

An exposed .git/config file on a development host contained a GitHub personal access token with access to all company repositories. One repository held hard-coded Office365 credentials for a service account without 2FA, allowing the tester to reset any user's password and take over accounts.

red.whisperer Follow

Published on medium.com

Last week we heard about a massive breach of RedHat, leading provider of enterprise open source solutions which provides many IT and support services to the biggest companies and government orgs in the world.

Chux, 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 a development server exposed its .git directory, leaking a GitHub token that led to hard-coded credentials for a service account without 2FA.

Impact

The tester could take over any user account by resetting passwords and intercepting the reset emails.

What the attacker needed

Exposed .git directory on a dev host; GitHub token with repo access; hard-coded credentials in a repo; service account without 2FA

How it was found

  1. Performed reverse DNS and VirusTotal lookups to find an additional host and vhosts.
  2. Ran dirbusting on the vhosts and found /.git/config on dev.target.com.
  3. Used GitTools to dump the exposed code and found a GitHub personal access token.
  4. Validated the token against the GitHub API and enumerated repositories, finding access to all company repositories.
  5. Downloaded all repositories and found hard-coded credentials in a testing environment repository.
  6. Used the credentials to authenticate to Office365 mail and reset any user's password to achieve account takeover.

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 development server accidentally exposed its .git folder, which can contain configuration files with secrets. One secret was a GitHub token that let the tester read all the company's code, where they found a username and password for an email account. Because that email account had no two-factor authentication, the tester could read password reset emails and take over other users' accounts.

What is Leaked secrets?

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

More by red.whisperer

View all

2 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.