Skip to content
Open redirect Write-up Intermediate

How I Bypassed an API Security Check

A hard-coded Branch Metrics API key was exposed in a public JavaScript configuration file, allowing anyone to create deep links. The key's domain restriction could be bypassed by wrapping the target URL in a Google redirect, enabling open redirects to arbitrary sites.

medium.com

Published on medium.com

As a bug bounty hunter, there’s nothing quite like the thrill of uncovering a hidden flaw in a live system. Recently, I stumbled across a juicy vulnerability in a HackerOne target—a hard-coded API key exposed in plain sight.

Shafayat Ahmed Alif, 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 API key was embedded in client-side JavaScript and the domain validation only checked the initial URL, not the final redirect destination.

Impact

An attacker could create legitimate-looking links that redirect to malicious sites for phishing, and could also abuse analytics or exhaust resources.

What the attacker needed

Access to the public JavaScript file; no authentication needed

How it was found

  1. Visit the target's gift card page and intercept the request.
  2. Notice a JavaScript file loaded from a subdomain and send it to Repeater.
  3. Observe a JSON configuration containing a Branch Metrics API key.
  4. Use cURL to call Branch's API with the key and a test URL.
  5. Try a restricted domain and receive a security error.
  6. Bypass by using a Google redirect URL that points to the restricted domain.

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 was using a secret key to create special links, but that key was left in a public file anyone could read. The key was supposed to only make links to approved websites, but the author found a trick to make it link anywhere by hiding the real destination inside a Google link.

What is Open redirect?

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.

Similar reports

View all

Same bug class and techniques, clearest first.

Open redirect

The lesson behind this report.

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.