OWASP WSTG v4.2 Explained

OWASP WSTG: Part 11 - Business Logic

WSTG v4.2 section 4.10 explained: business-logic data validation, forging requests, integrity checks, process timing, function-use limits, workflow circumvention, misuse defenses and upload of unexpected or malicious files, with test ideas and fixes.

11 min read
views
visits
OWASP WSTG Part 11 - Business Logic
OWASP WSTG Part 11 - Business Logic

Every test so far has looked for a technical flaw: a query, a token, a header. Business-logic testing is different. The request can be perfectly well-formed and still abuse how the application is meant to work: applying a coupon a thousand times, skipping the payment step, buying a negative quantity to get a refund, or ordering the steps of a workflow in a way the designers never imagined.

Business Logic testing (WSTG section 4.10, IDs WSTG-BUSL-*) is the category scanners cannot do. It requires understanding what the application is for and then asking “what if I don’t play by the rules?”. This is where the map you built in Part 2 (INFO-06/07) pays off.

Source: WSTG v4.2 §4.10 Business Logic Testing (CC BY-SA 4.0), explained and expanded. Only test systems you are authorised to test.


Key Takeaways

  • Logic flaws are context, not syntax: the request is valid; the outcome is not intended.
  • Automated tools miss these. You need to understand the workflow and deliberately misuse it.
  • Bypass the front end: forge requests directly, skip client-side validation, submit hidden/disabled fields.
  • Think in abuse cases: negative numbers, huge numbers, skipped steps, repeated actions, altered order, concurrent requests.
  • File upload is where logic meets code execution: both what you accept and how you process it.

The Business-Logic Mindset

flowchart TD
    MAP["Understand the workflow<br/>(from Part 2 mapping)"] --> ABUSE["Write abuse cases"]
    ABUSE --> V["Invalid values accepted?<br/>(BUSL-01)"]
    ABUSE --> F["Forge requests past the UI<br/>(BUSL-02)"]
    ABUSE --> I["Tamper hidden/integrity data<br/>(BUSL-03)"]
    ABUSE --> T["Abuse timing / races<br/>(BUSL-04)"]
    ABUSE --> L["Exceed use limits<br/>(BUSL-05)"]
    ABUSE --> W["Skip or reorder steps<br/>(BUSL-06)"]
    ABUSE --> D["Does the app notice misuse?<br/>(BUSL-07)"]
    ABUSE --> U["Upload unexpected / malicious files<br/>(BUSL-08 / 09)"]

WSTG-BUSL-01: Business Logic Data Validation

What it checks: whether the server accepts data that is well-formed but logically invalid: a negative price, a quantity of 2 billion, a future birth date, a transfer larger than the balance.

How to test: for each field, ask what values are logically allowed, then submit values outside that, directly to the server (bypassing client-side checks):

1
2
3
POST /cart/add        qty=-5          -> credit instead of charge?
POST /transfer        amount=-100     -> reverse the transfer?
POST /order           price=0.01      -> client-controlled price

Fix: validate business rules on the server, with correct types and ranges, at every entry point, and never trust values the client could have set (prices, balances, discounts).


WSTG-BUSL-02: Ability to Forge Requests

What it checks: whether you can craft requests the UI would never let you make: guessable parameter values, hidden options, or steps/functions the interface hides.

How to test:

  • Guessable values: a type=standard parameter → try type=premium, type=admin; accountType=2 → 1.
  • Hidden options: parameters present in some requests but not shown in the UI, feature flags, debug, test, preview.
  • Submit fields the UI marks disabled/read-only, or that only appear for other roles.

Fix: the server must enforce what each user is allowed to request, independent of what the UI exposes; treat every parameter as attacker-controlled.


WSTG-BUSL-03: Integrity Checks

What it checks: whether data the application assumes is fixed (hidden fields, read-only values, client-held state) can be changed, and whether such changes are detected.

How to test: modify hidden form fields, client-stored values, and “locked” data, then submit:

1
2
<input type="hidden" name="price" value="62.50">     -> change to 1.00
<input type="hidden" name="userRole" value="user">   -> admin

Also test whether changes to data that should be immutable (an order after approval, a submitted grade) are allowed and logged.

Fix: never trust client-held values for decisions; keep authoritative state server-side; sign or re-derive values; apply strict access control and log integrity-relevant changes.


WSTG-BUSL-04: Process Timing

