# Github access token exposure

A GitHub PAT with push/pull access to all Shopify repos was left in a .env file inside a public Electron app's app.asar bundle.

- Payout: $50,000
- Severity: critical
- Program: Shopify
- Found by: augustozanellato
- Disclosed: 2021-07-26
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/1087489
- Library page: https://bugbountylibrary.com/r/h1%3A1087489
- Tags: area:os domain:desktop impact:data-leak impact:integrity kind:bounty platform:hackerone sev:critical tech:electron technique:recon technique:source-review vuln:secrets-leak

**Target:** Electron desktop app distributed bundle (app.asar)
**Root cause:** Build process packaged a leftover .env containing GH_TOKEN into the app.asar shipped publicly; the app never loaded it, so it was an unnoticed build artifact.
**Steps:**
1. Download the public macOS Electron app
2. Extract bundle: `npx asar extract path/to/app.asar extracted/path`
3. Find `.env` containing `GH_TOKEN`; confirm app source never references it
4. Validate token: `curl -H "Authorization: token $GH_TOKEN" -H "Accept: application/vnd.github.v3+json" https://api.github.com/user`
5. Enumerate orgs: `GET /user/orgs` reveals Shopify
6. Confirm scope: `GET /orgs/Shopify/repos` returns private repos with `"push": true, "pull": true`
**How found:** Researcher was dissecting an employee's Electron app, extracted app.asar, noticed a .env file, initially skipped it, then observed via source review that the app never loaded it — flagging it as a leftover build artifact worth inspecting.
**Exploitation:** Token authenticated to GitHub REST API granting read/write to all Shopify org repos, enabling code push/backdooring. No unauthorized activity was performed; token was revoked after report.
**Insight:** Electron app.asar bundles are a high-yield secrets source: extract them and grep for .env, tokens, and config files that the app code never references — unreferenced files are often build leftovers still shipped to users.

## Proof of concept (copied exactly from the original report)

**Extract app.asar to find .env token**

```
npx asar extract path/to/app.asar extracted/path
```

**curl authenticate with leaked GH_TOKEN**

```
curl -H "Authorization: token $GH_TOKEN" -H "Accept: application/vnd.github.v3+json" https://api.github.com/user
```

