Skip to content
Leaked secrets Write-up Beginner

“That One Time I Found a Golden Ticket in a Desktop App”

A live GitHub Personal Access Token was left inside a .env file packaged in an Electron desktop app's app.asar archive. An attacker who downloaded the app could extract the token and use it to gain push access to private repositories in a major tech company's GitHub organisation.

medium.com

Published on medium.com

Let’s be real. We’ve all seen those mind-blowing bug bounty write-ups on Twitter.

Aman Sharma, on medium.com

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.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the build pipeline packaged development-only files, including a .env file containing a live GitHub token, into the distributed app.asar archive.

Impact

The token granted push (write) access to private repositories in a major tech company's GitHub organisation, which could allow an attacker to inject malicious code into the codebase and carry out supply chain attacks.

What the attacker needed

Download the desktop app; no account needed

The fix

The app should be built with a pipeline that excludes development files such as .env and keeps secrets on the server side rather than in the client bundle.

How it was found

  1. Download and install the macOS version of the Electron app.
  2. Right-click the app in Applications, choose Show Package Contents, and open Contents/Resources.
  3. Install the asar command-line tool and extract app.asar into a folder.
  4. List the extracted files and open the .env file found at the root.
  5. Use curl to query the GitHub API and confirm the token is valid and which organisations the user belongs to.
  6. Query the organisation's repositories endpoint to check the token's permissions on private repos.

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 write-up has not been written yet. The Original tab links to the source.

Electron apps are desktop programs built with web technology, and they ship with their source code inside a file called app.asar. The developer accidentally included a .env file, which is meant only for local development, and that file held a secret password-like token for GitHub. Anyone who downloaded the app could unpack it and use that token to write code into the company's private repositories.

What is Leaked secrets?

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

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.