Skip to content
Leaked secrets Write-up Beginner

Hard-Coded Third-Party API Key Exposed in Frontend Environment Ob

A live third-party personal access token was hard-coded in a client-side JavaScript environment object served on all public ticket and checkout pages. Anyone loading those pages could read the token and use it to query the vendor's API, exposing internal localisation data, project metadata and an employee's name, username and MFA status.

Prajwol Acharya Follow

Published on medium.com

During testing of a ticketing platform, I discovered a live third-party Personal Access Token (PAT) hard-coded inside a client-side JavaScript environment object (window.ENVIRONMENT). The token was served on all public checkout/ticket pages and granted read-only access to the company's localization (i18n) service…

Prajwol Acharya, 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 a build-time environment variable holding a third-party API token was inlined into the client-side environment object instead of being kept server-side.

Impact

The read-only token let an attacker enumerate internal localisation keys and project metadata and identify an employee plus their MFA status, which could aid targeted phishing or account takeover against the third-party platform; the vendor said the placement was an intentional design decision with read-only scope.

What the attacker needed

No account needed; victim not required to act

The fix

The token should be revoked and rotated, removed from the frontend environment object, and the integration moved behind an authenticated backend so the secret is never sent to the client.

How it was found

  1. Open a public ticket or checkout page and fetch its HTML source.
  2. Search the page source for the environment object and extract the API key value.
  3. Call the vendor's API key endpoint with the token to confirm it is live and see the owner details.
  4. Call the vendor's user endpoint with the token to get the username and MFA status.

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.

Some websites put configuration values into the page itself so the browser can use them. Here one of those values was a secret password-like key for another company's service, and it was sent to every visitor. Because the key was valid, anyone who looked at the page source could use it to read data from that service.

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.