Business logic flaws
Stage 3 · Lesson 10 · 20 minutes · Requires Stage 2
The one-line answer
A business logic flaw is when the application's rules can be bent — skip a step, order a negative quantity, apply a coupon twice — because the developers assumed users would only follow the intended path.
The boundary: logic flaws often involve money, orders and real accounts. Placing a manipulated order on a real shop is fraud, not testing. Labs only.
Why you should care
Scanners are good at finding technical bugs like SQLi. They are bad at logic flaws, because a scanner doesn't know that a price should never be negative or that step 3 must come after step 2. Humans who understand how the business works find these — which makes them valuable in bug bounty and a strong skill to show employers.
Recall Stage 0 Lesson 8: "never trust the client." Logic flaws are what happens when the server quietly trusts that the client will behave.
How it actually works
Intended flow vs actual flow
Developers design a path:
add to cart → enter address → choose payment → pay → confirmand often only test that path. But with Burp (Stage 2), you can send any request, in any order, with any values. Logic flaws live in the gap between what the developer expected and what the server actually enforces.
Common patterns
1. Trusting client-supplied values
POST /cart HTTP/2
productId=4&quantity=1&price=79999If the server uses the price the client sent instead of looking it up, changing it to 1 changes what you pay. Recall Stage 2 Lesson 1: hidden fields are just fields you can't see.
2. Unexpected numbers
- Negative quantities: add one expensive item and
-1of another, and the total can drop or go negative. - Huge numbers: quantities big enough to overflow a total and wrap around.
- Zero or decimals where the app expects whole positive numbers.
3. Skipping steps
A checkout or signup has several steps. What if you send the request for step 4 without doing step 3? If the server doesn't track and check state, you might confirm an order that was never paid, or complete registration without verifying your email.
4. Repeating steps
- Applying the same coupon or referral reward again and again.
- Alternating two coupons if the app only blocks "the same coupon twice in a row".
- Submitting a one-time action twice at almost the same moment (race conditions) before the server records the first one.
5. Inconsistent rules between features
The web checkout validates the discount, but the mobile API (Stage 4) doesn't. The "upgrade plan" page checks payment, but the "change plan" API doesn't.
How to look for them (on authorised targets)
- Understand the business first. What is the app for? What should never be possible (free items, other people's rewards, unverified accounts)?
- Map the flows (Stage 2 Lesson 3): which requests, in which order, carrying which values.
- Question every assumption in Repeater, one change at a time (Stage 2 Lesson 2):
- What if this number is negative, zero, enormous?
- What if I skip this request? Repeat it? Send them out of order?
- What if I send this value the UI never offers?
- Write down what the server should have rejected — that sentence becomes your finding.
See it yourself
Only on PortSwigger labs:
- Read the Business logic vulnerabilities topic introduction (link below).
- Do the apprentice lab excessive trust in client-side controls — find the price in the add-to-cart request.
- Do the apprentice lab high-level logic vulnerability — think about quantities.
- Do one more apprentice logic lab of your choice.
- For each, write one sentence: the developer assumed ___, but the server never checked ___.
How attackers abuse this
Logic flaws are directly profitable: free or cheap goods, unlimited rewards or credits, skipped payments, unverified or upgraded accounts. Attackers automate them once found — a coupon bug can be used thousands of times in a day. Because each request looks valid, these attacks often bypass security tools that look for "malicious" input.
The defensive fix:
- Never trust client-supplied values for anything important. Prices, discounts, totals, roles, account IDs: look them up or calculate them on the server.
- Validate ranges and types on the server. Quantities must be positive integers within a sensible limit; totals must be recalculated.
- Enforce the flow on the server. Track which step each user has completed and reject requests that arrive out of order or skip a step.
- Make one-time actions atomic. Use database transactions and uniqueness constraints so a coupon or reward can't be redeemed twice, even in parallel.
- Apply the same rules on every channel — web, mobile, API.
- Write abuse cases during design: "how could someone misuse this?" next to "how should someone use this?"
- Monitor business metrics — unusual refund rates, negative totals, a coupon used far more than expected. Logic attacks often show up in business data before security logs.
Common mistakes
- Only testing technical bugs. Scanners miss these; you shouldn't.
- Not understanding the business before testing it.
- Only following the UI. The UI shows what's intended. Burp shows what's possible.
- Assuming client-side validation protects the server. It doesn't (Stage 2 Lesson 1).
- Testing on real shops. A manipulated real order is fraud. Labs only.
Check yourself
- Why do automated scanners usually miss business logic flaws?
- An add-to-cart request includes
price=2999. What's the risk, and what's the fix? - A checkout has steps 1–4. What should you test about the order of requests, and how does the server prevent problems?
Answers
- Scanners don't understand the business rules — they can't know that a price must never be changed by the user or that a step mustn't be skipped. Finding these needs human understanding of how the application is meant to work.
- If the server trusts the client's price, a user can change it and pay less. Fix: ignore client-supplied prices and look up/calculate the price on the server.
- Test skipping, repeating and reordering steps. The server must track each user's progress and reject out-of-order or skipped requests, and make one-time actions atomic.
Your lab
- PortSwigger Business logic vulnerabilities: https://portswigger.net/web-security/logic-flaws
Writeup: the intended flow, the assumption you broke, the request that proved it, and the server-side rule that fixes it.
Summary in your language
தமிழில் சுருக்கம்
Business logic flaw என்பது application-இன் விதிகளையே வளைக்க முடிவது — ஒரு படியைத் தவிர்ப்பது, எதிர்மறை அளவில் order செய்வது, coupon-ஐ இருமுறை பயன்படுத்துவது — ஏனெனில் பயனர் சரியான வழியில் மட்டுமே செல்வார் என்று developers நினைத்தார்கள். Scanners இவற்றைக் கண்டுபிடிப்பதில்லை; வணிகத்தைப் புரிந்த மனிதர்களே கண்டுபிடிக்கிறார்கள். தீர்வு: விலை, தள்ளுபடி போன்ற முக்கிய மதிப்புகளை server-இலேயே கணக்கிடுங்கள்; அளவுகளைச் சரிபாருங்கள்; படிகளின் வரிசையை server-இல் கட்டாயப்படுத்துங்கள்; ஒருமுறைச் செயல்களை atomic ஆக்குங்கள்.
हिंदी में सारांश
Business logic flaw में application के नियम ही मोड़े जा सकते हैं — कोई step छोड़ना, negative quantity order करना, coupon दो बार लगाना — क्योंकि developers ने मान लिया था कि user सिर्फ़ सही रास्ते पर चलेगा। Scanners इन्हें नहीं पकड़ते; business समझने वाले इंसान पकड़ते हैं। इलाज: price और discount जैसी ज़रूरी values server पर ही तय करें, ranges जाँचें, steps का क्रम server पर लागू करें, और एक बार वाले कामों को atomic बनाएँ।
Want this summary in Malayalam, Telugu, Kannada or another language? Tell us — the most requested languages get added next.
What's next
Finding a bug is half the job — the other half is getting it fixed: Writing a finding that gets fixed