Skip to content

SSZcreate/Pentab_server / .agents/skills/cybersecurity/skills/exploiting-broken-function-level-authorization

exploiting-broken-function-level-authorization

Verified

Tests APIs for Broken Function Level Authorization (OWASP API5:2023) by identifying admin and privileged endpoints, then reaching them with regular-user credentials via HTTP method switching, URL path manipulation, and parameter tampering. Use when testing whether low-privilege users can invoke admin API functions or otherwise escalate privileges via function-level access control gaps.

FileKindSize
LICENSEother11.0 KB
SKILL.mdskill md15.8 KB
references/api-reference.mdmarkdown2.3 KB
scripts/agent.pyscript4.5 KB

references/api-reference.md

View on GitHub
# API Reference: Broken Function Level Authorization (BFLA)

## OWASP API5:2023 — Broken Function Level Authorization

### Description
API endpoints expose functions that should be restricted to specific roles.
Low-privileged users can invoke admin-level functionality.

### Common Patterns
| Pattern | Example |
|---------|---------|
| Guessable admin paths | `/api/admin/users` |
| Method switching | POST allowed but PUT bypasses auth |
| Role parameter manipulation | `{"role": "admin"}` in request |
| Vertical privilege escalation | User accessing admin endpoints |

## Testing Methodology

### Step 1: Discover Endpoints
```bash
# From OpenAPI spec
curl https://api.target.com/swagger.json | jq '.paths | keys'

# From JavaScript source
grep -oP '["'"'"']/api/[^"'"'"']+' app.js
```

### Step 2: Test with Low-Priv Token
```bash
curl -H "Authorization: Bearer <low_priv_token>" \
     https://api.target.com/api/admin/users
```

### Step 3: Test HTTP Method Switching
```bash
# If GET returns 403, try POST/PUT/DELETE
curl -X PUT -H "Authorization: Bearer <low_priv_token>" \
     https://api.target.com/api/admin/users/1
```

## Python requests Library

### Request with Token
```python
headers = {"Authorization": f"Bearer {token}"}
resp = requests.get(url, headers=headers, timeout=10, verify=False)
```

### Method Switching
```python
for method in ["GET", "POST", "PUT", "DELETE", "PATCH"]:
    resp = requests.request(method, url, headers=headers, timeout=10)
    if resp.status_code < 400:
        print(f"Accessible via {method}: {resp.status_code}")
```

## Common Admin Endpoints to Test

```
/admin
/api/admin
/api/v1/admin/users
/api/internal
/manage
/api/config
/api/debug
/api/users/all
/api/system/settings
/graphql (with admin mutations)
```

## Burp Suite — Authorization Testing

### Autorize Extension
1. Install Autorize from BApp Store
2. Set low-privilege cookie/token
3. Browse application as admin
4. Autorize replays requests with low-priv token
5. Compare responses for authorization bypass

## Response Analysis

| Indicator | Meaning |
|-----------|---------|
| 200 with data | Full access (vulnerability) |
| 200 empty body | Possible partial bypass |
| 403 Forbidden | Properly restricted |
| 401 Unauthorized | Auth required |
| 405 Method Not Allowed | Method restricted |
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: 465kUpdated Claude CodeCodexVerifiedInstall
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: 465kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 465kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 192kUpdated Claude CodeCodexVerifiedInstall