Skip to content
Leaked secrets Disclosed report Beginner

A HackerOne employee's GitHub personal access token exposed in Travis CI build logs

sainaen Follow

Originally disclosed on HackerOne

Bounty$2,000 Medium 6.8 View original
  • Triaged in under an hour
  • Fixed in 6 days
  • Paid in 2 months
  • Disclosed after 2 months

Summary A HackerOne employee Reed Loden (GitHub:reedloden) exposed their personal access token twice in build logs of the rubysec/rubysec.github.io project:

  1. 2015-12-10
  2. 2016-03-01

Description The token has public_repo scope, which means that it allows access to any public repos the owner account has access to, with the same permissions. This includes all public repositories under Hacker0x01, for which Reed has full access: pull, push, as well as admin permissions.

Cause The cause of this as far as I can tell is incorrect use of git push command in the script: passing a-q/--quiet option is not enough, as according to help it “Suppresses all output <…> unless an error occurs”, which happened in those two cases, in turn because of missing --force option.

Other In addition to revoking the token, you might want to review any commits to your repositories since the first exposure. The token allows to push from the Reeds account, but commit's author/committer can be set to anything. As far as I know, there's no UI on GitHUb to see what commits were pushed from the particular account.

Also, please, make sure not to disclose this issue publicly (including by accident, with a commit message, for example) at least for some time. Revoking/rotating token with a generic “updating the token” commit should be fine though, as generally nobody pays attention to them.

Note, that I've contacted GitHub to perform mass revocation of credentials that I found, but they aren't as fast as I hoped, so meanwhile I'm trying to notify affected parties individually.

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

HackerOne runs a public bug bounty programme, and its own staff are also users of the platform. This report concerns a HackerOne employee, Reed Loden, whose GitHub personal access token leaked into the build logs of a public project. The project in question is rubysec/rubysec.github.io, whose builds run on Travis CI. The build logs of that project are public, so anything printed during a build is readable by anyone.

The token was a GitHub personal access token with the public_repo scope. That scope grants access to any public repository the owning account can reach, with the same permissions the account holds on it. For Reed that included every public repository under the Hacker0x01 organisation, where he had full access: pull, push and admin permissions.

Setup

