---
name: pentest-api-ccf06bdaf126
description: API security testing — REST/GraphQL/WebSocket, OWASP API Top 10, JWT/OAuth analiz, mass assignment, broken object-level authorization advisory. Triggers on API pentest, OWASP API, REST security, GraphQL test, WebSocket, JWT analysis, OAuth flow, BOLA, BFLA, mass assignment.
license: MIT
compatibility: Works with Claude Code
allowed-tools: Read Write Edit Bash Grep
metadata:
  author: badi
  badi-version: ">=1.24.0"
  category: pentest
  scope: advisory
  inspired-by: 0xSteph/pentest-ai-agents api-security
---

# pentest-api

REST + GraphQL + WebSocket guvenlik testi methodology. OWASP API Security Top 10 (2023) odakli.

## Triggers

- "API pentest"
- "OWASP API Top 10"
- "GraphQL introspection"
- "JWT swap denemesi"
- "OAuth flow test"
- "BOLA / BFLA"
- "mass assignment"
- "WebSocket guvenlik"

## OWASP API Top 10 (2023)

| # | Kategori | Test Yaklasimi |
|---|----------|---------------|
| API1 | BOLA (Broken Object Level Auth) | /users/123 -> /users/124 enum, yetkisiz veri erisimi |
| API2 | Broken Authentication | Token replay, JWT manipulation, brute force endpoint |
| API3 | Broken Object Property Level Auth | Mass assignment (admin: true), excessive exposure |
| API4 | Unrestricted Resource Consumption | Rate limit eksik, pagination size, file upload size |
| API5 | BFLA (Broken Function Level Auth) | /admin/* user role ile erisilir mi |
| API6 | Unrestricted Business Flows | Bizlogic exploit (pentest-bizlogic'e devret) |
| API7 | SSRF | URL parametre cloud metadata reach |
| API8 | Security Misconfig | Verbose error, CORS *, default endpoint |
| API9 | Improper Inventory | v1/v2 ayni endpoint farkli auth, shadow API |
| API10 | Unsafe Consumption of 3rd Party API | API anahtari exfil, response trust |

## REST Test Methodology

```
1. Spec dokuman bul: /swagger.json, /openapi.yaml, /api-docs
2. Endpoint listele + auth gereksinimleri
3. BOLA: numeric ID enum (user_id, doc_id, order_id)
4. BFLA: rol degisikligi (cookie/header swap)
5. Rate limit: 100 istek/sn 60sn icinde
6. CORS: Origin: evil.com -> reflect?
7. Verbose error: malformed body, sql-like input
```

## GraphQL Test

```bash
# Introspection check (QUIET)
curl -X POST https://<hedef>/graphql -H 'Content-Type: application/json' -d '{"query":"{__schema{types{name fields{name}}}}"}'

# Common queries
- Field suggestion (typo) -> auto-suggest reveal
- Batching: tek POST'ta 1000 query (DoS hazirlik testi)
- Alias overloading
- Deep nesting: { user { friend { friend { ... } } } } depth 10+
```

## JWT Analiz

| Test | Yaklasim |
|------|----------|
| alg: none | Header'i `{"alg":"none","typ":"JWT"}` yap, imzayi sil |
| alg confusion | RS256 -> HS256, public key'i secret olarak kullan |
| kid injection | `kid: ../../../dev/null` (SQL kid varsa SQLi) |
| exp ignore | exp gecmis, server yine de kabul ediyor mu |
| Weak secret | hashcat ile JWT secret crack (offline) |

```bash
# QUIET — decode only (hicbir hedefe istek yok)
echo "<token>" | python3 -c "import sys,jwt; print(jwt.decode(sys.stdin.read().strip(), options={'verify_signature': False}))"
```

## OAuth Flow Test

- redirect_uri tampering: evil.com'a token gonderme
- state parameter eksik -> CSRF
- response_type=token (implicit) hala destekleniyor mu
- PKCE eksik (mobile/SPA icin zorunlu)
- scope creep: minimal scope iste, max scope geldi mi
- Refresh token rotation eksik

## Mass Assignment Test

```http
POST /api/users
Content-Type: application/json

{
  "name": "test",
  "email": "test@example.com",
  "isAdmin": true,           # mass assignment
  "subscription": "premium"  # mass assignment
}
```

Response'da `isAdmin: true` donerse zafiyet var.

## WebSocket

- Origin header validation eksik mi (CSRF-like)
- Authentication tek handshake'te mi (mid-session re-auth?)
- Message size limit
- Binary message + WS Frame manipulation

## Output Sablonu

```markdown
## API Analiz — <baseURL>

### Bulgu
- [HIGH] BOLA in GET /api/orders/{id} — user A, user B siparisini gorebiliyor
- [MEDIUM] GraphQL introspection production'da acik
- [LOW] CORS Origin reflection (sadece null origin)

### Test Edilmemis Alanlar
- BFLA admin endpoint (admin token yok)
- WebSocket /ws — handshake test edilmedi
- Rate limit thresholdu (musteri test penceresi disinda)
```

## Out-of-Scope

- Live brute force (pentest-credentials)
- DDoS via rate limit absent
- Token replay attack saglayan automated tool


---
Source attribution: badi
Original project: https://github.com/aibot88/sec_skill_store/blob/608120788167d56f99e31449e411e603ed250dc6/skills/claudskills/pentest-api/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: badi
Original project: https://github.com/aibot88/sec_skill_store/blob/608120788167d56f99e31449e411e603ed250dc6/skills/claudskills/pentest-api/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering
Roles: Security Engineer, Backend Developer, DevOps / SRE
Specialties: API, Testing
Tools: Tool not specified
Country applicability: Country not specified
Classification basis: Source category, role and specialization labels
Instruction SHA-256: d21ea3f21cd658d0923b80e5e2042a3260a0d72d6e98f125d4a89de982fd8bc5
