agentleFS
raphaelbleierraphaelbleier/mythos-sec/skills/business-logic/SKILL.md

business-logic

Skill2 starsChanged 17 days agoMITView on GitHub

Business-logic and authorization testing for a Mythos engagement with two or more authenticated principals - BOLA/IDOR via an owner/other/anonymous diff, BFLA, mass assignment via an OpenAPI request-vs-response schema diff, race conditions via sequential-vs-parallel waves, and workflow/price manipulation, each proven by an invariant violation. Use after auth-session has produced sessions for userA and userB, on APIs and multi-step flows (checkout, transfer, redeem, invite, approve).

10 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use open-redirect, request-smuggling and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • yaklangSkill

    open-redirect

    Open redirect playbook. Use when URL parameters, form actions, or JavaScript sinks control navigation targets and may redirect users to attacker-controlled destinations.

    Also in 5 projects that use this

  • yaklangSkill

    request-smuggling

    HTTP request smuggling and desynchronization testing. Use when front proxies, CDNs, or load balancers disagree with the origin on message framing (Content-Length vs Transfer-Encoding), on HTTP/2→HTTP/1 translation, or when exploring client-side desync via browser fetch pipelines.

    Also in 3 projects that use this

  • sunilgentyalaSkill

    xxe

    XML External Entity injection expert methodology. Covers classic XXE, blind OOB XXE, XXE via file upload, XXE to SSRF, and XXE in PDF/DOCX parsers.

    Also in 3 projects that use this

  • VercelSkill

    oauth

    Configure OAuth providers (Google, Apple, Microsoft, Facebook, GitHub, etc.) to work with portless local dev URLs. Use when setting up OAuth redirect URIs, fixing "redirect_uri_mismatch" or "invalid redirect" errors, configuring sign-in providers for local development, or when a provider rejects .localhost subdomains. Triggers include "OAuth not working with portless", "redirect URI mismatch", "Google/Apple/Microsoft sign-in fails locally", "configure OAuth for local dev", or any task involving OAuth callback URLs with portless domains.

    Also in 4 projects that use this

  • JosBen74Skill

    osint

    OSINT-sökning och informationsinhämtning från öppna källor för Länsstyrelsen VG

    Also in 3 projects that use this

  • +1 more from yaklang

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Objects: every resource type with an id (user, order, file, invoice, message, cart, api key).

    line 29
  2. Distinctive:

    Actions: read, list, create, update, delete, and the workflow verbs (approve, refund, transfer, redeem, invite, export).

    line 32
  3. Very specific:

    Write it as a table in scan/matrix.md: one row per (object, action), one column per subject, cells = expected (allow/deny) from the app's …

    line 35
  4. Distinctive:

    Every later test fills in "observed".

    line 37
  5. Very specific:

    Write verbs (PUT/PATCH/DELETE, --allow-write) only on objects the agent created with its own accounts (B's own test order, never a real …

    line 70
  6. Very specific:

    Read, write, read again as the reading principal (--as 'Cookie: ...' for a cross-principal read).

    line 109
  7. Distinctive:

    Only on a one-shot resource the agent created (own coupon, own gift card, own small balance, own invite), N <= 20, 2 repeats:

    line 119
  8. Distinctive:

    Durable state: read back from the authoritative source (GET of the object, ledger, admin view), not the write response.

    line 163

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Business logic: prove the invariant breaks

Scanners cannot see these bugs: every request is well formed, only the principal or the order is wrong. Method adapted from Strix's IDOR and business-logic skills (usestrix/strix, Apache-2.0: strix/skills/vulnerabilities/idor.md, business_logic.md); Auth Analyzer's SAME/SIMILAR/DIFFERENT triage (PortSwigger/auth-analyzer).

Triage selects this skill (skills/registry.yaml) when the surface shows an object id in a parameter, a money, role, quantity or status parameter, a PUT, PATCH or DELETE on any endpoint, an OpenAPI document, or a checkout, cart, order, transfer, payment, redeem, coupon, invite, approve, refund or billing route. It drives bola-diff, mass-assign, race and session-check, and needs auth-session first.

Prerequisites: scope.rules.allow_active, sessions from auth-session (S=engagements/<dir>/sessions, roles userA, userB, optionally admin), recon's endpoint list or OpenAPI spec. Run session-check first. Output to engagements/<dir>/scan/.

1. Build the Subject x Object x Action matrix

  • Subjects: anon, userA, userB, admin (if any), plus tenant/org if multi-tenant.
  • Objects: every resource type with an id (user, order, file, invoice, message, cart, api key). Collect real ids for each user from list, search, export and profile endpoints while logged in as that user.
  • Actions: read, list, create, update, delete, and the workflow verbs (approve, refund, transfer, redeem, invite, export).

Write it as a table in scan/matrix.md: one row per (object, action), one column per subject, cells = expected (allow/deny) from the app's own rules. Every later test fills in "observed". A cell where observed != expected is a candidate. The same table feeds the coverage matrix in web-scan.

2. BOLA / IDOR (horizontal), BFLA (vertical)

List A's object URLs, one per line (URL or METHOD URL [JSON]), then:

scripts/mythos python3 /repo/skills/business-logic/scripts/bola_diff.py --endpoints scan/ids-A.txt \
  --a $S/userA.headers --b $S/userB.headers --marker <A-only string, e.g. A's email> \
  --rps <scope rps> --out engagements/<dir>/scan/bola.jsonl

It sends each request as A (baseline), B and anon, classifies SAME/SIMILAR/ DIFFERENT and prints candidate/enforced/review. This is triage. For BFLA, run the admin-only endpoints with --a $S/admin.headers --b $S/userA.headers.

For one candidate at a time, scripts/verify --oracle differential turns the triage row into a predicate: the same request with and without one varied element (--param id --value <B's id> --control-value <A's id>, or --vary-header 'X-Role: admin'). It measures the noise floor first with --baseline, masks the fields that always change, and returns ambiguous rather than a verdict when the baseline is unstable or when the only difference is the response echoing the value back — which is the single most common false BOLA. Keep its --json output and cite it as oracle:.

Variations the script does not do, try them by hand on candidates and on review rows: id in body vs path vs query, numeric neighbour vs UUID from a leak, /users/me vs /users/<id>, older API version (/v1/ vs /v2/), other content type, other transport (REST vs GraphQL vs WebSocket). Strix requires the same object to fall on two transports before you call it systemic.

Write verbs (PUT/PATCH/DELETE, --allow-write) only on objects the agent created with its own accounts (B's own test order, never a real user's).

False positives (Strix list): public-by-design data, idempotent metadata, an empty 200 for another user's object (that is silent enforcement; compare with the owner's view).

