Skip to content
cloudgrip

$ man business-logic-vulnerability

//Attacks and vulnerabilities

What is a business logic vulnerability?

A business logic vulnerability exists when an application fails to uphold one of its own rules, even though every individual request looks valid. The attacker uses normal features in an order or with values the designers did not expect, such as reusing a discount or skipping a required step.

  • Attacks and vulnerabilities
  • 3 min read
  • updated Nov 11, 2026

How it works

A business logic vulnerability exists when the code allows something the business never intended. No malformed input is involved. Every request is valid on its own, and the damage comes from the combination, the order or the values.

Developers build features around the expected path: add to basket, apply one coupon, pay, receive goods. Logic flaws live in the paths nobody wrote down. Applying the coupon five times, paying after changing the basket, or confirming an order that was never paid are all examples. The server accepts each step because nothing told it to refuse.

The common patterns are:

  • Skipped steps. A multi-stage flow where the last step works without the earlier ones.
  • Trusted client values. A price, a discount or a user role sent by the browser and believed by the server.
  • Missing limits. Negative quantities, huge numbers, or a free trial that can be started again and again.
  • Reuse. A voucher, referral bonus or one-time link that works more than once.
  • Timing. Two requests sent at the same moment both pass a check that should allow only one. This overlaps with race conditions.

What it looks like

A shop offers a welcome coupon worth 10 percent. The endpoint that applies it never records that the code is already on the basket.

output
POST /api/baskets/bsk_41/coupons HTTP/1.1
Host: shop.acme.test
Cookie: session=<user_a session>
Content-Type: application/json

{"code": "WELCOME10"}
output
HTTP/1.1 200 OK
Content-Type: application/json

{"basket": "bsk_41", "discount_percent": 10, "total_cents": 9000}

Sending the identical request four more times returns discount_percent: 50. Each response is a normal 200 OK. The shop loses half the order value.

The fix is to state the rule in code and compute the result on the server:

output
def apply_coupon(basket, code):
    coupon = Coupon.get_valid(code)
    if coupon.id in basket.coupon_ids:
        raise Conflict("coupon already applied")
    if basket.coupon_ids and not coupon.stackable:
        raise Conflict("coupons cannot be combined")
    basket.coupon_ids.append(coupon.id)
    basket.recalculate_total()  # the total is always derived on the server

Why scanners miss it

A scanner looks for known signatures: an error message that reveals SQL injection, a script tag that comes back unescaped. A logic flaw has no signature. To know that a 50 percent discount is wrong, a tester has to understand what the shop intended. That is one of the main differences covered in vulnerability scanning vs penetration testing.

How to test for it

Testing starts with understanding the product, then deliberately breaking its assumptions.

  1. Map each workflow. Write down the steps, the state after each step and the rule each step is meant to enforce.
  2. Change the order. Call the final step first. Go back a step after moving forward. Repeat a step.
  3. Change the values. Try zero, negative and very large numbers, and edit any price or total the client sends.
  4. Reuse one-time things. Codes, tokens, invitations and links.
  5. Send requests in parallel. Check whether a limit holds when two requests arrive together.
  6. Mix accounts. Start a flow as one user and finish it as another.

Any outcome the business would not accept is a finding, even though the server reported success.

How to fix it

Logic flaws are fixed by making rules explicit and enforcing them on the server.

  • Model state. Give orders, bookings and payments a defined set of states, and refuse every move between states that is not on the list. "Ship" should fail unless the order is in the "paid" state.
  • Recalculate on the server. Prices, totals, discounts and permissions are derived from stored data, never accepted from the request.
  • Validate ranges. Quantities are positive whole numbers with a sensible maximum.
  • Make one-time actions atomic. Mark a voucher as used in the same database transaction that grants its benefit.
  • Write abuse cases. For each feature, add tests for what a dishonest user would try, alongside the tests for honest use.
  • Watch for it. Alerts on unusual discounts, refunds and credit grants catch what the tests missed.

Design review helps most. Many logic flaws are visible on a whiteboard before any code exists, and a later penetration test confirms whether the rules hold in the running system.

See what an attacker would find.

Give us a URL and two test logins. If there’s something to find, your first exploited findings land within 24 hours.

You talk to the people who build Hydra and Cerberus. No sales script.

or write to founders@cloudgrip.ai