Api security misconfiguration

From xalgorix/xalgorix · View interactive version

Api security misconfiguration is an AI agent skill from the GitHub repository xalgorix/xalgorix. Offensive testing for API security misconfigurations including verbose errors, debug endpoints, dangerous methods, CORS, and exposed management interfaces

How to use this skill

Skill file

API Security Misconfiguration (OWASP API8)

Purpose

Test for API-level misconfigurations that expose attack surface, leak information, or enable unauthorized access.

Preconditions

Attack Surface Signals

Methodology

Verbose Error Testing

# Send malformed requests — look for stack traces, SQL errors, internal paths
curl -sk "https://TARGET/api/nonexistent" | jq .
curl -sk -X POST "https://TARGET/api/users" -H "Content-Type: application/json" -d 'invalid'
curl -sk "https://TARGET/api/users?id=' OR 1=1--" | jq .
curl -sk -H "Content-Type: application/xml" -d '<root>' "https://TARGET/api/users" | head -20

Look for: framework names, versions, file paths, database errors, internal hostnames, stack traces.

Debug/Admin Endpoint Discovery

for path in debug status health metrics actuator actuator/env actuator/heapdump \
  _debug __debug admin console management swagger api-docs v1/api-docs \
  graphql playground graphiql redoc api-docs/swagger.json .env config settings; do
  code=$(curl -sk -o /dev/null -w "%{http_code}" "https://TARGET/$path")
  [ "$code" != "404" ] && [ "$code" != "000" ] && echo "[$code] /$path"
done

Dangerous HTTP Methods

# Check which methods are allowed
curl -sk -X OPTIONS -i "https://TARGET/api/users" | grep -i allow

# Try dangerous methods on endpoints that should only accept GET/POST
for method in PUT DELETE PATCH TRACE TRACK; do
  code=$(curl -sk -o /dev/null -w "%{http_code}" -X $method "https://TARGET/api/users")
  [ "$code" != "405" ] && [ "$code" != "404" ] && echo "[$method] $code"
done

CORS Testing

# Check permissive origins
curl -sk -i "https://TARGET/api/users" \
  -H "Origin: https://evil.com" | grep -i "access-control"

# Check credentials with permissive CORS
curl -sk -i "https://TARGET/api/users" \
  -H "Origin: https://evil.com" | grep -iE "access-control-allow-(origin|credentials)"

Evidence requirement: Permissive CORS alone is a misconfiguration, but the finding's severity depends on what data the endpoint returns WITH credentials from another origin. Demonstrate impact.

Content-Type Confusion

# Test alternate content types
curl -sk -H "Content-Type: text/xml" -d '<user><name>test</name></user>' "https://TARGET/api/users"
curl -sk -H "Content-Type: application/xml" -d '{"name":"test"}' "https://TARGET/api/users"
curl -sk -H "Content-Type: multipart/form-data" -F "name=test" "https://TARGET/api/users"

Gateway vs Backend Inconsistencies

# Test if the gateway strips auth but the backend doesn't enforce it
# (or vice versa)
curl -sk "https://TARGET/api/v1/admin/users"          # through gateway
curl -sk "https://TARGET:8080/api/v1/admin/users"     # direct to backend (if port exposed)

Default Credentials

# Common default credential patterns
for cred in "admin:admin" "admin:password" "api:api" "test:test" "user:user"; do
  user=$(echo $cred | cut -d: -f1)
  pass=$(echo $cred | cut -d: -f2)
  code=$(curl -sk -o /dev/null -w "%{http_code}" -u "$user:$pass" "https://TARGET/api/auth/login")
  [ "$code" = "200" ] && echo "[DEFAULT CRED] $cred works"
done

Evidence Contract

Common Misses

False Positives / Non-Findings

Xalgorix Tool Strategy

Stopping Rule

Probe all discovered API paths with all methods, content types, and debug paths. Test CORS on data-bearing endpoints.

Handoff

Report each confirmed misconfiguration with the endpoint, the misconfiguration type, and the concrete impact (data leaked, state changed, or attack surface expanded).

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.