hypnguyen1209/offensive-claude / skills/web-pentest
web-pentest
FlaggedUse when pentesting a web application or API — injection, XSS/CSP, SSRF/cloud-metadata, HTTP desync & cache poisoning, SSTI/prototype-pollution/deserialization, JWT/OAuth/GraphQL/IDOR, business logic & single-packet race
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 12.0 KB |
| references/auth-api-access-control.md | markdown | 14.9 KB |
| references/business-logic-abuse.md | markdown | 5.2 KB |
| references/http-desync-cache.md | markdown | 8.6 KB |
| references/injection-sqli-cmdi.md | markdown | 10.0 KB |
| references/proxy-mcp-integration.md | markdown | 3.1 KB |
| references/ssrf-cloud-metadata.md | markdown | 6.7 KB |
| references/ssti-deserialization.md | markdown | 7.0 KB |
| references/waf-bypass.md | markdown | 7.0 KB |
| references/xss-csp-clientside.md | markdown | 7.9 KB |
| references/xxe.md | markdown | 6.9 KB |
| scripts/desync_probe.py | script | 8.3 KB |
| scripts/graphql_audit.py | script | 6.2 KB |
| scripts/jwt_forge.py | script | 8.2 KB |
| scripts/proto_ssti_gadgets.py | script | 8.1 KB |
| scripts/race_single_packet.py | script | 5.4 KB |
| scripts/session_entropy.py | script | 7.9 KB |
| scripts/ssrf_toolkit.py | script | 8.3 KB |
| scripts/xss_csp_forge.py | script | 8.1 KB |
references/business-logic-abuse.md
View on GitHub# Business-Logic Abuse
The bug class scanners cannot find: the application does exactly what the code says, but the *logic* lets
an attacker reach a state the business never intended — free goods, someone else's data, a skipped payment,
a doubled payout. There is no signature; you find these by **modeling the intended state machine and
attacking the transitions**. Adapted in part from Claude-Red (MIT, Kai Aizen/SnailSploit) — see
`THIRD-PARTY-NOTICES.md`. Maps to OWASP WSTG-BUSL; ATT&CK T1539 (steal session/abuse) / T1078 (valid
accounts / privilege). This class overlaps IDOR/BOLA (`auth-api-access-control.md`) and races
(`scripts/race_single_packet.py`).
## Method: model, then break the transitions
1. **Draw the intended state machine** for the flow (cart → checkout → pay → fulfil; or apply → review →
approve). List every state, the guard on each transition, and *who* is allowed to trigger it.
2. **For each transition ask:** can I trigger it out of order? twice? with a value the UI never sends
(negative, zero, huge, another tenant's id)? as a different role? after it "closed"? concurrently?
3. **Evidence bar:** a 200/302 or "it seemed to work in the UI" is only `[POSSIBLE]`. `[CONFIRMED]` needs
the business effect proven — an order fulfilled at the wrong price, a balance that increased, another
principal's record returned, a step that was skipped and the backend accepted the end state.
## Recurring patterns
| Pattern | Where it bites | CWE |
|---------|----------------|-----|
| **Price / total tampering** — client-supplied price, total, or currency trusted server-side | e-commerce checkout, invoicing | CWE-602 (client-side trust) / CWE-841 |
| **Quantity / value abuse** — negative quantity → refund; zero/huge value; integer wrap | cart, transfers, points | CWE-840 / CWE-682 |
| **Coupon / promo stacking** — apply the same or incompatible codes repeatedly | discounts, referrals | CWE-841 (improper enforcement of behavioral workflow) |
| **Refund / payout / chargeback race** — refund issued more than once, or before capture | payments, wallets | CWE-362 / CWE-841 |
| **Workflow-step skip** — POST the final step's endpoint directly, bypassing validation/payment | multi-step checkout, KYC, approval | CWE-840 / CWE-841 |
| **Replay / idempotency gap** — replay a "transfer"/"redeem" that lacks an idempotency key | transfers, gift cards | CWE-837 (one-time check) / CWE-841 |
| **Role / tenant confusion** — a state transition allowed for the wrong role or across tenants | approvals, admin actions | CWE-639 / CWE-863 |
| **Time-based logic** — act before a lock, after an expiry, or across a TZ/clock boundary | auctions, trials, rate windows | CWE-367 (TOCTOU, see exploit-development) |
## The high-value area: concurrency (races)
Most "impossible" logic bugs are **races** — a check and the action it guards are not atomic, so N
concurrent requests all pass the check. Classic wins: redeem one gift card N times, withdraw more than the
balance, use a single-use coupon N times, over-book limited stock.
- Use **single-packet attack** (HTTP/2) to eliminate network jitter and land requests truly
simultaneously: `scripts/race_single_packet.py` (or Burp Turbo Intruder `race-single-packet-attack`).
- Confirm with a **before/after invariant**: balance/stock/redemption-count that should be conserved but
isn't. That delta is your `[CONFIRMED]` evidence.
```
# conceptual: fire 40 identical "redeem coupon" requests in one TCP packet, then read the balance.
python3 ../scripts/race_single_packet.py --url https://app/redeem --count 40 --token "$SESSION" \
--body '{"code":"SAVE100"}'
# CONFIRMED iff the coupon applied >1 time / balance moved more than once.
```
## Combining flaws — where the crits live
Individually-"low" logic quirks chain into criticals: a **workflow skip** that avoids payment + an
**idempotency gap** = unlimited free orders; a **tenant-confused transition** + a **price tamper** =
buy another tenant's product at your price. Always try to compose two "meh" findings into one that moves
money or crosses a tenant boundary — that is the report's headline.
## Anti-automation defeat (to reach the logic)
Rate limits / CAPTCHAs often guard the flow, not the logic. Note how they're enforced (per-IP? per-token?
client-side?) and whether the sensitive endpoint can be hit directly. Bypassing anti-automation is only a
means to demonstrate the underlying logic flaw — keep it in scope and proportionate.
## Detection & OPSEC
- Logic abuse looks like **legitimate traffic** — same endpoints, valid auth — so it rarely trips a WAF;
detection lives in **backend invariants/alerting** (balance went negative, redemption count exceeded,
duplicate idempotency key) if the app has any.
- Races generate a **burst of identical requests** — visible in access logs / APM as a spike; keep the
burst tight and clean up test artifacts (cancel test orders, reverse test transfers) after proving it.
## Reporting hooks
State the **intended rule**, the **transition you broke**, the **conserved quantity that changed**
(before→after), and the **money/data/authz impact**. Recommend server-side enforcement + idempotency keys
+ atomic check-and-act (DB constraint / row lock / conditional update), not client-side or UI fixes.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |