Skip to content
Leaked secrets Write-up Intermediate

I Asked the Frontend for Secrets, and It Said Yes

The frontend JavaScript bundle exposed an API key plus the AES key and IV used to encrypt and decrypt API responses. An attacker could call an unauthenticated token endpoint, decrypt the response locally, and obtain a bearer token with admin scopes.

osintteam.blog

Published on osintteam.blog

While testing a web application, I found that the frontend JavaScript bundle contained enough information to call an unauthenticated token-generation API and decrypt the encrypted response locally.

Devansh Patel, on osintteam.blog

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 secrets needed for server-side trust and encryption were embedded in client-side JavaScript, so anyone could read them.

Impact

An attacker could obtain a valid bearer token with admin read and write scopes and use it against backend APIs, though the tester only confirmed access to a harmless lookup endpoint.

What the attacker needed

Access to the public frontend bundle; no account needed

How it was found

  1. Inspect the minified JavaScript bundle and find the API key, AES key, IV and token endpoint.
  2. Send a POST request to the token endpoint with only the exposed API key.
  3. Save the encrypted payload from the response.
  4. Decrypt the payload locally using the exposed AES key and IV.
  5. Extract the JWT access token and inspect its scopes.
  6. Use the token on a harmless lookup endpoint to confirm it is accepted.

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.

A website's frontend code is sent to every visitor's browser, so anything inside it is public. Here the code contained not only a password-like API key but also the secret used to scramble the server's replies. That let anyone ask the server for a login token and unscramble the answer to read it.

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.