Skip to content
Access control Write-up Beginner

How Reading a JavaScript Bundle Led Me to 29 Valid Coupon Codes in a Hidden API Endpoint

An unauthenticated API endpoint exposed 29 internal coupon codes, and a related coupon detail endpoint ignored the account ID in the path, allowing anyone to look up discount details. An attacker could retrieve and apply a 50% annual discount meant for partners or internal use.

ashiq.r.emon Follow

Published on medium.com

I wasn’t hunting for coupons. I was doing what I always do early in a recon session — pulling the JavaScript bundles, reading through the minified source manually, and building a list of API routes to probe.

Ashiqur Rahman Emon, 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 endpoints lacked authentication and the coupon detail endpoint failed to enforce that the account ID in the path matched the requester.

Impact

An unauthenticated attacker could list internal coupon codes, check their discount values, and apply a 50% annual discount they were not supposed to have access to.

What the attacker needed

No authentication required; manual reading of JavaScript bundle

How it was found

  1. Pull the JavaScript bundles and search for API route strings.
  2. Find the hidden coupon enumeration endpoint in a bundle chunk.
  3. Request the endpoint without authentication to get 29 coupon codes.
  4. Find the coupon detail endpoint in the same bundle.
  5. Request the detail endpoint with different account IDs and observe identical responses.

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.

The website's code that runs in your browser (the JavaScript bundle) contained a hidden web address for an API. Anyone could visit that address without logging in and get a list of secret discount codes. A second address let anyone check what each code was worth, and it did not check which user was asking.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by ashiq.r.emon

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.