--- name: api-bfla description: Broken Function Level Authorization (OWASP API5) — call admin/privileged functions with a low-privilege identity via admin-route enumeration, HTTP verb/method abuse, and role confusion. Tier 1. Use when an API has admin/moderator/privileged actions or role-gated endpoints. --- # API5 — Broken Function Level Authorization (BFLA) Low-priv identity reaches privileged/admin functions because authorization is enforced per-endpoint inconsistently or not at all. Points ref: `${CLAUDE_PLUGIN_ROOT}/payloads/INJECTION-POINTS.md`. ## Trigger phrases `api5, bfla, function level authorization, admin endpoint, privilege escalation, verb tampering, role abuse, method swap` ## Method 1. Build a **role × endpoint matrix** (admin, user, anon). Enumerate admin/privileged routes from `api-recon`: `/api/admin/*`, `/api/v1/users/{id}/roles`, `/internal/*`, `/manage/*`, bulk/export/config actions. 2. Call each privileged function with a **low-priv token** (and anon). If it executes → BFLA. 3. **Verb/method swap** — where `GET` is allowed, try `POST/PUT/PATCH/DELETE` for the write/delete variant; many apps gate only the documented verb. 4. **Role confusion** — can a regular user hit moderator/admin actions? Does changing a role field/header (`X-Role`, `X-Admin`) change behaviour? 5. Automate with Burp **Autorize**/**AuthMatrix**: replay every admin-session request under the low-priv session and flag any that still succeed. ## Bypass / evasion Path case/encoding (`/Admin`, `/%61dmin`, `/admin/`, `/admin;`); header overrides `X-Original-URL: /admin/x`, `X-Rewrite-URL`; **verb tunneling** `X-HTTP-Method-Override: DELETE` (also `_method=DELETE`); trailing `.json`/`/`; version swap (`/v1` gated, `/v2` not). See `${CLAUDE_PLUGIN_ROOT}/payloads/waf-bypass.md`. ## Modern / rare techniques - **[RARE] Verb tunneling** — gateway only inspects the real method; `X-HTTP-Method-Override`/`_method` reaches a protected handler. - **[RARE] Gateway path-override headers** — `X-Original-URL`/`X-Rewrite-URL` route to an admin path the edge thought it blocked. - **[RARE] Error-code oracle** — `401` vs `403` vs `200` differentiates "exists but forbidden" from "callable", mapping the privileged surface. ## Escalation / chaining Admin function access → create/elevate accounts, dump data, change config → full compromise. Chain from `api-bopla` (self-elevate role) then exercise admin funcs; combine with `api-bola` for targeted object actions. ## Backend & tooling Preferred Kali path (WSL+Kali / Kali-MCP / HexStrike). Burp + Autorize/AuthMatrix for matrix coverage; Repeater for verb/header PoCs. See `zazy-orchestrator`. ## Verification (background, before reporting) Confirm the privileged action actually took effect under the low-priv/anon identity (state changed, admin data returned), reproduced independently. Distinguish real execution from a decoy 200. True positives only. ## Evidence Low-priv/anon request invoking the admin function + response/side-effect proving execution, with the identity shown. Impact + remediation (deny-by-default, centralized per-function role checks, enforce across all verbs/versions).