An “algobot”-s GitHub access token was leaked
A GitHub access token for the algobot account was leaked in Travis CI job logs because the build output from a git clone command was not properly handled. The token has public_repo scope, giving commit access to any public repositories the account can access, affecting both instantsearch.js and docsearch projects.
- Triaged in under an hour
- Fixed in 11 days
- Paid in 11 days
- Disclosed after 3 months
An access token of algobot account was first leaked 2015-12-02 in this Travis CI job log of instantsearch.js project due to incorrect handling of output from command git clone (or a ghpages module to be more specific.) Since then, the configuration of that project seems to have been changed not to perform this operation (last build with token found is from 2016-01-06), but the docsearch project still uses it and leaks algobot's token with every build of the master branch, here's for example the latest one.
This token has a public_repo scope, so it gives commit access to any public repositories its owner has access to. So both instantsearch.js and docsearch are affected.
You may want to verify that there were no suspicious changes since the first leak. Unfortunately I didn't find any way to check the token usage history, so cannot help with that.
Note that I did use this token to get its owner info (GET call to endpoint https://api.github.com/user) and repositories that belong to them (GET call to https://api.github.com/user/repos), but I didn't attempt to perform any other operations.
Also, please be sure to avoid disclosing this issue accidentally (e.g. in commit messages), as I'm still working with others that have similar leaks. Revoking/rotating tokens without explanation with simple “updating the token” should be fine though, generally nobody pays attention to them.
Context
Algolia runs two open source projects on GitHub, instantsearch.js and docsearch. Both are built and published through Travis CI, and the publishing step needs to push generated documentation to GitHub Pages. To do that, the build uses the credentials of a dedicated GitHub account, algobot, whose access token is made available to the build.
The report is about that token ending up in a place anyone can read: the public Travis CI job log. A GitHub access token with the public_repo scope is not a read-only artefact. It grants commit access to every public repository its owner can reach, so a leaked one is a write primitive against those repositories, not just an information leak.
Setup
No special access was needed. The researcher worked entirely from public material:
- Public Travis CI build logs for the
algolia/instantsearch.jsandalgolia/docsearchrepositories. - The public GitHub account
algobotand its public repositories. - The leaked token itself, taken from a log line.
The only precondition is that the projects build in the open, with logs visible to anonymous visitors, and that the build prints the output of the command that handles the token.
Finding it
The token was first leaked on 2015-12-02 in a Travis CI job log of the instantsearch.js project. The cause was incorrect handling of the output from git clone, or more specifically from a ghpages module: the command's output, which contained the token, was written into the log.
That project appears to have been reconfigured so the operation no longer runs. The last build in which the researcher found the token is dated 2016-01-06. But the docsearch project still uses the same mechanism and leaks algobot's token on every build of the master branch. The researcher linked the most recent such build as an example.
The relevant line in the docsearch repository is in scripts/docs/gh-pages.js at line 10, which the researcher linked directly as the place where the project uses the token.
Exploitation
Step 1: Read the token from the build log
Open a public Travis CI log for a master build of docsearch and find the line where the ghpages output is printed. The token appears there in clear text. No request is needed; the log is public.
Step 2: Confirm the token's scope
The researcher states that the token has the public_repo scope. That scope allows commits to any public repository the token's owner has access to, which covers both instantsearch.js and docsearch.
Step 3: Identify the token's owner
To establish whose credentials were leaked, the researcher made a GET request to the GitHub user endpoint:
With the leaked token as the credential, this returns the account the token belongs to, which is algobot.
Step 4: Enumerate the repositories the token can reach
A second GET request listed the repositories belonging to that account:
This shows the set of repositories the token can act on, which is what turns "a leaked string" into a concrete statement about which projects are exposed.
The researcher explicitly notes that these two GET calls were the only operations performed with the token. No writes, commits or other actions were attempted.
Step 5: Check for prior abuse
The researcher tried to determine whether anyone had made suspicious changes since the first leak in 2015. No way to check the token's usage history was found, so this could not be answered. That gap is worth stating plainly: a leaked token that has been public for over a year may have been used, and the report cannot rule it out.
Root cause
The mistake is in how the build handles command output. The ghpages module, invoked around git clone, produces output that includes the token, and that output ends up in the Travis CI log because of incorrect handling. Because the log is public, the secret is published on every master build.
The underlying issue is that a credential is passed into a build step whose output is published. The instantsearch.js project appears to have changed its configuration so the operation no longer runs, but the same pattern remained in docsearch.
Impact
An attacker who reads the public log obtains a GitHub token with the public_repo scope. That gives commit access to any public repository the algobot account can reach, so both instantsearch.js and docsearch are affected. In practice this means an attacker could commit changes to those repositories.
The report does not claim that any such change was made. The researcher could not check the token's usage history, so whether the token was abused between the first leak and the report is unknown. The severity recorded for the report is medium, with a bounty of 100.00 USD.
Fix
The report does not describe the fix that was applied. What it does say is that instantsearch.js was reconfigured so the leaking operation no longer runs, and that docsearch still performed it at the time of writing. The implied remediation is to stop the token from reaching the log at all.
The researcher also asked that the issue not be disclosed accidentally, for instance in commit messages, because other similar leaks were still being worked on. Revoking or rotating the token without explanation, with a simple "updating the token", should be fine.
Variants to test
- Other CI providers and log visibility. Check public build logs on Travis CI, CircleCI, GitLab CI and similar for lines produced by deployment tooling. A positive result is a credential-shaped string in a log that an anonymous visitor can load.
- Deployment modules that wrap
git. Look at build scripts that callghpages,git clone,git pushor similar and capture their output. A positive result is the command's output, including any URL with embedded credentials, appearing in the log. - Sibling repositories of a known leak. When one project has been fixed, check its sibling projects for the same script. A positive result is the same leaking line in a repository that was not updated.
- Scope of the leaked credential. Once a token is found, query the identity and repository endpoints to see what it can reach. A positive result is a token whose scope allows writes, not just reads.
Hunting notes
This class of bug hides in build and deployment configuration rather than in application code: scripts that publish documentation, run git commands, or hand credentials to third-party modules. The signal during recon is a public CI log for a repository that deploys somewhere, combined with a build step whose output is not suppressed. Searching logs for token-like strings, or reading the deployment script to see whether it prints command output, is enough to find it.
The researcher established impact in three moves: showing the token in a current, public log; showing its scope (public_repo); and enumerating the account and its repositories so the affected projects were named concretely. The report also states the limits of what was done, namely two GET requests and no attempt to check usage history, which keeps the claim honest and easy for the program to verify.
What happened, in plain words
Algolia is a company that makes search tools. It publishes two open source projects on GitHub, a website where code is stored and shared: instantsearch.js and docsearch. Both projects are built and published automatically by a service called Travis CI. Travis CI is a build service: you give it a project, and every time someone changes the code, it runs a series of commands for you, such as compiling the code and putting the finished documentation online. The record of everything those commands printed is called a build log, and on Travis CI these logs are public, meaning anyone with a browser can read them.
To publish the documentation to GitHub Pages (a free way to host a website straight from a GitHub repository), the build has to push files to GitHub. Pushing means sending changes to a repository, and GitHub only allows that if you prove who you are. The build therefore uses the credentials of a dedicated GitHub account called algobot. The proof of identity it uses is an access token.
A token is a long string of characters that works like a key: whoever holds it is treated by GitHub as the account it belongs to, without needing a username and password. It is similar to a hotel key card: the card does not contain your name, but the door opens for whoever is holding it.
The problem in this report is that this token ended up in a place anyone can read: the public Travis CI build log. A GitHub token is not always harmless when it leaks. This particular token had a permission setting called public_repo, which allows writing to every public repository the account can reach. So a leaked token here is not just a piece of information that got out; it is a way for a stranger to make changes to those repositories, as if they were the project itself.
Setup
No special access was needed to find this. The researcher worked entirely from material that is open to the public:
- The public Travis CI build logs of the
algolia/instantsearch.jsandalgolia/docsearchrepositories. - The public GitHub account
algobotand its public repositories. - The leaked token itself, copied from a line in a log.
The only precondition is that the projects build in the open, with logs that anonymous visitors can load, and that the build prints the output of the command that handles the token.
Finding it
The token was first leaked on 2015-12-02 in a Travis CI job log of the instantsearch.js project. The cause was incorrect handling of the output from git clone, or more specifically from a ghpages module. git clone is the command that copies a repository from GitHub to the build machine. The ghpages module is a helper that wraps that command to publish documentation. The command's output, which contained the token, was written into the log.
That project appears to have been reconfigured so the operation no longer runs. The last build in which the researcher found the token is dated 2016-01-06. But the docsearch project still uses the same mechanism and leaks algobot's token on every build of the master branch. Master is the main line of development, so every build of it means every routine build. The researcher linked the most recent such build as an example.
The relevant line in the docsearch repository is in scripts/docs/gh-pages.js at line 10, which the researcher linked directly as the place where the project uses the token.
Exploitation
Step 1: Read the token from the build log
Open a public Travis CI log for a master build of docsearch and find the line where the ghpages output is printed. The token appears there in clear text. No request is needed; the log is public. This step is simply reading a web page, which is why the finding is so direct: nothing has to be guessed or broken into.
Step 2: Confirm the token's scope
The researcher states that the token has the public_repo scope. A scope is a permission setting attached to a token that says what it is allowed to do. public_repo allows commits to any public repository the token's owner has access to, which covers both instantsearch.js and docsearch. Knowing the scope is what turns a leaked string into a statement about real risk: a token that could only read would be a much smaller problem than one that can write.
Step 3: Identify the token's owner
To establish whose credentials were leaked, the researcher made a GET request to the GitHub user endpoint:
An API is a way for one program to talk to another over the web, using addresses called endpoints. Each endpoint does one job. https://api.github.com/user is GitHub's endpoint that answers the question "who am I?", based on the credential sent with the request. GET is the type of request used to ask for information, as opposed to sending or changing it.
Line by line:
GETis the request method: it asks the server to return something, without changing anything.https://api.github.com/useris the address of the endpoint.api.github.comis GitHub's machine-facing service, and/useris the part that describes the account behind the credential.
With the leaked token as the credential, this returns the account the token belongs to, which is algobot. The researcher did this to prove the link between the leaked string and a real account, rather than assuming it.
Step 4: Enumerate the repositories the token can reach
A second GET request listed the repositories belonging to that account:
Line by line:
GETagain asks for information only.https://api.github.com/user/reposis the endpoint that returns the list of repositories owned by the account behind the credential.reposis short for repositories.
This shows the set of repositories the token can act on, which is what turns "a leaked string" into a concrete statement about which projects are exposed. Without this step, the report could only say that some token leaked; with it, the affected projects can be named.
The researcher explicitly notes that these two GET calls were the only operations performed with the token. No writes, commits or other actions were attempted. This matters for trust: the researcher demonstrated the risk without actually changing anything.
Step 5: Check for prior abuse
The researcher tried to determine whether anyone had made suspicious changes since the first leak in 2015. No way to check the token's usage history was found, so this could not be answered. That gap is worth stating plainly: a leaked token that has been public for over a year may have been used, and the report cannot rule it out.
Root cause
The mistake is in how the build handles command output. The ghpages module, invoked around git clone, produces output that includes the token, and that output ends up in the Travis CI log because of incorrect handling. Because the log is public, the secret is published on every master build.
The underlying issue is that a credential is passed into a build step whose output is published. A long-lived credential is one that stays valid until someone deliberately cancels it, unlike a short-lived one that expires on its own. Redacting means replacing the sensitive part with something harmless before showing it. The instantsearch.js project appears to have changed its configuration so the operation no longer runs, but the same pattern remained in docsearch.
Impact
An attacker who reads the public log obtains a GitHub token with the public_repo scope. That gives commit access to any public repository the algobot account can reach, so both instantsearch.js and docsearch are affected. In practice this means an attacker could commit changes to those repositories.
The report does not claim that any such change was made. The researcher could not check the token's usage history, so whether the token was abused between the first leak and the report is unknown. The severity recorded for the report is medium, with a bounty of 100.00 USD. A bounty is a reward a company pays to someone who reports a security problem responsibly.
Fix
The report does not describe the fix that was applied. What it does say is that instantsearch.js was reconfigured so the leaking operation no longer runs, and that docsearch still performed it at the time of writing. The implied remediation is to stop the token from reaching the log at all. Rotating means replacing the old credential with a new one and cancelling the old one, so that anyone holding the old one loses access.
The researcher also asked that the issue not be disclosed accidentally, for instance in commit messages, because other similar leaks were still being worked on. A commit message is the short note attached to each change in a repository, and it is public too. Revoking or rotating the token without explanation, with a simple "updating the token", should be fine.
Variants to test
- Other CI providers and log visibility. Check public build logs on Travis CI, CircleCI, GitLab CI and similar for lines produced by deployment tooling. A positive result is a credential-shaped string in a log that an anonymous visitor can load.
- Deployment modules that wrap
git. Look at build scripts that callghpages,git clone,git pushor similar and capture their output. A positive result is the command's output, including any URL with embedded credentials, appearing in the log. - Sibling repositories of a known leak. When one project has been fixed, check its sibling projects for the same script. A positive result is the same leaking line in a repository that was not updated.
- Scope of the leaked credential. Once a token is found, query the identity and repository endpoints to see what it can reach. A positive result is a token whose scope allows writes, not just reads.
Hunting notes
This class of bug hides in build and deployment configuration rather than in application code: scripts that publish documentation, run git commands, or hand credentials to third-party modules. The signal during recon is a public CI log for a repository that deploys somewhere, combined with a build step whose output is not suppressed. Searching logs for token-like strings, or reading the deployment script to see whether it prints command output, is enough to find it.
The researcher established impact in three moves: showing the token in a current, public log; showing its scope (public_repo); and enumerating the account and its repositories so the affected projects were named concretely. The report also states the limits of what was done, namely two GET requests and no attempt to check usage history, which keeps the claim honest and easy for the program to verify.
Glossary
- Access token: a long string of characters that acts as a key to an account, so whoever holds it is treated as that account.
- API: a way for programs to talk to each other over the web, through fixed addresses called endpoints.
- Bounty: a reward a company pays to someone who reports a security problem responsibly.
- Build: the automatic run of commands that compiles a project and publishes its output.
- Build log: the record of everything a build printed, often readable by anyone.
- CI (continuous integration): a service that runs a project's build automatically whenever the code changes.
- Commit: a saved change in a repository, with a short message describing it.
- Commit access: permission to add changes to a repository.
- Credential: anything used to prove identity, such as a password or a token.
- Endpoint: one specific address in an API that performs one job.
- GET request: a request that asks a server to return information without changing anything.
- Git: the tool used to track and share changes to code.
git clone: the command that copies a repository from a server to the local machine.- GitHub: a website that hosts code repositories and lets people collaborate on them.
- GitHub Pages: a free way to host a website directly from a GitHub repository.
ghpagesmodule: a helper program that wrapsgitcommands to publish documentation to GitHub Pages.- Master branch: the main line of development in a repository.
- Open source: software whose code is published for anyone to read and use.
public_reposcope: a permission setting that allows writing to every public repository the account can reach.- Redaction: replacing sensitive parts of a text with something harmless before showing it.
- Repository (repo): a project's folder of code and its history, hosted on a service such as GitHub.
- Rotation: replacing a credential with a new one and cancelling the old one.
- Scope: a permission setting attached to a credential that says what it may do.
- Severity: a rating of how serious a security problem is.
- Travis CI: a build service that runs a project's commands automatically and keeps public logs.
- Vulnerability class: a family of security problems that share the same underlying mistake, here information disclosure.