Zendesk’s Google Cloud and Artifactory
Two public GitHub repositories contained Zendesk employee dotfiles with valid Artifactory tokens and Google Cloud legacy credentials. An attacker could use these to access Zendesk's Artifactory and Google Cloud projects, potentially including production systems.
Published on blog.assetnote.io
At Assetnote, we’re a small team and all of us come from an InfoSec background and part of our product development is our team actively monitoring trends in the causation of organizational exposures and breaches. One common pattern we’ve identified is employees and contractors of organizations accidentally leaking…
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.
Context
Assetnote is a small team with an InfoSec background, and part of its product development involves actively monitoring trends in how organisational exposures and breaches come about. One recurring pattern the team identified is employees and contractors accidentally leaking sensitive data such as credentials, source code and even raw customer PII on third-party platform sites like GitHub, PasteBin and Trello.
This article focuses on exposures on GitHub. These are typically made by employees or contractors of a technical discipline and are more likely to contain credentials with access to infrastructure. Git is tricky to get right, and while many of the cases disclosed through vulnerability disclosure programmes are due to credentials left in a historical commit (some even labelled "Remove credentials"), in some cases credentials are left in the HEAD of the master branch.
The article announces the Third-Party Platform Exposure (TPPE) module, planned for the Assetnote continuous security platform later that year, and discloses some of the most critical findings from benchmarking against public bug bounty targets. The target discussed here is Zendesk.
Setup
No accounts, roles or tool versions are described beyond the following. The TPPE monitor was launched for a beta test, and on 15 February it detected two public repositories containing Zendesk employee dotfiles. A dotfile repository is typically used by a developer for easy portability of their CLI and SDK settings. The researcher's local shell is shown with the prompt ruby@nippon:~|⇒, and the tools used are curl and the gcloud CLI.
Finding it
Looking at the first repository, the TPPE monitor reported that two common formats of credentials were present: an Artifactory token for a repository hosted with JFrog, and a GCloud "legacy-credentials" folder. Upon inspection by the team, these credentials were determined to be valid.
In the second repository, the monitor highlighted similar looking Artifactory credentials with a different type of token.
Exploitation
Step 1: Confirm the Artifactory token from the first repository
The Artifactory token was confirmed by making a request to the hostname in the environment variables with the username and token listed:
export ARTIFACTORY_KEY="<REDACTED>"; # For HTTP repository accessexport ARTIFACTORY_USERNAME="<REDACTED>";curl u $ARTIFACTORY_USERNAME:$ARTIFACTORY_KEY https://<REDACTED>/artifactory/api/buildResponse:{ "uri": "http://<REDACTED>/artifactory/api/build"...
The curl call authenticates with the username and key against the Artifactory API build endpoint on the hostname in the environment variables. The response begins with a uri field pointing at the Artifactory API build path.
Step 2: Validate the Google Cloud legacy credentials
Making an authenticated request to the Google Cloud API by cURL with the legacy credentials format is not particularly straightforward. Instead, the team found that simply using the gcloud configuration folder from the repository in their local shell let them use the gcloud CLI as if they were the user:
ruby@nippon:~|⇒ cp <REDACTED>/.config/gcoud ~/.config/gcloudruby@nippon:~|⇒ gcloud projects listPROJECT_ID NAME PROJECT_NUMBER...<REDACTED> Bime development <REDACTED><REDACTED> Bime preproduction <REDACTED><REDACTED> Bime production <REDACTED>…<REDACTED> Zendesk Authentication <REDACTED>…<REDACTED> Voice Production <REDACTED>…<REDACTED> Zendesk Billing <REDACTED>...
Copying the configuration folder into ~/.config/gcloud and running gcloud projects list returned the projects the credentials could see. The output shown lists projects including Bime development, Bime preproduction, Bime production, Zendesk Authentication, Voice Production and Zendesk Billing. These are some of the roughly 150 projects the user's credentials had access to; the project names were slightly altered but are in essence what the projects were.
Step 3: Note the SSH reach
For those unfamiliar with Google Cloud, it makes management of SSH access easy by removing the need to add all authorised users' SSH keys to boxes, and instead allows SSH to instances using:
gcloud compute ssh <instance>
This was not tested upon discovery of the bug, but investigation afterwards showed it would have been possible for externally reachable instances using that command.
Step 4: Confirm the second repository's Artifactory credentials
Using an updated proof of concept, the team proved that the credentials in the second repository, a different type of token, were valid too:
Here the username and API key are exported and passed to curl with -i to include response headers, against the Artifactory API path on the host.
Root cause
Both repositories were leaked accidentally. The article notes that in its experience the majority of leaks were in repositories intended to be public, with credentials included due to a slip up, a bad .gitignore, or a plain-sight "Removing secrets" commit. The article notes that the majority of leaks it has seen were in repositories intended to be public, with credentials included by mistake.
Impact
The first repository exposed an Artifactory token for a JFrog-hosted repository and a GCloud legacy-credentials folder. The Google Cloud credentials had access to some of roughly 150 projects, including production and billing projects, and investigation after discovery showed SSH to externally reachable instances would have been possible. The second repository exposed a different type of Artifactory token that was also valid. The article does not state what an attacker could do with the Artifactory tokens beyond authenticating to the API.
Fix
Zendesk immediately revoked all tokens and had both repositories removed within around 12 hours, and acknowledged after doing so. Zendesk paid its maximum bounty ($3000) per repository due to the critical nature of the vulnerability, and clarified it had taken measures to prevent similar issues in the future. The two HackerOne reports are disclosed:
- #496414 - Leaked artifactory_key, artifactory_api_key, and gcloud refresh_token via GitHub
- #496925 - Leaked artifactory_api_key via GitHub
The article's own recommendation is continuous monitoring to identify such leaks as they occur, and for organisations to ask employees to be careful about what they make public.
Variants to test
- Search public GitHub for dotfile repositories belonging to a target's employees or contractors, looking for Artifactory tokens and GCloud legacy-credentials folders. A positive result is a token that authenticates against the Artifactory API or a gcloud configuration that lists the target's projects.
- Check both the HEAD of the default branch and historical commits, including commits labelled as removing secrets. A positive result is a credential still present in the current tree or recoverable from history.
- Try the different Artifactory token types (key versus API key) against the Artifactory API. A positive result is an authenticated response.
- For any GCloud credentials found, copy the configuration folder into
~/.config/gcloudand rungcloud projects list. A positive result is a list of the target's projects, andgcloud compute sshagainst externally reachable instances would confirm SSH reach. - Use public tooling such as michenriksen/gitrob to widen the search. A positive result is any valid credential or sensitive material in a public repository.
What happened, in plain words
A security company called Assetnote was testing a new feature of its product. The feature watches public websites where people share things, such as GitHub, PasteBin and Trello, and looks for sensitive information that was published by mistake. Assetnote's team comes from an information security background, and part of how they build their product is by studying how organisations end up exposing data or getting breached. One pattern they kept seeing: employees and contractors accidentally publishing credentials, source code and even raw customer personal data on third-party sites.
This article is about one such case, involving Zendesk. Two public GitHub repositories belonging to Zendesk staff contained files with working credentials inside them. One set of credentials gave access to an Artifactory repository (a place where software packages are stored, hosted with a company called JFrog). The other gave access to Zendesk's Google Cloud account, which is a service for running servers and other infrastructure in Google's data centres. The Google Cloud credentials could see some of around 150 projects, including production and billing projects.
The two HackerOne reports are disclosed. Zendesk revoked all the tokens and removed both repositories within around 12 hours, and paid its maximum bounty of $3000 per repository.
Before going further, a few words that come up constantly below.
- A credential is anything that proves who you are to a computer system, like a username and password, or a key.
- A token is a long random string that works like a temporary password. You paste it into a request and the server lets you in without asking for anything else.
- An API (Application Programming Interface) is a way for one program to talk to another over the internet. Think of it as a service counter at a shop: you hand over a request in a fixed format and get back an answer in a fixed format, instead of browsing a website with your eyes.
- GitHub is a website where people store and share code. A repository (or repo) is one project's folder of files, with a full history of every change ever made.
- A dotfile is a settings file whose name starts with a dot, such as
.gitconfig. Developers often keep their dotfiles in a public repository so they can copy them onto any new computer and have all their tools configured the same way. That is convenient, but it also means anything secret inside those files becomes public.
The setup
The article does not describe any accounts, roles or tool versions beyond the following. Assetnote launched its Third-Party Platform Exposure (TPPE) monitor for a beta test. On 15 February, the monitor detected two public repositories containing Zendesk employee dotfiles. The researcher worked from a local shell, a text window where you type commands, shown with the prompt ruby@nippon:~|⇒. The tools used were curl, a command-line program for making web requests, and the gcloud command-line tool, which talks to Google Cloud.
The article also announces that the TPPE module will be available for the Assetnote continuous security platform later that year, and that the findings discussed are some of the most critical from benchmarking against public bug bounty targets.
Finding it
Looking at the first repository, the TPPE monitor reported that two common formats of credentials were present: an Artifactory token for a repository hosted with JFrog, and a GCloud "legacy-credentials" folder. The team inspected them and determined that the credentials were valid, meaning they still worked.
In the second repository, the monitor highlighted similar looking Artifactory credentials, but with a different type of token.
Why does this matter? A public repository is visible to anyone on the internet, and its full history is visible too. If a working credential sits in one, anyone who finds it can use it exactly as the employee would. The monitor's job is to spot exposures with a high degree of confidence using pattern detection and human augmentation.
Exploitation
Step 1: Confirm the Artifactory token from the first repository
The team confirmed the Artifactory token by making a request to the hostname found in the repository's environment variables, using the username and token listed there:
export ARTIFACTORY_KEY="<REDACTED>"; # For HTTP repository accessexport ARTIFACTORY_USERNAME="<REDACTED>";curl u $ARTIFACTORY_USERNAME:$ARTIFACTORY_KEY https://<REDACTED>/artifactory/api/buildResponse:{ "uri": "http://<REDACTED>/artifactory/api/build"...
Line by line:
export ARTIFACTORY_KEY="<REDACTED>"stores the secret key in a shell variable calledARTIFACTORY_KEY, so it can be reused later without retyping it. The comment# For HTTP repository accessis a note left in the original file explaining what the key is for.export ARTIFACTORY_USERNAME="<REDACTED>"stores the matching username in another variable.curl u $ARTIFACTORY_USERNAME:$ARTIFACTORY_KEY https://<REDACTED>/artifactory/api/buildsends a web request to the Artifactory server's API build endpoint, presenting the username and key. The$signs tell the shell to substitute the values of the variables. Theuoption is howcurlis told to supply a username and password (here, the token acts as the password).- The response begins with
"uri": "http://<REDACTED>/artifactory/api/build", a field pointing back at the Artifactory API build path. Getting a normal answer like this, rather than an error saying the credentials are wrong, confirms the credentials are accepted.
The point of this step is simple: finding a string that looks like a token proves nothing. You have to try it against the real service and see whether the service says yes.
Step 2: Validate the Google Cloud legacy credentials
Making an authenticated request to the Google Cloud API with curl using the legacy credentials format is not particularly straightforward. Instead, the team found that simply using the gcloud configuration folder from the repository in their local shell let them use the gcloud command-line tool as if they were the user:
ruby@nippon:~|⇒ cp <REDACTED>/.config/gcoud ~/.config/gcloudruby@nippon:~|⇒ gcloud projects listPROJECT_ID NAME PROJECT_NUMBER...<REDACTED> Bime development <REDACTED><REDACTED> Bime preproduction <REDACTED><REDACTED> Bime production <REDACTED>…<REDACTED> Zendesk Authentication <REDACTED>…<REDACTED> Voice Production <REDACTED>…<REDACTED> Zendesk Billing <REDACTED>...
Line by line:
cp <REDACTED>/.config/gcoud ~/.config/gcloudcopies the configuration folder taken from the repository into the place on the researcher's own machine where thegcloudtool expects to find its settings. The~stands for the user's home folder. Once the settings are in place, the tool believes it is running as the person those settings belong to.gcloud projects listasks Google Cloud to list every project the credentials can see. A project in Google Cloud is a container for servers, storage and settings, roughly like a separate account or workspace.- The output is a table with three columns:
PROJECT_ID,NAMEandPROJECT_NUMBER. The rows shown include Bime development, Bime preproduction, Bime production, Zendesk Authentication, Voice Production and Zendesk Billing. The…marks show that rows were left out of the excerpt.
These are some of the roughly 150 projects the user's credentials had access to. The project names were slightly altered in the article, but are in essence what the projects were. Seeing production and billing projects in that list is what turns a leaked file into a serious problem: those are the systems that run the real service and handle money.
Step 3: Note the SSH reach
For readers unfamiliar with Google Cloud: it makes managing SSH access easy. SSH is the standard way to open a command line on a remote computer, normally protected by a key. Google Cloud removes the need to add every authorised user's SSH key to every machine by hand, and instead lets you connect to an instance with:
gcloud compute ssh <instance>
Here gcloud compute ssh asks Google Cloud to open an SSH session to the named machine, <instance>, using the credentials already configured. This was not tested when the bug was discovered, but investigation afterwards showed it would have been possible for externally reachable instances using that command. In other words, the leaked credentials did not just let someone read a list of projects; investigation afterwards showed SSH to externally reachable instances would have been possible.
Step 4: Confirm the second repository's Artifactory credentials
Using an updated proof of concept, the team proved that the credentials in the second repository, a different type of token, were valid too:
Line by line:
export ARTIFACTORY_USERNAME="<REDACTED>"stores the username from the second repository in a shell variable.export ARTIFACTORY_API_KEY="<REDACTED>"stores the API key, a different kind of Artifactory token, in another variable.curl -i -u $ARTIFACTORY_USERNAME:$ARTIFACTORY_API_KEY https://<REDACTED>/<REDACTED>/artifactory/api/{...sends a request to the Artifactory API path on the host, again supplying the username and key. The-ioption tellscurlto include the response headers, the extra information the server sends before the body, so the team could see the status and other details of the reply.
As with the first repository, the goal is to move from "this looks like a credential" to "the server accepted it".
Root cause
Both repositories were leaked accidentally. The article notes that in its experience the majority of leaks were in repositories intended to be public, with credentials included due to a slip up, a bad .gitignore, or a plain-sight "Removing secrets" commit.
A .gitignore is a file that tells git which files to leave out of the repository, for example local settings that should never be shared. If it is written wrongly, or the file was added before the rule existed, the secret goes in anyway. And a commit is a saved snapshot of the project. Deleting a secret in a new commit does not remove it from the older snapshots: anyone can browse the history and read it there. The article notes that the majority of leaks it has seen were in repositories intended to be public, with credentials included by mistake.
Impact
The first repository exposed an Artifactory token for a JFrog-hosted repository and a GCloud legacy-credentials folder. The Google Cloud credentials had access to some of roughly 150 projects, including production and billing projects, and investigation after discovery showed SSH to externally reachable instances would have been possible. The second repository exposed a different type of Artifactory token that was also valid. The article does not state what an attacker could do with the Artifactory tokens beyond authenticating to the API.
Fix
Zendesk immediately revoked all tokens and had both repositories removed within around 12 hours, and acknowledged after doing so. Revoking means the tokens stop working, so even someone who copied them earlier can no longer use them. Zendesk paid its maximum bounty of $3000 per repository because of the critical nature of the vulnerability, and clarified that it had taken measures to prevent similar issues in the future. The two HackerOne reports are disclosed:
- #496414 - Leaked artifactory_key, artifactory_api_key, and gcloud refresh_token via GitHub
- #496925 - Leaked artifactory_api_key via GitHub
The article's own recommendation is continuous monitoring to identify such leaks as they occur, and for organisations to ask employees to be careful about what they make public.
Variants to test
These are the ways the same idea can be tried against other targets:
- Search public GitHub for dotfile repositories belonging to a target's employees or contractors, looking for Artifactory tokens and GCloud legacy-credentials folders. A positive result is a token that authenticates against the Artifactory API, or a gcloud configuration that lists the target's projects.
- Check both the HEAD of the default branch and historical commits, including commits labelled as removing secrets. The HEAD is the latest version of the files; history is everything before it. A positive result is a credential still present in the current files or recoverable from history.
- Try the different Artifactory token types (key versus API key) against the Artifactory API. A positive result is an authenticated response.
- For any GCloud credentials found, copy the configuration folder into
~/.config/gcloudand rungcloud projects list. A positive result is a list of the target's projects, andgcloud compute sshagainst externally reachable instances would confirm SSH reach. - Use public tooling such as michenriksen/gitrob to widen the search. A positive result is any valid credential or sensitive material in a public repository.
Glossary
- API: a fixed way for one program to talk to another over the internet, like a service counter with set request and response formats.
- Artifactory: a product from JFrog used to store and serve software packages and build artefacts.
- Bounty: a reward a company pays to someone who reports a security problem to it.
- Bug bounty programme: a scheme where a company invites outsiders to report security problems and pays for valid ones.
- Commit: a saved snapshot of a project's files in git, kept in the project's history.
- Continuous security platform: a product that keeps watching for security problems over time rather than checking once.
- Credential: anything that proves identity to a system, such as a username and password or a key.
- curl: a command-line program for making web requests.
- Dotfile: a settings file whose name starts with a dot, often kept in a public repository for easy copying between machines.
- Environment variable: a named value stored in a shell session that programs and commands can read.
- gcloud: Google's command-line tool for managing Google Cloud resources.
- Git: the version control system that records the history of changes to files.
- GitHub: a website for hosting and sharing git repositories.
.gitignore: a file that tells git which files to leave out of a repository.- Google Cloud: Google's service for running servers, storage and other infrastructure.
- HackerOne: a platform where security researchers report vulnerabilities to companies.
- HEAD: the latest version of the files in a repository, as opposed to older commits in its history.
- Instance: a single virtual machine running in a cloud provider.
- JFrog: the company behind Artifactory.
- Legacy credentials: an older format of Google Cloud credential files, stored in a configuration folder.
- PII: personally identifiable information, data that identifies a real person.
- Project (Google Cloud): a container for a set of cloud resources, settings and permissions.
- Repository: a project's folder of files together with its full change history.
- Revoke: to cancel a credential so it no longer works.
- Shell: a text window where you type commands for the computer to run.
- SSH: the standard way to open a command line on a remote computer, usually protected by a key.
- Third-party platform: an outside website, such as GitHub, PasteBin or Trello, where people publish content.
- Token: a long random string that acts like a password in a request.
- TPPE (Third-Party Platform Exposure): Assetnote's monitor for sensitive data published by mistake on outside platforms.
- Vulnerability disclosure programme: a formal channel through which outsiders can report security problems to an organisation.