CWE-841Spend & resource abuseSeverity · Medium

Coupons and credits that stack

Discounts that can be reused, combined or shared across accounts let buyers pay far less than intended. The loss grows quietly with every repeat.

At a glance

Controls
CWE-841 · A04:2021 Insecure Design
Typical severityMedium
ReferenceCWE-841
OWASP Top 10A04:2021 Insecure Design

What it is

A discount code or promotional credit has terms: one use, one account, no stacking. When those terms are checked only at the first step, later requests can apply the same code again. Codes can also be combined in ways the business never planned.

An attacker reapplies a code, swaps the order of steps, or redeems it from several accounts. AI-assisted tools can map a checkout flow and try every ordering of steps quickly, which exposes gaps in workflow checks.

Where it hides

What a reviewer can look for in the code and in the behaviour, before anyone proves it.

  • Apply-coupon and remove-coupon endpoints at checkout
  • Referral and sign-up credit flows
  • Promotional credits added by background jobs
  • Subscription upgrade and renewal paths that reuse earlier discounts

How MATT tests it

The proof runs against the deployed product, on every release, whoever wrote the code.

  1. 01Sign in with the test account and apply a single-use test code to an order.
  2. 02Apply the same code again, then add a second code, then reapply after removing it.
  3. 03Complete a test-mode checkout and compare the final discount with the code's terms.
The rule, in plain English

Each discount must apply only as many times as its terms allow.

Executable check

as test user: POST /v1/cart/coupons {"code": "ONCE10"} twice expect: second call returns 409 or 422 expect: discount on the order equals one use of the code as test user B: POST /v1/cart/coupons {"code": "ONCE10"} after A has used it expect: 409 or 422 when the code is single-use

Every rule MATT holds →

What the fix looks like

  1. 01

    Store each redemption on the server against the code, account and organisation.

  2. 02

    Check the code's terms again at final payment, beyond the moment it was entered.

  3. 03

    Define in one place which discounts can combine and enforce it on the server.

  4. 04

    Make redemption atomic so two parallel requests cannot both succeed.

A check that was never written is found by proving the deployed behaviour, fixed with the engineer who shipped it, and kept fixed by running the control on every change. What is ExploitOps? →

ExploitOps discovery call

Understand where your security loop breaks.

A call with a MATT co-founder to understand your product and whether an ExploitOps Review is worth doing. If there is a real need, we scope one with the research team.

Let’s understand your priority

What brings you to MATT?

What would you like help with?
01 / 02