Skip to content
Leaked secrets Write-up Beginner

When env.js Breaks Bad: How a Single File Exposed Critical Secre

A publicly accessible JavaScript configuration file contained hardcoded production secrets, including OAuth client identifiers, internal monitoring URLs, and a third-party license key. An attacker could use these to craft phishing flows, map internal infrastructure, or abuse the license.

Anshubind Follow

Published on medium.com

Some bugs appear loud and obvious. Others hide in the most unassuming places — like a simple env.js file sitting quietly in a public asset directory.

Anshubind, 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, developers placed sensitive configuration values directly into a client-side JavaScript file that was served publicly, instead of keeping them on the server.

Impact

An attacker could misuse the exposed OAuth client to build phishing flows, map internal infrastructure, and abuse a third-party license key, though the text does not confirm any of these were actually exploited.

What the attacker needed

Publicly accessible env.js file; no authentication required

The fix

The organisation should rotate all exposed keys, block direct access to the file, move secrets server-side, audit access logs, and add secret scanning to their pipeline; the text does not state that a fix was completed.

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 front-end code is sent to every visitor's browser, so anything written there can be read by anyone. This report found a file that was supposed to hold settings but instead contained secret keys and internal addresses. Those secrets could let someone pretend to be the company's login system or learn how its internal network is built.

What is Leaked secrets?

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

More by Anshubind

View all

15 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.