Api bfla

From xalgorix/xalgorix · View interactive version

Api bfla is an AI agent skill from the GitHub repository xalgorix/xalgorix. Broken Function Level Authorization (BFLA) testing — invoking administrative API functions with lower-privilege sessions via method, version, path-normalization, and override-header variants (OWASP API5)

How to use this skill

Skill file

API BFLA — Broken Function Level Authorization (OWASP API5)

Purpose

Test whether regular (or partially privileged) users can invoke administrative API functions that should be restricted to higher roles.

Preconditions

Attack Surface Signals

Methodology

Step 1: Build the Admin Inventory

for path in admin manage management internal system console backoffice ops \
  admin/users admin/settings admin/config admin/logs admin/reports admin/billing; do
  for method in GET POST PUT PATCH DELETE; do
    code=$(curl -sk -o /dev/null -w "%{http_code}" -X $method \
      -H "Authorization: Bearer LOW_PRIV_TOKEN" "https://TARGET/api/v1/$path")
    echo "$method /$path -> $code"
  done
done

Treat any non-401/403 outcome as a CANDIDATE — never as a finding by itself.

Step 2: Role-Differential Matrix

admin legitimate request on function F   → 200 + privileged effect (baseline)
same request with lower-privilege session  → candidate if NOT 401/403
same request anonymous                    → candidate if NOT 401/403
verify effect with an authorized read     → finding only if the privileged
                                            state actually changed / data returned

Use authz_matrix when multiple roles exist; test moderator/support tiers too, not just user-vs-admin — partial-role gaps are common.

Step 3: Method and Override Variants

# Verbs the gateway forgot
for method in PUT PATCH DELETE; do
  code=$(curl -sk -o /dev/null -w "%{http_code}" -X $method \
    -H "Authorization: Bearer LOW_PRIV_TOKEN" "https://TARGET/api/v1/admin/settings")
  echo "$method -> $code"
done
# Override headers when the real method is filtered
curl -sk -X POST -H "X-HTTP-Method-Override: DELETE" \
  -H "Authorization: Bearer LOW_PRIV_TOKEN" "https://TARGET/api/v1/audit/logs"

Step 4: Path-Normalization Bypass

Case (/Admin/), URL-encoding (%61dmin), trailing slash, ; matrix params, .. traversal, and .json// suffixes can dodge gateway ACL rules while the backend still routes. Test each against a known-admin path with the low-privilege session.

Step 5: Version Drift

/api/v2/admin/..., v0, beta, internal, legacy frequently lack the middleware v1 enforces. Re-run the full admin inventory under each discovered version prefix.

Step 6: Privilege Escalation via Self-Update (mass-assignment path)

PUT /api/v1/users/me with role, is_admin, group_id, tenant_id — if accepted, read back users/me and verify the role actually persisted (evidence contract shared with api-bopla).

Evidence Contract

A BFLA finding requires one of:

NOT evidence: 404 (route doesn't exist), 405 (method blocked), 422 (validation rejected before authz), 500 (crash ≠ authorization), empty bodies, generic framework pages, OPTIONS output, redirect-to-login. These are at most CANDIDATES requiring a confirmed privileged outcome.

Common Misses

False Positives / Non-Findings

Xalgorix Tool Strategy

Stopping Rule

Every privileged function x every role below its requirement x every method/override/version/normalization variant, with verified privileged outcomes.

Handoff

Report function, the role that should be required, the role that succeeded, the exact variant used, and the verified privileged data or state change.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.