No special tooling was needed. The researcher read public Travis CI build logs for rubysec/rubysec.github.io and found the token printed in them. The relevant pieces are:

  • A GitHub account (Reed's) holding a personal access token with the public_repo scope.
  • Membership of the Hacker0x01 organisation with full permissions on its public repositories.
  • A Travis CI build for rubysec/rubysec.github.io that runs a deployment script, scripts/post-advisories.sh from rubysec/ruby-advisory-db, which performs a git push.

Finding it

The token appeared twice in the build logs of the project:

  1. The build of 2015-12-10, at line 258 of the job log.
  2. The build of 2016-03-01, at line 319 of the job log.

Both were ordinary public Travis CI job logs. The same token appeared in two builds, months apart.

Exploitation

Step 1: identify the scope of the leaked token

The researcher established that the token carried the public_repo scope. Per GitHub's OAuth scope documentation, that scope allows access to any public repository the owner account can access, with the same permissions. Because Reed had full access to the public repositories under Hacker0x01, the token inherited pull, push and admin rights there.

Step 2: understand why the token was printed

The cause, as far as the researcher could tell, was incorrect use of the git push command in the deployment script. The script passes a -q/--quiet option, which is not enough. According to the help text, the option "Suppresses all output <…> unless an error occurs". In the two builds above an error did occur, so the suppressed output, including the token, was written to the log. The error itself happened because the --force option was missing.

Step 3: assess what the token allows

With public_repo on an account that has full access to Hacker0x01 public repositories, the token permits pushing to those repositories. The researcher also noted that the token allows pushing from Reed's account, but the author and committer fields of a commit can be set to anything, so the identity recorded in a commit does not prove who pushed it. As far as the researcher knew, GitHub offers no UI to see which commits were pushed from a particular account.

Root cause

The mistake is in the deployment script: it relies on git push -q to keep credentials out of the log. The quiet flag only suppresses output while everything succeeds; on error, the full output is emitted, and that output contained the personal access token. The error was triggered by the absence of --force, so a push that needed forcing failed and dumped its output into a public log. The quiet flag only suppresses output while everything succeeds; on error, the full output is emitted.

Impact

Anyone reading the public Travis CI logs could obtain a GitHub token with public_repo scope belonging to a HackerOne employee. With it, an attacker could pull from, push to and administer any public repository under Hacker0x01 that Reed had access to. Because commit author and committer metadata can be set arbitrarily, pushes made with the token would not necessarily be attributable to Reed, and GitHub provides no UI to list commits pushed from a given account. The report does not describe any actual misuse of the token; the impact is the access the token granted while it remained valid.

Fix

The report asks for the token to be revoked. It also suggests reviewing any commits to the affected repositories since the first exposure, given the push capability and the fact that commit metadata can be forged. The researcher asked that the issue not be disclosed publicly, including accidentally through a commit message, for at least some time, while noting that revoking or rotating the token with a generic "updating the token" commit should be fine because nobody generally pays attention to such commits. The report does not state which of these changes were actually made.

Variants to test

  • Look for CI build logs of public projects that deploy with git push and rely on -q/--quiet. A positive result is a failed push whose log contains credentials or a remote URL with embedded credentials.
  • Search public CI logs for tokens, passwords and remote URLs containing credentials. A positive result is a live credential with a scope you can confirm.
  • Check whether a leaked token's scope reaches beyond the project it leaked from, for example into an organisation where the owner has broader rights. A positive result is push or admin access to repositories the token owner can reach.
  • Where a token has push rights, consider that commit author and committer fields can be set to anything, so attribution from commit metadata alone is unreliable.

Hunting notes

This kind of bug hides in build and deployment logs of public CI systems, especially where scripts push to Git remotes and assume quiet flags keep secrets out of output. The signal during recon is a public repository whose CI configuration runs a deploy script with git push and a quiet option, combined with public job logs. The token's public_repo scope reached the Hacker0x01 organisation, where Reed had pull, push and admin permissions. The report also notes that the researcher contacted GitHub for mass revocation of credentials found, and was notifying affected parties individually because that process was slower than hoped.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 13 min read.

What happened, in plain words

A HackerOne employee, Reed Loden, had a special password-like string called a personal access token for GitHub. That token was printed, in full, in the public build logs of a project called rubysec/rubysec.github.io. Anyone on the internet could read those logs. The token appeared twice, months apart, in the logs of two builds run by a service called Travis CI.

A token is like a key card for a building. You do not type your username and password every time; you show the card and the door opens. If someone photographs your card, they can make a copy and get through the same doors you can. Here the "doors" were GitHub repositories, and the token opened every public repository that Reed's account could reach, including repositories belonging to the Hacker0x01 organisation, where Reed had full rights.

The researcher found the token in public build logs and worked out what it could do. That is the whole discovery.

Context

HackerOne runs a public bug bounty programme. A bug bounty programme is an arrangement where a company invites outside people to look for security mistakes in its systems and pays for good reports. HackerOne's own staff also use the platform, so a mistake in a staff member's setup can matter to the company.

This report is about one such staff member, Reed Loden, and a GitHub token of his that leaked into the build logs of a public project.

A few terms first, because the rest of the article depends on them:

  • GitHub is a website where people store and share code. Each project lives in a repository (often shortened to repo), which is a folder of files plus the full history of every change made to them.
  • Public repository means anyone can read it. Private means only invited people can.
  • Organisation on GitHub is a shared account that groups repositories and people. Hacker0x01 is HackerOne's organisation. Members can be given different levels of permission on the organisation's repositories.
  • Travis CI is a continuous integration service. Continuous integration means: every time someone changes the code, a computer automatically runs a set of steps, such as building the site or running tests. Travis CI does this in the cloud and writes a build log, a text record of everything the steps printed. For public projects, those logs are public too.
  • GitHub Pages is a GitHub feature that publishes a website directly from a repository. The project here, rubysec/rubysec.github.io, is such a site, and Travis CI builds and deploys it.

The build logs of that project are public, so anything printed during a build is readable by anyone with a browser.

The token was a GitHub personal access token with the public_repo scope. A scope is a limit written on a token that says what it is allowed to do, like the list of rooms a key card opens. public_repo means: this token may act on any public repository the owning account can reach, with the same permissions that account has there. For Reed that included every public repository under the Hacker0x01 organisation, where he had full access: pull, push and admin permissions.

Those three permissions are worth spelling out:

  • Pull means read: download the code and its history.
  • Push means write: send new changes to the repository.
  • Admin means change the repository's settings and who may access it.

So the leaked string was not just a read-only key. It was a key that could change code and settings in HackerOne's public repositories.

Setup

No special tooling was needed. The researcher read public Travis CI build logs for rubysec/rubysec.github.io and found the token printed in them. There was no scanner, no exploit script, no account of their own inside the target. A browser was enough.

The relevant pieces are:

  • A GitHub account (Reed's) holding a personal access token with the public_repo scope.
  • Membership of the Hacker0x01 organisation with full permissions on its public repositories.
  • A Travis CI build for rubysec/rubysec.github.io that runs a deployment script, scripts/post-advisories.sh from rubysec/ruby-advisory-db, which performs a git push.

That last point needs unpacking. Git is the tool that records changes to code. A push is the act of sending your local changes up to a remote copy, here GitHub. The deployment script is a small program that Travis CI runs automatically; part of its job is to push something to GitHub. To push, it must prove who it is, and it does that with the token. If the push prints anything to the screen, Travis CI writes that text into the build log, and the log is public.

Finding it

The token appeared twice in the build logs of the project:

  1. The build of 2015-12-10, at line 258 of the job log.
  2. The build of 2016-03-01, at line 319 of the job log.

Both were ordinary public Travis CI job logs. The exposure was not a one-off accident of a single build; the same token was printed again months later, which points at a recurring condition in the deployment script rather than a transient mistake.

That distinction matters. A one-off leak might be a slip by one person on one day. The same secret appeared again about three months later, in a second build.

Exploitation

"Exploitation" here does not mean the researcher used the token to change anything. It means they worked out what the token could do, step by step, and wrote that down.

Step 1: identify the scope of the leaked token

The researcher established that the token carried the public_repo scope. Per GitHub's OAuth scope documentation, that scope allows access to any public repository the owner account can access, with the same permissions. Because Reed had full access to the public repositories under Hacker0x01, the token inherited pull, push and admin rights there.

Why this step comes first: a leaked string on its own tells you nothing about severity. A token that can only read one public repository is a small problem. A token that can push to and administer an organisation's repositories is a serious one. The scope is what turns "a secret leaked" into "here is exactly which doors it opens".

Step 2: understand why the token was printed

The cause, as far as the researcher could tell, was incorrect use of the git push command in the deployment script. The script passes a -q/--quiet option, which is not enough. According to the help text, the option "Suppresses all output <…> unless an error occurs". In the two builds above an error did occur, so the suppressed output, including the token, was written to the log. The error itself happened because the --force option was missing.

In plain words: the script told Git "be quiet, do not print anything". Git obeyed while everything went well. But "be quiet" in Git means "stay silent unless something goes wrong", and when something goes wrong Git prints the full details so a human can debug it. Those details included the token. The thing that went wrong was that the push needed the --force option and did not have it, so the push failed, and the failure message carried the secret into a public log.

This is the heart of the bug. Quiet mode is a convenience for tidy logs, not a security control. It was never designed to keep secrets out of output, and it fails precisely in the situation where output is most likely to be read and kept.

Step 3: assess what the token allows

With public_repo on an account that has full access to Hacker0x01 public repositories, the token permits pushing to those repositories. The researcher also noted that the token allows pushing from Reed's account, but the author and committer fields of a commit can be set to anything, so the identity recorded in a commit does not prove who pushed it. As far as the researcher knew, GitHub offers no UI to see which commits were pushed from a particular account.

Two ideas need explaining here.

A commit is one saved change in a repository's history. Each commit records an author and a committer, meaning the name and email address written into the record. Those fields are just text that whoever makes the commit supplies. Git does not verify them against an account. So a commit can say it was written by anyone, and that label proves nothing about who actually sent it.

A UI (user interface) is the set of pages and buttons you see in a browser. The researcher's point is that GitHub's website, as far as they knew, offered no page listing "commits pushed from this account". You can browse commits, but not filter them by who uploaded them. That makes later investigation harder: if someone had used the token, the commits would not obviously point back to the token's owner.

Root cause

The mistake is in the deployment script: it relies on git push -q to keep credentials out of the log. The quiet flag only suppresses output while everything succeeds; on error, the full output is emitted, and that output contained the personal access token. The error was triggered by the absence of --force, so a push that needed forcing failed and dumped its output into a public log. The quiet flag only suppresses output while everything succeeds; on error, the full output is emitted.

A comparison: putting a "do not disturb" sign on your door keeps people from knocking, but it does not stop anyone from reading the letter you left in the hallway. Quiet mode keeps logs tidy; it does not hide secrets. If a secret must never appear in output, the fix is to keep the secret out of the command's output entirely, not to ask the command to be quiet.

Impact

Anyone reading the public Travis CI logs could obtain a GitHub token with public_repo scope belonging to a HackerOne employee. With it, an attacker could pull from, push to and administer any public repository under Hacker0x01 that Reed had access to. Because commit author and committer metadata can be set arbitrarily, pushes made with the token would not necessarily be attributable to Reed, and GitHub provides no UI to list commits pushed from a given account. The report does not describe any actual misuse of the token; the impact is the access the token granted while it remained valid.

That last sentence is important for reading the report honestly. Nobody is accused of using the token. The finding is that the token was exposed and that it carried real power. The risk exists for as long as the token stays valid, which is why the first request in the fix is to revoke it.

Fix

The report asks for the token to be revoked. Revoking means cancelling the token so it stops working immediately, like deactivating a lost key card. It also suggests reviewing any commits to the affected repositories since the first exposure, given the push capability and the fact that commit metadata can be forged. The researcher asked that the issue not be disclosed publicly, including accidentally through a commit message, for at least some time, while noting that revoking or rotating the token with a generic "updating the token" commit should be fine because nobody generally pays attention to such commits. The report does not state which of these changes were actually made.

Why the commit-message warning: a commit message is the short note attached to a change, and it is public along with the repository. If someone writes "revoking leaked token found by researcher X" in that note, they have just announced the problem to the world before it is fixed. A bland message such as "updating the token" reveals nothing, which is why the researcher considered it acceptable.

Rotating a token means replacing it with a new one and retiring the old one, the same idea as changing a password after it has been exposed.

Variants to test

These are patterns a beginner can look for, in the same spirit as the original finding. Each one describes what to search for and what a positive result looks like.

  • Look for CI build logs of public projects that deploy with git push and rely on -q/--quiet. A positive result is a failed push whose log contains credentials or a remote URL with embedded credentials.
  • Search public CI logs for tokens, passwords and remote URLs containing credentials. A positive result is a live credential with a scope you can confirm.
  • Check whether a leaked token's scope reaches beyond the project it leaked from, for example into an organisation where the owner has broader rights. A positive result is push or admin access to repositories the token owner can reach.
  • Where a token has push rights, consider that commit author and committer fields can be set to anything, so attribution from commit metadata alone is unreliable.

A remote URL with embedded credentials is a web address for a Git repository that has the username and password (or token) written into the address itself, for example in the form https://user:secret@host/path. If such an address is printed in a log, the secret is printed with it.

Hunting notes

This kind of bug hides in build and deployment logs of public CI systems, especially where scripts push to Git remotes and assume quiet flags keep secrets out of output. The signal during recon (short for reconnaissance, the early stage of looking around a target before testing anything) is a public repository whose CI configuration runs a deploy script with git push and a quiet option, combined with public job logs.

The researcher showed impact by tying the token's scope to a specific organisation and enumerating the permissions it carried there (pull, push, admin), which turned a leaked string into a concrete access grant. That is the lesson for a beginner: finding a secret is only half the work. The other half is showing, in specific terms, what that secret lets someone do.

The report also notes that the researcher contacted GitHub for mass revocation of credentials found, and was notifying affected parties individually because that process was slower than hoped. In other words, the researcher had found more than one leaked credential and was trying to get them cancelled in bulk, while telling each affected owner directly in the meantime.

Glossary

  • Admin permission: the right to change a repository's settings and who may access it.
  • API: a way for one program to talk to another over the internet, like a service counter where you make a request and get a response.
  • Author / committer: the name and email recorded in a commit as having written and applied the change; these are free text and are not verified.
  • Build log: the text record of everything a CI job printed while it ran.
  • Bug bounty programme: an arrangement where a company invites outside people to find security mistakes and pays for good reports.
  • CI (continuous integration): a service that automatically runs steps such as building or testing code whenever it changes.
  • Commit: one saved change in a repository's history, with a message and author details.
  • Commit message: the short note attached to a commit, visible to anyone who can see the repository.
  • Continuous integration: see CI.
  • Credential: any secret that proves identity, such as a password or token.
  • Deployment script: a small program that publishes or updates a project automatically.
  • Git: the tool that records changes to code and their history.
  • GitHub: a website for storing and sharing code repositories.
  • GitHub Pages: a GitHub feature that publishes a website from a repository.
  • GitHub personal access token: a long secret string that acts as a password for a GitHub account, with limits (scopes) on what it may do.
  • Organisation (GitHub): a shared account that groups repositories and people, with per-person permissions.
  • OAuth scope documentation: GitHub's published description of what each scope on a token permits.
  • Personal access token: see GitHub personal access token.
  • Private repository: a repository only invited people can read.
  • Public repository: a repository anyone can read.
  • Pull: to read or download a repository and its history.
  • Push: to send changes from your copy of a repository up to the remote copy.
  • Recon: reconnaissance, the early stage of looking around a target before testing.
  • Remote URL: the web address of a repository hosted somewhere else, used when pushing or pulling.
  • Repository (repo): a folder of code plus the full history of changes to it.
  • Revoke: to cancel a credential so it stops working.
  • Rotate: to replace a credential with a new one and retire the old one.
  • Scope: a limit written on a token saying what it is allowed to do.
  • Token: a secret string used in place of a password to prove identity to a service.
  • Travis CI: a continuous integration service that runs builds and keeps their logs.
  • UI (user interface): the pages and buttons you see and use in a browser.
  • --force: a Git option that makes a push overwrite the remote history instead of being refused.
  • -q / --quiet: a Git option that suppresses normal output but still prints details when an error occurs.

More by sainaen

View all

3 more disclosed reports, best first.

More from HackerOne

View all

The newest disclosed reports for this program.

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.