Skip to content
Leaked secrets Write-up Beginner

Exposed Client Secret in JavaScript Resulted in Quick Bug Bounty

A hardcoded OAuth client secret was embedded in a public JavaScript bundle and used in a client-credentials token request. Anyone who loaded the site could extract the secret and generate valid access tokens to impersonate the client application.

Medusa Follow

Published on infosecwriteups.com

Friend link: https://infosecwriteups.com/exposed-client-secret-in-javascript-resulted-in-quick-bug-bounty-35a609be138d?sk=879a02f5277d7fecc32c591daa424ebe

Medusa, on infosecwriteups.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 application placed a sensitive OAuth client secret in client-side JavaScript and used it in a client-credentials flow, instead of keeping it on a trusted backend.

Impact

Anyone with access to the JavaScript file could generate valid access tokens and impersonate the client application to access protected APIs; the report was rated low severity.

What the attacker needed

Access to the public site; ability to read JavaScript files

How it was found

  1. Open the public beta site and inspect the JavaScript files loaded by the page.
  2. Search the JavaScript bundle for keywords such as secret, token, or client.
  3. Find the hardcoded clientSecret value in the frontend code.
  4. Read the surrounding code to see the secret used in a POST request for an access token.
  5. Confirm that the request uses the client credentials grant and returns a token.

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 client secret is like a password that an application uses to prove its identity to an authentication server. Here it was placed in code that every visitor's browser downloads, so anyone could read it. With that password, a person could ask the server for access tokens as if they were the application.

What is Leaked secrets?

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

More by Medusa

View all

10 more disclosed reports, best first.

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.