Skip to content
Info disclosure Disclosed report Beginner

Github test clientID and clientSecret leaked

A GitHub OAuth app's client ID and client secret were hardcoded in a public repository's git history. An attacker could use these credentials to build a rogue OAuth app that impersonates a trusted maintainer and steals access tokens from users who authorise it.

rira12621 Follow

Originally disclosed on HackerOne

  • Triaged in 18 hours
  • Disclosed after 5 months

Report Submission Form

Summary:

A github clientID and clientSecret for an oauth app are being leaked on github

Description

While looking for anything that is interesting on github I a clientID and clientSecret for a github oauth app hardcoded. While they have been removed a long time ago, they are still valid and usable and easy to be found in the git history.

Steps To Reproduce:

Check each branch and each commit from the past and keep looking for anything that looks like a token. I did this automated using truffleHog (https://github.com/dxa4481/truffleHog)

git clone [email protected]:kubernetes/test-infra.git git checkout 70b274b10ed69dae95902cc3b5d1ead0ad4b6362
git grep ClientSecret

and in mungegithub/mungers/bulk-lgtm.go you will find the clientId and Client Secret

Impact

While these credentials are not directly to be used to access they are bringing an attacker a lot closer.

This allows to build an app that uses github authentication. As per the screenshot attached this will looks as if this was really approved and made by Brendan Burns. I am not sure if this raises or lowers the risk this imposes as he is not directly the CNCF but indeed a pretty well known and trusted person inside the community. If the user now clicks "authenticate" the attackers app follows the authentication flow further until https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#2-users-are-redirected-back-to-your-site-by-github where it receives an access token.

This access token can now be used to impersonate any user that authenticated via our rogue app.

It should be assumed that the callbackURL is unknown but that is not true as github will give us a nice error message and we can rebuild it to https://kubernetes.submit-queue.k8s.io/bulk-lgtm/bulkprs/callback?code=1e1db78bd7e2dfeb6b23 making the github flow complete.

even tho this subdomain doesn't exist anymore, we will still have the victims token.

This can easily be mitigated by revoking or rotating the clientSecret and ID

Attachments

Screenshot_2020-02-13_at_22.30.45.png
Screenshot_2020-02-13_at_22.30.45.png From the original on HackerOne

The original report as published on HackerOne, by rira12621. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely, the OAuth client secret was committed to a public repository and remained in the git history even after removal.

Impact

An attacker could create a rogue OAuth app that appears to be approved by a trusted maintainer and, if a user clicks authenticate, obtain an access token to impersonate that user; the callback URL can be reconstructed from GitHub's error message even though the original subdomain no longer exists.

What the attacker needed

Public repository with git history; victim clicks authenticate on rogue app

The fix

The client secret and ID should be revoked or rotated.

How it was found

  1. Clone the public repository.
  2. Check out an old commit from the git history.
  3. Search the code for the client secret string.
  4. Find the client ID and secret in a specific source file.

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 report has not been written yet. The Original tab links to the source.

OAuth is a way for websites to let you log in with another service, like GitHub. The app has a public ID and a secret key; if the secret leaks, someone can pretend to be that app and trick users into giving them access to their accounts.

What is Info disclosure?

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

More from Kubernetes

View all

The newest disclosed reports for this program.

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.