What it checks: information or advantage leaked through how long operations take, and logic that can be broken by timing, including race conditions.

How to test:

  • Timing side-channels: does login take longer for a valid username (feeds enumeration, Part 4)? Does a check short-circuit?
  • Race conditions: fire the same request many times concurrently to beat a check: redeem one gift card twice, withdraw the same balance twice, use a one-time coupon in parallel.
1
2
# Fire 20 concurrent redemptions of the same single-use code (authorised test)
seq 20 | xargs -P20 -I{} curl -s -X POST https://example.com/redeem -d 'code=ONCE123' -H 'Cookie: SESS=...'

Fix: make security-sensitive operations constant-time where it matters; protect shared resources with atomic operations, locks or idempotency keys so concurrent requests cannot double-spend.


WSTG-BUSL-05: Number of Times a Function Can Be Used (Limits)

What it checks: whether actions that should have a limit actually enforce it: one vote per user, one coupon per order, a withdrawal cap, a free trial once.

How to test: perform the action up to and beyond its intended limit, including across sessions/accounts and concurrently (overlaps with BUSL-04 races).

Fix: enforce limits server-side at the database level (unique constraints, counters, marking a coupon used atomically), not in the UI or per-session.


WSTG-BUSL-06: Circumvention of Workflows

What it checks: whether the required steps of a process can be skipped, repeated or reordered: reaching the “order confirmed” page without paying, downloading a file before purchase, completing checkout without the shipping step.

How to test: map the intended step order, then jump straight to a later step’s request, repeat a step, or run steps out of order, using forged requests.

1
2
Intended:  cart -> address -> payment -> confirm
Try:       cart -> confirm            (skip payment)

Fix: track workflow state on the server and verify, at each step, that all previous required steps were completed for this user/session; do not infer completion from a client value.


WSTG-BUSL-07: Defenses Against Application Misuse

What it checks: whether the application notices and responds when a legitimate user behaves abnormally (hundreds of failed IDOR attempts, forced-browsing, obvious tampering), the behaviour your other tests produce.

How to test: review how the application reacted during the whole engagement. Did aggressive input, enumeration or tampering trigger anything: alerts, lockouts, CAPTCHAs, changed behaviour? Usually nothing happens, which is itself the finding.

Fix: add active defences: detect and log abnormal patterns, alert, and respond (step-up auth, rate-limit, block). This is the idea behind OWASP AppSensor.


WSTG-BUSL-08: Upload of Unexpected File Types

What it checks: whether the upload feature restricts file types to those the application is prepared to handle, and whether that restriction can be bypassed.

How to test: upload types that should be rejected and bypass the checks:

  • Extension/MIME tricks: shell.php.jpg, shell.pHp, shell.php%00.jpg, trailing dots/spaces, double extensions.
  • Content-type spoofing: send Content-Type: image/png for a non-image.
  • Magic-byte spoofing: prepend valid image headers to a script.

Whether this becomes dangerous depends on how the file is stored and served (next test).

Fix: allow-list acceptable types by verifying content (not just extension/MIME), and make sure the application only tries to process types it understands.


WSTG-BUSL-09: Upload of Malicious Files

What it checks: whether an uploaded file can cause harm: a web shell that executes, an SVG/HTML that runs script (stored XSS), an archive that traverses directories (zip-slip) or a zip bomb, a malicious Office/XML (macro, XXE), or malware passed to other users.

How to test (authorised):

  • Web shell: upload a script in the app’s language and request it directly, to see if it executes.
  • Stored XSS via SVG/HTML: upload an SVG containing <script> and open it.
  • Archive traversal (zip-slip): an archive entry named ../../../../etc/cron.d/x.
  • XML-based (DOCX/XLSX/SVG): embedded XXE or macros.
  • Where it lands: is the upload directory web-accessible and executable? Served from the same origin?

Prove only what is necessary. On a real engagement, a harmless proof (e.g. a file that prints a unique string, not a full shell) demonstrates the issue without risk.

Fix: store uploads outside the web root or on a separate, non-executable, different-origin domain; rename files and strip metadata; verify content type; scan for malware; set Content-Disposition: attachment and a restrictive Content-Type; validate archive entries; cap size and nesting. See the OWASP File Upload Cheat Sheet.


Worked Example: A Race Condition That Double-Spends a Coupon (BUSL-04/05)

The request is valid and the user is authenticated. The flaw is that the “has this coupon been used?” check and the “mark it used” write happen as two separate steps, so many requests fired at once all pass the check before any of them records the use.

