Skip to content
Leaked secrets Write-up Beginner

P0 — Key to The Kingdom: How I Found a Gift Card Creation API Key on GitHub & What Happened Next

A third-party gift card service's API key was publicly exposed in a GitHub repository, allowing anyone to create unlimited gift cards without authentication. The researcher confirmed the key worked by generating a $10 gift card and redeeming it on the company's live website.

0581raghav Follow

Published on medium.com

Hackers usually scan a company’s main website, enumerate subdomains, or look for misconfigurations. But sometimes, the real vulnerability isn’t hiding on example.com — it’s buried somewhere else entirely.

Raghav Khandelwal, 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 a developer accidentally committed a live API key to a public GitHub repository, and the key had no restrictions such as IP allowlisting or rate limiting.

Impact

Anyone with the leaked key could generate unlimited gift cards and potentially drain significant revenue, as there were no authentication, domain verification, IP checks, or rate limits.

What the attacker needed

Public GitHub repository with key; knowledge of API key format; access to service API documentation

The fix

The exposed API key was rotated, the GitHub repository was deleted, and the integration was patched.

How it was found

  1. Learned the API key format from the service's SDK documentation.
  2. Searched GitHub for the key pattern and found a live key in a public repository.
  3. Used the key with the service's public API documentation to craft a request.
  4. Sent the request and received a $10 gift card.
  5. Redeemed the gift card on the company's live e-commerce website.

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.

An API key is like a password that lets software talk to another service. Here, a key for creating gift cards was left in a public code repository on GitHub, so anyone could find it and use it to make free gift cards. The researcher tested it and confirmed the gift cards could be used on the real website.

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.