Skip to content
Leaked secrets Disclosed report Intermediate

Leaking sensitive information on Github lead full access to all Grab Slack channels

A public GitHub repository contained an Electron app whose packaged source included Slack and Google API access tokens. An attacker could use the Slack user token to read internal channels and files, and the Google token to access related services.

xsam Follow

Originally disclosed on HackerOne

Critical View original
  • Triaged in under an hour
  • Fixed in 6 hours
  • Paid in 3 days
  • Disclosed after 21 days

Summary by the program

The researcher @xsam reported leakage of two access tokens, one belonging to Slack and the other belonging to Google API’s. Researcher identified a public github repository with no source code but an electron package app in releases, interestingly he went on to downloaded the package and reverse engineer the electron app which lead him to identify the access tokens.

Within few minutes of receiving the report, the bug report was triaged and validated, access tokens were revoked and public repository was removed. Any valid HackerOne bug report submission triggers an internal incident investigation. In this case, a thorough investigation was conducted to identify any prior abuse and overall impact. Investigation concluded that these tokens weren't abused in the past.

We appreciate @xsam's contribution to our bug bounty program, @xsam displayed creative thinking and submitted detailed report which allowed us to quickly reproduce and validate the submission. We look forward to see more of his creative bug reports to our program.

The report

#Summary:

Accidental leakage of secret keys in such code repositories is a real problem, after my report #387117, I decided to dig deeper than the previous report and looking to some random profiles in Github, and doing some dirty work I was able to access to the developer’s company’s internal chats and files on Slack. And not only that, there’s no easy way to see if someone is eavesdropping on the communication. In the worst case scenario, these chats can leak production database credentials, source code, files with passwords and highly sensitive information.

#Description:

████ is QA Automation Engineer at Grab according to his LinkedIn profile, after doing some manual search in Github. I found his Github profile which contains weird repo

https://github.com/████/

I was about to close that tab since there is no useful file but wait second, did you notice 30 releases?

Multiple versions for multiple OS systems, I decided to download the zip file, after the unzipping I started ███ which is an Electron application.

I thought it was a dead-end but I noticed the bar so I clicked Environment then Toggle Developer tools in order to know the origin of that app go to Source as attached in the screenshot below

Capture_d_e_cran_2018-08-21_a__05.19.51.png
Capture_d_e_cran_2018-08-21_a__05.19.51.png From the original on HackerOne

Know it is the time for some thinking outside of the box and be creative. As I don't have much experience with Electron apps so after some googling I found that it is possible to reverse-engineer an existing Electron app by following those steps :

  • Open terminal and install asar node module globally by typing npm install -g asar

  • Go to ████ file directory, in my case cd /Users/mac/Downloads/██████/Contents/Resources

  • Create a directory to paste the content of app for example mkdir ███████-sourcecode

  • Unpack the app.asar file in the above directory using asar asar extract app.asar example-sourcecode

Now we have all available endpoints in the app or let say in gamma.grab.com as well if you go to build/constants/google/ you will get client_secret.json

{
    "installed": {
        "client_id": "█████",
        "project_id": "███████",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://accounts.google.com/o/oauth2/token",
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "client_secret": "█████████",
        "redirect_uris": ["urn:ietf:wg:oauth:2.0:oob", "http://localhost"]
    }
}

and google_token.json

{"access_token":"██████████","refresh_token":"████","token_type":"Bearer","expiry_date":█████████}

But the most usefull and impactfull files are on build/environement:

  • production-ph.env.json
  • production.env.json
  • staging.env.json

to verify if those token work let take for example

"slack": {
    "channel": "█████",
    "schedule_channel": "███████",
    "token":
      "xoxp-██████",
    "user": "█████ ██████████"
  }

Before doing we need to know what kind of token is on our hand since Slack have multiple kinds of token

Capture_d_e_cran_2018-08-21_a__05.49.51.png
Capture_d_e_cran_2018-08-21_a__05.49.51.png From the original on HackerOne
Capture_d_e_cran_2018-08-21_a__05.51.29.png
Capture_d_e_cran_2018-08-21_a__05.51.29.png

So we have User tokens The xoxp-token (prefix xoxp) can be generated from the OAuth Test Token-page. This token is exactly like having the complete username and password for the user. Even for a user with two-factor authentication enabled, you can still access Slack with nothing else but this token. And it is time to test if that token work or not? in order to that we need to follow the API documentation provided by slack here https://api.slack.com/web and try a non-sensitive method since I don't have the permission to read your internal data

Capture_d_e_cran_2018-08-21_a__05.55.10.png
Capture_d_e_cran_2018-08-21_a__05.55.10.png From the original on HackerOne

The best example will be to list the name of all channels

Capture_d_e_cran_2018-08-21_a__05.57.41.png
Capture_d_e_cran_2018-08-21_a__05.57.41.png From the original on HackerOne

So I set GET request in Burp with adding Authorization: Bearer xoxp-████as header and the result

The result is 100 channels including but not limited to :

  • ██████
  • ████
  • ███████

*█████

#How to protect? (Important)

  • Avoid git add: commands: Using wildcards can easily capture local files not truly intended to be shared, Instead of wildcards, name each file you commit, or use git add -p to review each change you add.

  • Name sensitive files in .gitignore & .npmignore: git support a local file listing exclusions from packaging and commits, which you can use as a safety measure against the accidental inclusion of sensitive files, and you can use GitHub’s sample .gitignore files for other inspiration.

  • git-secrets: git hook prevents committing in credentials: a useful tool called git-secrets. The tool hooks onto git commit and breaks the commit if it includes patterns that appear to be credential. This is a good content-focused safety net, complementing the previously suggested filename based protection.

  • Encrypt or use environment vars when publishing from CI.

  • Invalidate leaked credentials.

#Reference:

Impact

As I mentioned in the summary it possible to access to the developer’s company’s internal chats and files on Slack. And not only that, there’s no easy way to see if someone is eavesdropping on the communication and there are more worst scenarios.

The original report as published on HackerOne, by xsam. 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 Electron app's packaged source (app.asar) included environment files and credential JSON files that contained live Slack and Google tokens.

Impact

The Slack user token could allow reading internal channels and files, and the Google token could allow access to related Google services; the report notes there is no easy way to detect eavesdropping.

What the attacker needed

Public GitHub repository with releases; ability to download and unpack the app; no authentication needed to use the leaked tokens

The fix

The tokens were revoked and the public repository was removed.

How it was found

  1. Find a public GitHub repository with releases but no source code.
  2. Download the release zip and unzip it.
  3. Open the Electron app and enable developer tools to inspect its source.
  4. Use the asar tool to extract the app.asar file and view its contents.
  5. Locate environment and credential files containing Slack and Google tokens.
  6. Send a request to the Slack API with the token to list channels.

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.

A developer published an app on GitHub, and the app's packaged files accidentally included secret passwords (tokens) for Slack and Google. Anyone who downloaded the app could unpack it and find those tokens, then use them to read the company's private Slack messages.

What is Leaked secrets?

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

More by xsam

View all

3 more disclosed reports, best first.

More from Grab

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.