Breaking Business Logic via Coupons — The Story of my 1st Valid Bug Bounty
A one-time-use coupon could be reused across multiple browser tabs to obtain discounts on multiple orders. An attacker could use the same coupon repeatedly, causing financial loss to the company.
Published on medium.com
Information Security
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.
Context
The target is a private program site, referred to throughout the report as REDACTED. The feature in question is the coupon endpoint: coupons issued to new users are meant to be one time use only. When you sign up, the site sends a mail containing a coupon intended to encourage customers to buy, and that coupon is supposed to expire within a few hours.
The researcher's interest was business logic rather than a technical memory-safety or injection class of bug, and the report frames the finding as breaking business logic through the coupon flow.
Setup
The requirements stated in the proof of concept are a new account and a one-time-use-only coupon issued to that new user. No tools, versions or special configuration are described. The only account role involved is a normal customer account on the private program site.
The researcher had been hunting on public programs such as Facebook and Google since 2017 without a valid result, with reports coming back as Not applicable, Informative or Duplicate, and had decided to move to private programs not listed on bug bounty platforms and to focus on logical flaws.
Finding it
The researcher signed up, received the coupon by mail and initially ignored it. Two weeks later, wanting to shop on the site, they applied the coupon and it still worked, even though the mail said it would expire in a few hours. That discrepancy prompted deeper testing, and about ten minutes later the researcher realised the coupon could be used as many times as they wanted. In the researcher's words, this allowed them to trick the REDACTED payment system, which may lead to financial loss for the company.
Exploitation
The proof of concept assumes the coupon code is REDCOP300. The steps are reproduced as the report gives them.
Step 1: log in
- Login to REDACTED account
Step 2: copy the coupon
- Copy your Coupon code
Let's assume the coupon code is >> REDCOP300
Step 3: open each item in its own tab
- I opened every item I want to Buy on separate Tabs
Step 4: apply the coupon in every tab before ordering
- Apply the Codes on each tab before I placed Order in Each Tabs
This will reduce the Price for each item on each tab.
Step 5: check out one order through PayPal
- In one of my order, I hit check out, chose PayPal as Checkout option and Paid on PayPal's site for the order.
At this point the researcher knew they could place orders for the other items sitting in the other tabs, each with the same discount already applied, because PayPal checkout happens outside REDACTED and the REDACTED site can no longer control the price.
The triage exchange
The team's staff replied that the researcher had tried it on only one item and had not fully demonstrated whether orders could be placed on the other tabs with the same coupon, so they were not sure the payment would go through. The researcher replied that placing the order again would cost them some money, accepted the challenge, repeated steps 1 to 5 and made payment for many items in the other tabs using the one-time-use coupon.
Root cause
The report does not describe the server-side implementation. What it shows is that the one-time-use property of the coupon was not enforced across separate baskets or checkout sessions: the same code was accepted and applied as a discount in several tabs at once, and each discounted order could then be completed. The expiry stated in the signup mail was also not honoured, since the coupon still worked two weeks later. Why the existing checks failed is not stated.
Impact
The researcher's example of the discount exposure is:
| Item value | Discount |
|---|---|
| $2,000 | -$100 |
| $3,000 | -$300 |
| $5,000 | -$500 |
With one coupon, the researcher says, they could rule them all. The report hedges the business consequence as a possible financial loss for the company, and the demonstrated effect is that a single one-time-use coupon can discount multiple separate orders placed by the same account.
Fix
The report does not say what the company changed. It only records that the security team looked into it, thanked the researcher and paid a bounty.
Variants to test
- Apply the same coupon in several tabs or baskets and complete each checkout. A positive result is more than one paid order carrying the discount from a single code.
- Reuse a coupon well past its stated expiry. A positive result is the discount still being applied after the advertised window.
- Complete payment on an external processor such as PayPal after applying the discount, then return and finish the other prepared orders. A positive result is the external checkout not revalidating the coupon against prior redemptions.
Timeline
| Date | Event |
|---|---|
| Feb 9, 2020 | Report sent |
| Feb 10, 2020 | Team staff respond, doubting the bug is valid; researcher builds a new proof of concept showing the full exploit |
| Mar 28, 2020 | After weeks and months of delayed communication, the researcher gives up on the report |
| Apr 26, 2020 | Team staff respond that the bug is valid, with the bounty reward following in June 2020 |
Takeaways
The researcher draws three lessons. Premium sections of a site are likely to contain bugs, because free sections are often more secure or already fixed while researchers rarely go into the paid areas. Patience matters, both while waiting for a first valid finding and while a reported bug moves through triage and fixing. And it is always worth checking how an endpoint reacts across separate tabs: perform action A in one tab, then action B in another, and see whether A is reflected, whether B stops A, or whether both go through.
What happened, in plain words
A security researcher found a shopping site where a discount coupon that was supposed to work only once could be used again and again. The coupon was meant for new customers, was supposed to expire a few hours after signup, and was meant to be one time use only. In practice it still worked two weeks later, and it could be applied to several different items at the same time, each in its own browser tab, and every one of those discounted orders could be paid for. The researcher reported it, the company first doubted it, the researcher proved it again by actually paying for several discounted orders, and months later the company confirmed the bug and paid a bounty.
This article retells that story for someone who has never done security testing. Every technical idea is explained from scratch, and the steps are the same steps the researcher took.
Some words you will need first
Before the story makes sense, a handful of everyday ideas need names.
- A website is a program running on someone else's computer (the server) that your browser talks to. Your browser asks for a page, the server sends it back.
- An endpoint is one specific address inside a website that does one specific job. Think of a large office building: the building is the website, and each counter inside it (payments, coupons, your profile) is an endpoint. You reach a counter by sending a request to its address.
- A request is the message your browser sends to the server: "give me this page", or "apply this coupon", or "place this order". A response is the server's reply.
- A cookie is a small piece of text that a website stores in your browser so it can recognise you on the next request. It is like the wristband you get at an event: you show it at every door and staff know you already checked in. A session is the period during which that wristband is valid, in other words your logged-in visit.
- An account is your personal record on the site: your email, your orders, your coupons.
- A coupon (or discount code) is a short code you type at checkout to pay less. A one-time-use coupon is one the site promises to accept only once.
- Business logic is the set of rules a site is supposed to follow: a coupon works once, an order is paid before it ships, a refund cannot exceed what was paid. A business logic flaw is when the site technically works but breaks one of those rules. Nothing crashes and no alarm goes off; the site simply lets you do something it promised not to allow. It is like a shop assistant who honours the same voucher five times because the till never checks whether it was already used.
- Checkout is the final step of a purchase, where you confirm the order and pay.
- PayPal is an external payment service. When you choose it at checkout, you leave the shop's site, pay on PayPal's site, and come back. The shop never sees your card details.
- A tab is one page view inside your browser window. You can have several tabs open at once, each showing a different page of the same site.
- A proof of concept (PoC) is a set of exact steps that demonstrates a bug really exists, so that someone else can repeat it.
- Triage is the first stage after you report a bug: the company's staff read the report, try to reproduce it, and decide whether it is real, a duplicate of something already known, or not a bug at all.
- A bounty is money a company pays you for reporting a security problem responsibly.
- A private program is a bug bounty arrangement that is not publicly listed. Only invited researchers know about it, so fewer people are testing it.
How the researcher got here
The researcher heard about bug bounty in 2015, interviewed a friend about it, and became interested in information security in 2017. They learned on public programs such as Facebook and Google, but did so inconsistently, because it was a hobby alongside a main job as an SEO consultant, digital marketer and infopreneur.
Their reports kept coming back as "Not applicable", "Informative" or "Duplicate". In plain terms: the company said the issue did not apply, or was only informational and not a security problem, or someone else had already reported it. Each reply was followed by a long break.
A friend codenamed F007573P helped with questions about hunting bugs in web applications. The researcher then decided to build knowledge before returning to difficult public programs, and took a different approach: private programs not listed on bug bounty platforms, and a focus on logical flaws, which they describe as their favourite area at the time. The plan was to keep looking at breaking business logic until skilled enough for higher-severity technical bugs.
The target and the feature
The site belongs to a private program and is called REDACTED throughout the report. The feature involved is the endpoint that handles coupons. Coupons issued to new users are meant to be one time use only. When you sign up, the site sends a mail containing a coupon meant to encourage customers to buy, and that coupon is supposed to expire within a few hours.
The researcher's interest was business logic rather than a technical memory-safety or injection class of bug, and the report frames the finding as breaking business logic through the coupon flow.
What you need to try it
The proof of concept states two requirements: a new account, and a one-time-use-only coupon issued to that new user. No tools, versions or special configuration are described. The only account role involved is a normal customer account on the private program site.
Finding it
The researcher signed up, received the coupon by mail and initially ignored it. Two weeks later, wanting to shop on the site, they applied the coupon and it still worked, even though the mail said it would expire in a few hours. That discrepancy is the whole starting point: the site's own promise and the site's actual behaviour did not match. That prompted deeper testing, and about ten minutes later the researcher realised the coupon could be used as many times as they wanted. In the researcher's words, this allowed them to trick the REDACTED payment system, which may lead to financial loss for the company.
Exploitation
The proof of concept assumes the coupon code is REDCOP300. The steps are reproduced as the report gives them, with an explanation of why each one matters.
Step 1: log in
1. Login to REDACTED account
You need to be logged in so the site knows which account is shopping and which coupon belongs to it. Without a session, the site has no idea who you are and the coupon has no owner.
Step 2: copy the coupon
2. Copy your Coupon code
Let's assume the coupon code is >> REDCOP300
This is the code you received by mail at signup. Copying it means you can paste it into several places without retyping. REDCOP300 is only a stand-in used in the write-up; the real code is not published.
Step 3: open each item in its own tab
3. I opened every item I want to Buy on separate Tabs
Each tab is a separate page of the same shop, holding its own basket. Opening several tabs is the trick that makes the rest possible: the same coupon could be applied in each tab before any order was placed. This is the same as walking into a shop five times through five different doors, each time with the same voucher.
Step 4: apply the coupon in every tab before ordering
4. Apply the Codes on each tab before I placed Order in Each Tabs
This will reduce the Price for each item on each tab.
The important word is before. The coupon is applied to each basket while the order is still unconfirmed. At this stage the site calculates a new price for each basket. Doing this in every tab means every basket now shows a discounted total.
Step 5: check out one order through PayPal
5. In one of my order, I hit check out, chose PayPal as Checkout option and Paid on PayPal's site for the order.
Here the researcher picks one of the prepared baskets, goes to checkout, chooses PayPal and pays on PayPal's site. The key detail is that payment happens outside REDACTED. Once you are on PayPal, the shop can no longer control the price. When you come back, that order is paid.
At this point the researcher knew they could place orders for the other items sitting in the other tabs, each with the same discount already applied, because PayPal checkout happens outside REDACTED and the REDACTED site can no longer control the price.
The exchange with the company
The team's staff replied that the researcher had tried it on only one item and had not fully demonstrated whether orders could be placed on the other tabs with the same coupon, so they were not sure the payment would go through. In other words, they accepted that a discount appeared, but not that real money could actually be taken at that discounted price more than once.
The researcher replied that placing the order again would cost them some money, accepted the challenge, repeated steps 1 to 5 and made payment for many items in the other tabs using the one-time-use coupon. This is the difference between saying "the page shows a lower price" and showing "I paid less, several times, with one code".
Why it worked
The report does not describe the server-side implementation. What it shows is that the one-time-use property of the coupon was not enforced across separate baskets or checkout sessions: the same code was accepted and applied as a discount in several tabs at once, and each discounted order could then be completed. The expiry stated in the signup mail was also not honoured, since the coupon still worked two weeks later. Why the existing checks failed is not stated.
In everyday terms: the shop checked the voucher when you showed it at the shelf, but never crossed it off at the till.
Impact
The researcher's example of the discount exposure is:
| Item value | Discount |
|---|---|
| $2,000 | -$100 |
| $3,000 | -$300 |
| $5,000 | -$500 |
With one coupon, the researcher says, they could rule them all. The report hedges the business consequence as a possible financial loss for the company, and the demonstrated effect is that a single one-time-use coupon can discount multiple separate orders placed by the same account.
Fix
The report does not say what the company changed. It only records that the security team looked into it, thanked the researcher and paid a bounty.
Variants to test
These are the same idea applied in slightly different ways. Each one is a question you can ask of a shop you are allowed to test.
- Apply the same coupon in several tabs or baskets and complete each checkout. A positive result is more than one paid order carrying the discount from a single code.
- Reuse a coupon well past its stated expiry. A positive result is the discount still being applied after the advertised window.
- Complete payment on an external processor such as PayPal after applying the discount, then return and finish the other prepared orders. A positive result is the external checkout not revalidating the coupon against prior redemptions.
Timeline
| Date | Event |
|---|---|
| Feb 9, 2020 | Report sent |
| Feb 10, 2020 | Team staff respond, doubting the bug is valid; researcher builds a new proof of concept showing the full exploit |
| Mar 28, 2020 | After weeks and months of delayed communication, the researcher gives up on the report |
| Apr 26, 2020 | Team staff respond that the bug is valid, with the bounty reward following in June 2020 |
Takeaways
The researcher draws three lessons.
- Premium sections of a site are likely to contain bugs. Free sections are often more secure or already fixed, because many people look at them. Researchers rarely go into the paid areas, so problems there survive longer.
- Patience matters. It matters while waiting for a first valid finding, and it matters while a reported bug moves through triage and fixing. Companies have their own processes, and those processes are often slow.
- Check how an endpoint reacts across separate tabs. Perform action A in one tab, then action B in another, and see whether A is reflected, whether B stops A, or whether both go through. If both go through when only one should, you may have found a logic flaw.
Glossary
- Account: your personal record on a website, holding your identity, orders and coupons.
- Bounty: money a company pays a researcher for reporting a security problem responsibly.
- Business logic: the rules a site is supposed to follow, such as a coupon working once.
- Business logic flaw: a bug where the site technically works but breaks one of its own rules, without crashing or raising an alarm.
- Checkout: the final step of a purchase where you confirm the order and pay.
- Cookie: a small piece of text stored in your browser so a site can recognise you on later requests.
- Coupon: a short code typed at checkout to pay less.
- Duplicate: a report of a bug that someone else already reported.
- Endpoint: one specific address inside a website that performs one specific job.
- Expiry: the date or time after which something, such as a coupon, is no longer supposed to work.
- Informative: a report a company judges to be true but not a security problem worth acting on.
- Not applicable: a report a company judges not to apply to its program.
- One-time-use coupon: a coupon the site promises to accept only once.
- PayPal: an external payment service used at checkout, outside the shop's own site.
- Private program: a bug bounty arrangement that is not publicly listed, known only to invited researchers.
- Proof of concept (PoC): exact steps that demonstrate a bug really exists and can be repeated.
- Request: the message your browser sends to a server, asking for a page or an action.
- Response: the server's reply to a request.
- Session: the period during which a site recognises you as logged in.
- Tab: one page view inside a browser window; several can be open at once.
- Triage: the first stage after a report, where staff reproduce the bug and decide whether it is real.