3. Mass assignment

scripts/mythos python3 /repo/skills/business-logic/scripts/mass_assign.py fields engagements/<dir>/recon/openapi.json

For each write operation it lists fields the resource returns but the request schema does not declare (or marks readOnly), sensitive names first (role, isAdmin, balance, price, userId, tenantId, verified). No spec: take the fields from a GET response of the object, and use arjun -m JSON for hidden ones. Then prove one on your own object:

scripts/mythos python3 /repo/skills/business-logic/scripts/mass_assign.py probe --headers $S/userA.headers \
  --method PUT --url <URL of A's object> --body '<normal body>' --field role=admin --get-url <same object>

reproduced = the confirming GET shows the injected value and the GET before did not. A 200 on the write is not enough (many frameworks drop unknown fields silently). Then show the effect: the new role reaches an admin function, the new balance buys something.

scripts/verify --oracle readback is that exact shape as a deterministic predicate, and it is what the finding should cite:

scripts/verify --oracle readback --write <URL of A's object> --method PUT \
  --data '<normal body with the injected field>' --read <same object> \
  --marker '<the injected value>' --header "$(sed -n 1p $S/userA.headers)" --json \
  > engagements/<dir>/scan/oracle-massassign.json

Read, write, read again as the reading principal (--as 'Cookie: ...' for a cross-principal read). The read before the write is the control, and the write's own response is explicitly not the oracle. A marker already present in the first read comes back ambiguous, not evidence. Keep the --json file and name its path in the finding's oracle: front matter, so scripts/evidence build puts the predicate, the result and the control into the bundle instead of falling back to your prose.

4. Race conditions

Only on a one-shot resource the agent created (own coupon, own gift card, own small balance, own invite), N <= 20, 2 repeats:

scripts/race limit --url <redeem URL> --method POST --data '{"code":"{{R}}"}' \
  --setup-url <coupon-create URL> --setup-field code \
  --owner-url <the endpoint that lists what you own> \
  --state-url <balance/usage URL> --count-regex '"redemptions":\s*(\d+)' \
  --header 'Authorization: Bearer <own token>' --n 8 --repeats 6 --json

Each repeat runs a parallel wave and a sequential control of the same N on a fresh resource, and reads the authoritative state back as the owner after each one. A race is stochastic, so one success is not a finding: the verdict rests on the hit rate over the repeats with its confidence interval, and it comes back inconclusive when that interval straddles the control's. The control overrunning at all means the test is broken, not that the app is. --engine h2 is the single-packet attack (Kettle 2023: 4-10x more effective than last-byte sync); scripts/race single-packet is the same thing with the h2 defaults, and toctou races a two-step gap instead of one action. The script refuses an object that is not in your --owner-url listing and refuses to race a destructive action on anything it did not create in this run. skills/race-conditions is the full playbook. Never race a real user's resource or a payment that leaves the lab.

5. Workflow and price manipulation

Per workflow (signup, checkout, transfer, password reset, approval) write the state machine, then: skip a step, repeat a step, reorder steps, change a value after it was validated (price, quantity, currency, recipient), send negative / zero / fractional / huge quantities and a client-supplied price on a cart the agent owns. Success criterion is the server-computed total or ledger, never the 200 or the UI.

Proof standard (all classes)

A business-logic finding is validated only with:

  1. Invariant named: "user can only read own orders", "one redemption per code", "balance never negative".
  2. Baseline vs abuse, same principal: the intended flow and the abused flow side by side (for BOLA: owner request/response and other-user request/response).
  3. Negative control: the same request properly denied (B on an object that is enforced, or the sequential wave).
  4. Durable state read back from the authoritative source (GET of the object, ledger, admin view), not the write response.
  5. Quantified impact: how many objects, how much money, which role.

Without all five it stays candidate or reproduced. Hand candidates to exploit, which records closure state and runs the validator pass.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.