skills/sentinel/skills/business-logic/SKILL.md
Detect business logic security vulnerabilities. Use when the user asks to "check business logic security", "find logic flaws", "audit workflow security", "check for coupon abuse", "detect negative amount exploits", "analyze state machine security", or mentions "business logic", "workflow bypass", "negative amount", "coupon abuse", "self-referral", "state manipulation", or "price manipulation" in a security context. Invoke with /sentinel:business-logic.
npx skillsauth add 0x1337c0d3/claude-security business-logicInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analyze application business logic for security vulnerabilities including workflow step bypassing, negative amount manipulation, coupon/discount abuse, self-referral exploitation, state machine manipulation, and time-based logic exploits. Business logic flaws are unique to each application and cannot be detected by generic scanners — they require understanding the intended workflow and finding ways to subvert it.
Key CWEs in scope:
OWASP mapping: A04:2021 (Insecure Design) STRIDE mapping: T (Tampering), E (Elevation of Privilege)
Prioritize these file patterns:
**/payments/**, **/checkout/**, **/billing/**)**/orders/**, **/cart/**, **/transactions/**)**/coupons/**, **/discounts/**, **/promotions/**)**/referrals/**, **/rewards/**, **/loyalty/**)**/workflows/**, **/state/**, **/status/**)**/accounts/**, **/profiles/**)Run semgrep if available: semgrep scan --config auto --json --quiet <target>
Filter for numeric validation, state management, and workflow enforcement patterns.
Note: business logic flaws are primarily detected through manual code analysis, not automated scanners. Scanner output is supplementary.
Map multi-step workflows (checkout, verification, approval) and verify each step cannot be skipped by calling later steps directly.
# Vulnerable: step 3 endpoint doesn't verify step 2 was completed
@app.route('/checkout/payment') # step 2
def payment():
session['payment_done'] = True
@app.route('/checkout/confirm') # step 3 — can be called directly
def confirm():
# No check: was payment actually processed?
complete_order(session['cart'])
Find numeric inputs (amounts, quantities, prices) and verify the application rejects negative values at the server side.
// Vulnerable: negative amount passes validation and reverses the charge
const amount = req.body.amount; // attacker sends -100
await chargeCard(amount); // results in a $100 credit
Find discount application logic and verify coupons cannot be applied multiple times, stacked beyond intended limits, or used after expiration.
# Vulnerable: no check if coupon already used by this user
if coupon.is_valid():
order.apply_discount(coupon.amount)
# Missing: mark coupon as used, check per-user limit
Find referral systems and verify users cannot refer themselves or create circular referral chains.
# Vulnerable: no check that referrer != referred user
def apply_referral(referrer_id, new_user_id):
user = User.get(referrer_id)
user.credits += REFERRAL_BONUS # attacker creates accounts, refers themselves
Map state transitions and verify invalid transitions are rejected.
# Vulnerable: order can jump from 'pending' to 'delivered' directly
def update_status(order_id, new_status):
order = Order.get(order_id)
order.status = new_status # no transition validation
order.save()
Find logic depending on timestamps and verify it handles timezone manipulation, clock skew, and deadline race conditions.
// Vulnerable: client-supplied timestamp used for discount expiry
if (req.body.timestamp < discount.expiresAt) {
applyDiscount(); // attacker sends past timestamp
}
Client-supplied prices accepted without server-side verification against the product catalog.
# Vulnerable: price comes from the client
order = Order(
product_id=req.body.product_id,
price=req.body.price, # attacker sends price=0.01
quantity=req.body.quantity
)
No limits on quantities enabling abuse (ordering negative quantities, exceeding stock, zero-quantity orders).
[BIZ-XXX] Title
Severity: CRITICAL/HIGH/MEDIUM/LOW | CWE: CWE-840/CWE-841
Location: file:line | Confidence: HIGH/MEDIUM/LOW
Business rule violated: [what the intended behavior is]
Exploit scenario:
1. [How attacker subverts the workflow]
2. [What server-side check is missing]
3. [Business impact: financial loss / unfair advantage / data bypass]
Evidence:
[vulnerable code snippet]
Fix:
[corrected code enforcing the business rule server-side]
| Severity | Criteria | |----------|----------| | CRITICAL | Direct financial loss (negative amounts in payments, price manipulation) | | HIGH | Workflow bypass on security-critical processes, unlimited discount stacking | | MEDIUM | Self-referral abuse, state manipulation with limited business impact | | LOW | Minor workflow inconsistencies, cosmetic state issues |
Business logic findings are by definition missed by Sentinel's SAST scanner.
They complement the Sentinel report as BIZ-XXX entries. Map to OWASP A04:2021.
These findings are the highest-value output of the audit layer since they
represent vulnerabilities tools cannot catch.
Format your final output following the standard Sentinel report structure defined in
${CLAUDE_SKILL_DIR}/../../templates/report.md. Use your skill's domain-specific
finding IDs (e.g. STRIDE-SPOOF-001, RT-SK-001, API-001) in the Finding ID column.
Include the Security Scorecard and Findings sections as a minimum. Omit the
Cross-Validation Summary section if you ran only AI analysis (no tool comparison).
development
STRIDE threat modeling. Use when the user asks to "run STRIDE", "threat model with STRIDE", "check for spoofing/tampering/repudiation/info disclosure/DoS/ privilege escalation", or invokes /sentinel:stride. Analyzes the codebase across all 6 STRIDE threat categories (Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege).
data-ai
Adversarial analysis from 6 attacker personas. Use when the user asks to "red team this", "think like an attacker", "simulate an attack", "threat model as an adversary", or wants to understand how their app would be attacked by a script kiddie, insider, organized crime, nation-state, hacktivist, or supply chain attacker. Invoke with /sentinel:red-team.
testing
Detect race condition vulnerabilities. Use when the user asks to "check for race conditions", "find TOCTOU bugs", "analyze concurrency issues", "detect double-spend vulnerabilities", "check for check-then-act patterns", or mentions "race condition", "TOCTOU", "double-spend", "concurrency", "atomicity", or "thread safety" in a security context. Invoke with /sentinel:race-conditions.
tools
Intelligence-driven security analysis — the reasoning layer that complements Sentinel's tool-based scanning. Use this skill when the user says "analyze these findings", "explain this vulnerability", "is this exploitable", "false positive?", "fix this security issue", "threat model this", "audit my Dockerfile/Terraform/k8s/GitHub Actions", "harden this config", "review my auth code", "is this JWT safe", "check for secrets", or pastes Sentinel's consolidated.json for deeper analysis. Also trigger on any security question after `/sentinel:sentinel` has run. Works without any tools installed — pure Claude intelligence. Part of the Sentinel plugin (github.com/alissonlinneker/sentinel-claude-skill).