Vulnerable (Node) — check-then-act with a gap in between:

1
2
3
4
5
6
7
8
app.post('/redeem', requireLogin, async (req, res) => {
  const coupon = await db.coupons.findOne({ code: req.body.code });
  if (!coupon || coupon.used) return res.status(400).json({ error: 'invalid' });
  await applyDiscount(req.user.id, coupon.value);   // <-- gap
  coupon.used = true;                                //     another request already
  await coupon.save();                               //     passed the check here
  res.json({ ok: true });
});

Exploit — fire many redemptions of the same single-use code concurrently so they overlap in the gap:

1
2
3
4
5
# 30 parallel requests; several land the discount before any writes used=true
seq 30 | xargs -P30 -I{} curl -s -X POST https://example.com/redeem \
  -H "Cookie: SESS=$SESSION" -d 'code=SAVE50' -o /dev/null -w '%{http_code}\n' | sort | uniq -c
#   27 200      <- the coupon applied 27 times instead of once
#    3 400

The same pattern double-spends gift-card balances, over-withdraws accounts and bypasses “one per customer” limits.

Fixed — make the check-and-update a single atomic operation, so the database serialises the concurrent requests:

1
2
3
4
5
6
7
8
9
10
11
app.post('/redeem', requireLogin, async (req, res) => {
  // atomically flip used:false -> true; only ONE request can match
  const claimed = await db.coupons.findOneAndUpdate(
    { code: req.body.code, used: false },
    { $set: { used: true, usedBy: req.user.id } },
    { returnDocument: 'after' }
  );
  if (!claimed) return res.status(400).json({ error: 'invalid or already used' });
  await applyDiscount(req.user.id, claimed.value);
  res.json({ ok: true });
});

In SQL the equivalent is a UNIQUE constraint, SELECT ... FOR UPDATE, or a conditional UPDATE ... WHERE used = false whose affected-row count you check. An idempotency key per request is the general pattern for payment-style flows.

Real-world case. Concurrency/limit-overrun bugs are a recurring high-value bug-bounty class, promo codes stacked, gift cards redeemed multiple times, “one vote per user” defeated, because so much code is written as check-then-act without a transaction. Burp’s Turbo Intruder and the “send group in parallel” feature exist specifically to test them.


Hands-on Practice

  • PortSwigger Academy — dedicated labs for race conditions and business logic vulnerabilities.
  • Juice Shop — the coupon, basket-manipulation and “negative quantity” challenges.
  • Burp Turbo Intruder — the tool for firing many requests in a tight window to hit the race.

Checklist: Business Logic

ID Test Approach
WSTG-BUSL-01 Business logic data validation Submit logically invalid values to the server
WSTG-BUSL-02 Ability to forge requests Guessable/hidden parameters and options
WSTG-BUSL-03 Integrity checks Tamper hidden/read-only/immutable data
WSTG-BUSL-04 Process timing Timing side-channels and race conditions
WSTG-BUSL-05 Function-use limits Exceed limits across sessions and concurrently
WSTG-BUSL-06 Circumvention of workflows Skip, repeat or reorder steps
WSTG-BUSL-07 Defenses against misuse Did the app detect your attacks?
WSTG-BUSL-08 Upload of unexpected file types Type/MIME/magic-byte bypasses
WSTG-BUSL-09 Upload of malicious files Web shells, SVG XSS, zip-slip, XXE

Previous: Part 10 - Weak Cryptography · Next: Part 12 - Client-side Testing


References

Further reading

Comments

Questions, corrections or another approach? Comment with your GitHub account.

Open Research & Community Labs
صدقة جارية • Ongoing Charity

Empowering the Cybersecurity Community

All research, lab walkthroughs, and technical series on this platform remain 100% free. You can support server hosting, research environments, and lab infrastructure.

Support & Wall of Honor
اللهم اجعل هذا العمل علمًا نافعًا وصدقةً جارية، واكتب لي به الأجر والقبول، وانفع به كل من قرأه أو تعلّمه.
اللهم احفظ لي والديّ وأهلي، وبارك في أعمارهم وصحتهم، وأدم عليهم نعمة الصحة والعافية، ولا تريني فيهم بأسًا يبكيني.
Dedicated as ongoing charity and beneficial knowledge. May Allah bless my parents and family, protect them, and grant them lasting health and happiness.