Deep-dive API security analysis (REST, GraphQL, WebSocket, gRPC, OAuth, Cache)
From perseusnpx claudepluginhub kaivyy/perseus --plugin perseusThis skill uses the workspace's default tool permissions.
Designs and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Enables AI agents to execute x402 payments with per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents pay for APIs, services, or other agents.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
IMPORTANT: This skill performs deep API security analysis on the user's own codebase. This is defensive security testing to find API vulnerabilities before production deployment.
Authorization: The user owns this codebase and has explicitly requested this specialized analysis.
| Language | Frameworks |
|---|---|
| JavaScript/TypeScript | Express, Fastify, Nest.js, Next.js API, Hono, Bun |
| Go | Gin, Echo, Fiber, Chi, net/http |
| PHP | Laravel, Symfony, Slim, Lumen |
| Python | FastAPI, Django REST, Flask, Starlette |
| Rust | Actix-web, Axum, Rocket, Warp |
| Java | Spring Boot, Quarkus, Micronaut |
| Ruby | Rails API, Sinatra, Grape |
| C# | ASP.NET Core, Minimal APIs |
This specialist skill performs comprehensive API security analysis covering OWASP API Security Top 10 plus advanced attack vectors.
When to Use: After /scan identifies API endpoints (REST, GraphQL, WebSocket, gRPC).
Goal: Deep-dive into API-specific vulnerabilities that generic scans might miss.
| Mode | Specialist Behavior |
|---|---|
PRODUCTION_SAFE | Static/code-path validation and minimal non-disruptive checks only |
STAGING_ACTIVE | Active endpoint verification with strict throttling |
LAB_FULL | Broad dynamic API verification in isolated lab |
LAB_RED_TEAM | Controlled attack-chain simulation on synthetic/test data only |
deliverables/engagement_profile.md before running active checks.PRODUCTION_SAFE.ABORTED-SAFETY if kill-switch thresholds are exceeded.| ID | Vulnerability | Description |
|---|---|---|
| API1 | Broken Object Level Authorization | IDOR, accessing other users' resources |
| API2 | Broken Authentication | Weak auth, token issues |
| API3 | Broken Object Property Level Authorization | Mass assignment, excessive data exposure |
| API4 | Unrestricted Resource Consumption | Missing rate limits, DoS vectors |
| API5 | Broken Function Level Authorization | Admin functions accessible to users |
| API6 | Unrestricted Access to Sensitive Business Flows | Automation abuse, scraping |
| API7 | Server Side Request Forgery | SSRF via API parameters |
| API8 | Security Misconfiguration | CORS, headers, debug mode |
| API9 | Improper Inventory Management | Shadow APIs, deprecated endpoints |
| API10 | Unsafe Consumption of APIs | Third-party API trust issues |
| Category | Vulnerabilities |
|---|---|
| GraphQL | Introspection, batching, depth attacks, alias DoS, field suggestions |
| WebSocket | Origin bypass, message injection, auth on upgrade, CSWSH |
| OAuth/OIDC | Token leakage, PKCE bypass, redirect URI manipulation, state fixation |
| Cache | Cache poisoning, cache deception, key injection, web cache DoS |
| gRPC | Reflection enabled, missing auth, message size limits |
deliverables/engagement_profile.md.deliverables/verification_scope.md if present.PRODUCTION_SAFE, keep checks passive-first and low-rate.BOLA/IDOR Analyst:
Language-Specific Patterns:
// Node.js/Express - VULNERABLE
app.get('/orders/:id', async (req, res) => {
const order = await Order.findById(req.params.id); // No owner check
});
// Go/Gin - VULNERABLE
func GetOrder(c *gin.Context) {
id := c.Param("id")
order, _ := db.FindOrder(id) // No owner check
}
// PHP/Laravel - VULNERABLE
public function show($id) {
return Order::find($id); // No owner check
}
# Python/FastAPI - VULNERABLE
@app.get("/orders/{order_id}")
async def get_order(order_id: int):
return await Order.get(order_id) # No owner check
// Rust/Actix - VULNERABLE
async fn get_order(path: web::Path<i32>) -> impl Responder {
Order::find(path.into_inner()) // No owner check
}
Mass Assignment Analyst:
Language-Specific Patterns:
// Node.js - VULNERABLE
User.findByIdAndUpdate(id, req.body); // All fields accepted
// Go - VULNERABLE
c.ShouldBindJSON(&user) // Binds all fields including Role
// PHP/Laravel - VULNERABLE (without $fillable)
$user->update($request->all());
# Python/Django - VULNERABLE
serializer = UserSerializer(user, data=request.data)
// Rust/Serde - VULNERABLE
let user: User = serde_json::from_str(&body)?; // All fields
Rate Limiting Analyst:
Framework Rate Limiters to Check:
express-rate-limit@fastify/rate-limitgolang.org/x/time/rate, ulule/limiterThrottleRequestsslowapi, Django django-ratelimitactix-limitation, tower::limitResponse Data Analyst:
If GraphQL detected:
Introspection Analyst:
Disable Introspection:
// Apollo Server
new ApolloServer({ introspection: false });
// gqlgen
srv.AroundOperations(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler {
if graphql.GetOperationContext(ctx).Operation.Operation == "introspection" { return nil }
})
# Strawberry
schema = strawberry.Schema(query=Query, subscription=Subscription, config=StrawberryConfig(auto_camel_case=True))
Query Complexity Analyst:
DoS Patterns:
# Depth attack
{ user { friends { friends { friends { friends { name } } } } } }
# Alias attack
{ a1: user(id:1) { name } a2: user(id:2) { name } ... a1000: user(id:1000) { name } }
# Batching attack
[{ "query": "{ user(id:1) { name } }" }, { "query": "{ user(id:2) { name } }" }, ...]
Resolver Authorization Analyst:
Field Suggestion Analyst:
Subscription Security Analyst:
Subscription Vulnerabilities:
# Subscription without auth check
subscription {
orderUpdated { id status userId } # Can subscribe to any user's orders?
}
# Subscription flooding
subscription { messageAdded { content } } # No rate limiting?
Patterns to Check:
// Apollo Server - VULNERABLE
const resolvers = {
Subscription: {
orderUpdated: {
subscribe: () => pubsub.asyncIterator(['ORDER_UPDATED'])
// No auth check - anyone can subscribe
}
}
};
// Apollo Server - SAFE
const resolvers = {
Subscription: {
orderUpdated: {
subscribe: withFilter(
() => pubsub.asyncIterator(['ORDER_UPDATED']),
(payload, variables, context) => {
// Verify user owns the resource
return payload.orderUpdated.userId === context.user.id;
}
)
}
}
};
# Strawberry - Check subscription auth
@strawberry.type
class Subscription:
@strawberry.subscription
async def order_updated(self, info: Info) -> AsyncGenerator[Order, None]:
# Is info.context.user checked?
Persisted Queries Analyst:
Bypass Patterns:
// Attempt to send raw query when only persisted should be allowed
{ "query": "{ __schema { types { name } } }" }
// Try extensions field
{ "extensions": { "persistedQuery": { "sha256Hash": "..." } }, "query": "{ malicious }" }
If WebSocket detected:
WebSocket Auth Analyst:
Patterns to Check:
// Node.js/ws - Check upgrade auth
wss.on('connection', (ws, req) => {
// Is token validated here?
});
// Go/Gorilla - Check upgrade auth
func wsHandler(w http.ResponseWriter, r *http.Request) {
conn, _ := upgrader.Upgrade(w, r, nil) // Auth check?
}
WebSocket Origin Analyst:
Vulnerable Pattern:
// VULNERABLE - No origin check
const wss = new WebSocket.Server({ server });
// SAFE - Origin validated
wss.on('headers', (headers, req) => {
if (!allowedOrigins.includes(req.headers.origin)) {
throw new Error('Invalid origin');
}
});
WebSocket Message Analyst:
If OAuth detected:
OAuth Flow Analyst:
Issues to Find:
Token Security Analyst:
Redirect URI Analyst:
Bypass Techniques:
https://evil.com#@legitimate.com
https://legitimate.com.evil.com
https://legitimate.com%2F@evil.com
https://legitimate.com/callback/../../../evil
Cache Poisoning Analyst:
Patterns:
Cache Deception Analyst:
Vulnerable Pattern:
GET /api/account/settings.css HTTP/1.1
# If cached, attacker can retrieve victim's data
Check:
CL.TE Smuggling Analyst:
Attack Pattern:
POST / HTTP/1.1
Host: vulnerable.com
Content-Length: 13
Transfer-Encoding: chunked
0
SMUGGLED
Framework Considerations:
http-proxy, express-http-proxygunicorn, uvicorn behind nginxTE.CL Smuggling Analyst:
Attack Pattern:
POST / HTTP/1.1
Host: vulnerable.com
Content-Length: 3
Transfer-Encoding: chunked
8
SMUGGLED
0
HTTP/2 Downgrade Analyst:
Issues:
Patterns to Check:
// Check for reverse proxy configurations
// nginx, HAProxy, AWS ALB, Cloudflare
// Vulnerable: Different interpretation between frontend/backend
// Frontend: HTTP/2 → Backend: HTTP/1.1
CORS Analyst:
Framework-Specific:
// Express - VULNERABLE
app.use(cors({ origin: true, credentials: true }));
// Go - VULNERABLE
c.Writer.Header().Set("Access-Control-Allow-Origin", r.Header.Get("Origin"))
// Laravel - VULNERABLE
'allowed_origins' => ['*'],
'supports_credentials' => true,
# FastAPI - VULNERABLE
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_credentials=True)
API Versioning Analyst:
gRPC Security Analyst:
Create deliverables/api_security_analysis.md:
# API Security Analysis
## Summary
| Category | Endpoints | Critical | High | Medium |
|----------|-----------|----------|------|--------|
| REST | X | Y | Z | W |
| GraphQL | X | Y | Z | W |
| WebSocket | X | Y | Z | W |
| OAuth | X | Y | Z | W |
| gRPC | X | Y | Z | W |
## Language/Framework Detected
- Primary: [e.g., Node.js/Express, Go/Gin, PHP/Laravel]
- API Types: REST, GraphQL, WebSocket
## Critical Findings
### [API-001] BOLA in Order Retrieval
**Severity:** Critical
**Endpoint:** `GET /api/orders/{orderId}`
**Framework:** Express.js
**Location:** `controllers/order.js:45`
**Vulnerable Code:**
[Language-specific vulnerable code]
**Remediation:**
[Language-specific fix]
---
## GraphQL Security
| Check | Status | Risk |
|-------|--------|------|
| Introspection | ENABLED | High |
| Query Depth Limit | NONE | High |
| Complexity Limit | NONE | High |
| Batching Limit | NONE | Medium |
## WebSocket Security
| Endpoint | Origin Check | Auth on Upgrade | Message Validation |
|----------|--------------|-----------------|-------------------|
| /ws | None | None | None | CRITICAL |
## OAuth Security
| Issue | Status |
|-------|--------|
| State Parameter | Missing |
| PKCE | Not Implemented |
| Redirect URI Validation | Weak |
## Cache Security
| Issue | Vulnerable | Location |
|-------|------------|----------|
| Cache Poisoning | Yes | X-Forwarded-Host |
| Cache Deception | Yes | /api/* |
## Rate Limiting Status
| Endpoint | Limit | Status |
|----------|-------|--------|
| POST /login | None | VULNERABLE |
| POST /reset-password | None | VULNERABLE |
## CORS Configuration
| Origin | Credentials | Status |
|--------|-------------|--------|
| * | true | CRITICAL |
## Recommendations
1. Implement object-level authorization on all resource endpoints
2. Add rate limiting to authentication endpoints
3. Disable GraphQL introspection in production
4. Validate WebSocket Origin header
5. Implement PKCE for OAuth flows
Next Step: Findings feed into /exploit for verification or /report for documentation.