mcpField
B
business-logic-testing

business-logic-testing

github.com/mn-youssefSecurity4944 installsUpdated 20w ago
Repository

About business-logic-testing

Business Logic Testing is a security-testing skill for finding flaws in application rules and stateful workflows. It guides testers through assumption checks, workflow and state-machine abuse, concurrency, and money-related cases, with findings tied to business impact.

Key features

  1. 01Map intended workflows and assumptions
  2. 02Test skipped and reordered steps
  3. 03Probe state-machine transitions
  4. 04Check concurrent one-time actions
  5. 05Test pricing, refunds, and limits

Use cases

  1. 01Assess checkout and payment rules
  2. 02Test coupons or withdrawals for race conditions
  3. 03Check whether refunds exceed payments
  4. 04Verify per-user limits across parallel requests

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/mn-youssef/security-skills --skill business-logic-testing

After installing, type/business-logic-testingin Claude Code to confirm it loaded.

Bundled filesreferences/logic-attack-patterns.md

Details

From the project README

Business Logic Testing (FIND/EXPLOIT — the pro's bread and butter)

Overview

Find flaws in what the app allows, not how it's coded. These are valid requests that produce invalid outcomes — buying for $0, refunding twice, skipping a required step. No scanner finds them because each is unique to your business rules.

Core principle: The app enforces the intended flow; you test every unintended path that still "works." Think: "what does this feature assume, and what if I break that assumption?"

Applies when / Skip when

  • Applies when: the app has multi-step workflows, money/credits/quotas, stateful processes, or business rules that can be abused.
  • Skip when: it's a stateless single-action utility with no rules or state → N/A (rare — most apps have some logic; double-check before skipping).
  • If N/A: report "business-logic-testing: N/A — no stateful workflow/rules" and stop.

⚠️ Authorization

Your own app/test data. Logic abuse can move money/state — use a non-production environment.

Method

  1. Understand the intended flow — map the steps, the rules, and the assumptions at each step (order: add → pay → ship; rule: qty ≥ 1; assumption: price comes from the server).
  2. Challenge each assumption — negative/zero/huge values, skipped steps, reordered steps, client-supplied values the server should own, repeated actions.
  3. Attack the state machine — reach states out of order or revisit terminal states.
  4. Attack concurrency — do the "once only" action many times in parallel (race/TOCTOU).
  5. Attack quantity & money — tamper price, totals, currency, discounts, rounding, limits.

See references/logic-attack-patterns.md for a catalog of concrete patterns.

Quick reference — classic logic flaws

PatternExample
Parameter tamperingChange price, total, qty, userId, status in the request the server trusts
Negative / overflowqty=-1 credits you; huge values overflow; 0 bypasses a charge
Workflow bypassJump straight to "confirm"/"download" without "pay"/"verify"
State machine abuseCancel an already-shipped order; reopen a closed ticket to gain rights
Race condition / TOCTOURedeem one gift card / coupon / withdrawal N times in parallel
ReplayResubmit a signed/one-time request (payment callback, OTP, idempotency key)
Discount/refund abuseStack coupons, refund more than paid, partial-refund loops
Limit bypassExceed per-user caps via parallel requests or multiple sessions

The race-condition test (high value, often missed)

Send the "limited" action many times simultaneously (not sequentially) and check if it succeeds more than once — e.g. 20 parallel redemptions of a single-use coupon. Tools: Burp Turbo Intruder, or a quick parallel curl/script firing identical requests at once.

Output

Findings describing the intended rule, the request that broke it, and the business impact (money lost, limits bypassed, privilege gained). Severity = real-world impact, often Critical.

Hand-off

Reproduce safely on staging via active-pentest; chain with auth/access-control in vulnerability-chaining; fix via security-hardening (server-authoritative values, atomic transactions/locks, idempotency keys, server-side state validation).

Common mistakes

  • Looking for code smells — logic bugs are in valid requests; you must know the rules.
  • Testing actions sequentially when the bug only appears under concurrency.
  • Trusting client-sent prices/totals/limits — re-derive everything server-side and test that it does.
  • Ignoring "soft" features: coupons, referrals, loyalty points, trials, refunds — prime abuse targets.

Comments

Markdown supported