← Blog

Claude MCP skill SSRF — webhook configuration and delivery security — SA-SKL-SSRF22

Webhooks are developer-facing push notifications — the registry calls the developer's server when an audit completes. That outbound HTTP call from the registry server is an SSRF vector: if the developer can point the webhook URL at an internal service, the registry server becomes the attacker's HTTP client against its own infrastructure. SA-SKL-SSRF22 covers the four webhook-specific SSRF patterns SkillAudit finds in MCP skill registries: missing SSRF guard at registration, preliminary GET in test delivery, redirect-follow bypass, and URL re-read on retry.

By SkillAudit  |  12 Nov 2026
SA-SKL-SSRF22 findings at a glance
CRITICALSSRF22-001 — Webhook URL stored and later POSTed to without any SSRF guard; attacker sets webhook to http://10.0.0.1:9200/_cat/indices; registry server enumerates Elasticsearch indices on the internal network
CRITICALSSRF22-002 — Webhook test delivery endpoint performs a preliminary GET to the developer-supplied URL to verify reachability; SSRF validation not applied before the GET; attacker probes internal services via the test endpoint
HIGHSSRF22-003 — Webhook delivery follows HTTP redirects with redirect: 'follow'; stored URL is clean at registration time but redirects to an RFC1918 address at delivery time (DNS rebinding or attacker-controlled redirect server)
HIGHSSRF22-004 — Webhook retry logic re-reads the URL from the database on each retry attempt; attacker updates the webhook URL in the interval between the initial failed delivery and the first retry; retry goes to the new (internal) URL

SSRF22-001 — Webhook URL POST with no SSRF guard

When a skill author registers a webhook, they supply a URL that the registry will POST audit results to. The registry stores the URL and fires the HTTP call when an audit completes. Without an SSRF check, the stored URL can point to any IP — including RFC1918 private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), link-local (169.254.0.0/16), and loopback (127.0.0.0/8). The registry server becomes the attacker's HTTP client against its own infrastructure.

Vulnerable
// SSRF22-001 — VULNERABLE
// Webhook URL stored and fired without any SSRF guard.

app.post('/api/skills/:skillId/webhook', authenticate, async (req, res) => {
  const { url } = req.body;
  // VULNERABLE: URL stored without SSRF validation
  await db.saveWebhook(req.params.skillId, { url, userId: req.user.id });
  res.json({ success: true });
});

// Webhook delivery worker — no SSRF check at delivery time either
async function deliverWebhook(skillId, payload) {
  const { url } = await db.getWebhook(skillId);
  // VULNERABLE: fires to whatever URL is stored
  await fetch(url, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(payload),
  });
}

// Attacker registers webhook URL: http://10.0.0.1:9200/_cat/indices
// Registry server POSTs to Elasticsearch admin — response body returned to attacker
// via audit result or error message leak
Fixed
// SSRF22-001 — FIXED
// SSRF guard applied at registration time AND at delivery time.
// DNS resolution + RFC1918/loopback/link-local blocklist.

import dns from 'node:dns/promises';
import net from 'node:net';

const PRIVATE_RANGES = [
  /^127\./, /^10\./, /^192\.168\./,
  /^172\.(1[6-9]|2\d|3[01])\./,
  /^169\.254\./,
  /^::1$/, /^fc/, /^fd/,
];

async function validateWebhookUrl(rawUrl) {
  let url;
  try {
    url = new URL(rawUrl);
  } catch {
    throw new Error('Invalid URL');
  }

  // Fix 1: HTTPS only
  if (url.protocol !== 'https:') throw new Error('Webhook URL must use HTTPS');

  // Fix 2: Resolve DNS and check all returned IPs
  const addresses = await dns.resolve4(url.hostname).catch(() => { throw new Error('DNS resolution failed'); });
  for (const addr of addresses) {
    if (PRIVATE_RANGES.some(r => r.test(addr))) {
      throw new Error('Webhook URL resolves to private address');
    }
  }

  return url;
}

app.post('/api/skills/:skillId/webhook', authenticate, async (req, res) => {
  await validateWebhookUrl(req.body.url); // Fix 3: validate at registration
  await db.saveWebhook(req.params.skillId, { url: req.body.url, userId: req.user.id });
  res.json({ success: true });
});

async function deliverWebhook(skillId, payload) {
  const { url } = await db.getWebhook(skillId);
  await validateWebhookUrl(url); // Fix 4: re-validate at delivery too
  await fetch(url, {
    method: 'POST',
    redirect: 'error',  // Fix 5: never follow redirects
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(payload),
  });
}

Cloud metadata endpoint is a primary target: On AWS, the most valuable SSRF target is http://169.254.169.254/latest/meta-data/iam/security-credentials/ — the EC2 instance metadata service. A single webhook pointing to this URL retrieves the IAM credentials attached to the registry's EC2 instance, granting the attacker full AWS API access with whatever permissions the instance role has. The link-local range 169.254.0.0/16 must be blocked in the SSRF guard regardless of whether the registry runs on AWS.

SSRF22-002 — Test delivery preliminary GET

Some registries offer a "Test Webhook" button that sends a sample payload to the developer's URL to verify it's working. A common implementation performs a preliminary GET to the URL to check reachability before attempting the actual POST. If the SSRF guard is applied only to the POST path and not to the preliminary GET, the test endpoint creates an unauthenticated SSRF probe opportunity.

Vulnerable
// SSRF22-002 — VULNERABLE
// Test delivery performs preliminary GET before SSRF validation.
// Attacker calls the test endpoint to probe internal services.

app.post('/api/skills/:skillId/webhook/test', authenticate, async (req, res) => {
  const { url } = await db.getWebhook(req.params.skillId);

  // VULNERABLE: GET to verify reachability before SSRF check
  let reachable = false;
  try {
    const ping = await fetch(url, { method: 'GET', signal: AbortSignal.timeout(3000) });
    reachable = ping.ok;
  } catch {
    reachable = false;
  }

  if (!reachable) {
    return res.json({ success: false, message: 'URL not reachable' });
  }

  // SSRF check only here — too late, GET already fired
  await validateWebhookUrl(url);
  await deliverWebhook(req.params.skillId, samplePayload);
  res.json({ success: true });
});
Fixed
// SSRF22-002 — FIXED
// SSRF validation before any HTTP call.
// Preliminary GET removed — reachability confirmed by the POST itself.

app.post('/api/skills/:skillId/webhook/test', authenticate, async (req, res) => {
  const { url } = await db.getWebhook(req.params.skillId);

  // Fix 1: SSRF validation BEFORE any network activity
  await validateWebhookUrl(url);

  // Fix 2: No preliminary GET — the POST itself is the reachability test
  try {
    const response = await fetch(url, {
      method: 'POST',
      redirect: 'error',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(samplePayload),
      signal: AbortSignal.timeout(10_000),
    });
    res.json({ success: response.ok, statusCode: response.status });
  } catch (err) {
    res.json({ success: false, message: 'Delivery failed' });
  }
});

SSRF22-003 — Redirect follow to RFC1918

Even when SSRF validation is correctly applied at registration time, a webhook URL that passes the DNS check at registration can redirect to a private address at delivery time. This occurs in two scenarios: DNS rebinding (the attacker's domain has a short TTL; initially resolves to a public IP to pass the registration check; later resolves to 127.0.0.1) or an attacker-controlled redirect server that returns a 302 Location: http://10.0.0.1/. When the delivery code uses redirect: 'follow', it transparently follows the redirect to the private address.

Vulnerable
// SSRF22-003 — VULNERABLE
// Webhook delivery follows redirects unconditionally.
// A clean URL at registration can redirect to RFC1918 at delivery time.

async function deliverWebhook(skillId, payload) {
  const { url } = await db.getWebhook(skillId);
  await validateWebhookUrl(url); // validates against DNS at this moment

  // VULNERABLE: redirect:'follow' — if url returns 302 to 10.x.x.x, fetch follows it
  await fetch(url, {
    method: 'POST',
    redirect: 'follow',   // ← follows Location header without re-validation
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(payload),
  });
}
Fixed
// SSRF22-003 — FIXED
// redirect:'error' prevents following any redirect.
// If a redirect is legitimately needed, re-validate the destination URL.

async function deliverWebhook(skillId, payload) {
  const { url } = await db.getWebhook(skillId);
  await validateWebhookUrl(url);

  const response = await fetch(url, {
    method: 'POST',
    redirect: 'error',    // Fix: never follow — throw on any redirect response
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(payload),
    signal: AbortSignal.timeout(10_000),
  });

  return response;
}

// If redirect support is genuinely needed:
async function deliverWithRedirectCheck(url, payload, maxRedirects = 3) {
  let currentUrl = url;
  for (let i = 0; i <= maxRedirects; i++) {
    await validateWebhookUrl(currentUrl);  // Fix: re-validate on every redirect
    const response = await fetch(currentUrl, {
      method: 'POST',
      redirect: 'manual',  // manual: get redirect response without following
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(payload),
    });
    if (response.status < 300 || response.status >= 400) return response;
    const location = response.headers.get('Location');
    if (!location) throw new Error('Redirect with no Location header');
    currentUrl = new URL(location, currentUrl).toString();
  }
  throw new Error('Too many redirects');
}

SSRF22-004 — URL re-read from DB on retry

Webhook delivery often includes retry logic: if the first delivery attempt fails (network timeout, 5xx response), the worker retries after a delay. A subtle SSRF vector arises when the retry re-reads the webhook URL from the database on each attempt, rather than snapshotting the URL from the initial delivery. An attacker who registered a legitimate webhook URL can update it to an internal address in the interval between the initial failure and the first retry.

Vulnerable
// SSRF22-004 — VULNERABLE
// Webhook retry re-reads URL from DB on each attempt.
// Attacker updates URL between attempts; retry goes to internal address.

async function deliverWithRetry(skillId, payload, attempt = 1) {
  const MAX_ATTEMPTS = 5;
  const { url } = await db.getWebhook(skillId); // ← re-reads from DB on every attempt
  await validateWebhookUrl(url);

  try {
    const response = await fetch(url, {
      method: 'POST',
      redirect: 'error',
      body: JSON.stringify(payload),
    });
    if (!response.ok && attempt < MAX_ATTEMPTS) {
      await sleep(Math.pow(2, attempt) * 1000);
      return deliverWithRetry(skillId, payload, attempt + 1);
      // ← re-reads URL from DB on next call; attacker has updated it in the meantime
    }
  } catch {
    if (attempt < MAX_ATTEMPTS) {
      await sleep(Math.pow(2, attempt) * 1000);
      return deliverWithRetry(skillId, payload, attempt + 1);
    }
  }
}
Fixed
// SSRF22-004 — FIXED
// URL snapshot taken once at first delivery attempt; reused on all retries.
// URL is not re-read from DB on retry — attacker cannot swap it mid-flight.

async function deliverWithRetry(skillId, payload) {
  const MAX_ATTEMPTS = 5;

  // Fix: read and validate URL ONCE before any delivery attempt
  const { url } = await db.getWebhook(skillId);
  await validateWebhookUrl(url);

  // Pass validated URL to inner retry loop — never re-read from DB
  return attemptDelivery(url, payload, 1, MAX_ATTEMPTS);
}

async function attemptDelivery(url, payload, attempt, maxAttempts) {
  try {
    const response = await fetch(url, {
      method: 'POST',
      redirect: 'error',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(payload),
      signal: AbortSignal.timeout(10_000),
    });
    return { success: response.ok, statusCode: response.status };
  } catch {
    if (attempt < maxAttempts) {
      await sleep(Math.pow(2, attempt) * 1000);
      return attemptDelivery(url, payload, attempt + 1, maxAttempts);
      // ← passes same validated URL; never re-reads from DB
    }
    return { success: false, error: 'Max retries exceeded' };
  }
}

Snapshot at job enqueueing, not at worker start: For registries that use a job queue (BullMQ, Agenda) for webhook delivery, the safest approach is to include the validated webhook URL in the job payload itself — snapshotted and validated at the moment the job is enqueued by the API handler. This way the worker never reads the URL from the database, and there is no race window between validation and delivery. This pattern also makes the job idempotent: re-running the job always uses the same URL. See SA-SKL-SSRF21 for SSRF via sandbox execution environments, and SA-SKL-SSRF20 for documentation fetch SSRF.

How SkillAudit detects SA-SKL-SSRF22

SkillAudit's SSRF scanner applies four checks specific to webhook infrastructure:

PatternRoot causeFixSeverity
SSRF22-001Webhook URL POST with no SSRF guard at registration or deliveryDNS check + RFC1918 blocklist at registration AND delivery; HTTPS onlyCRITICAL
SSRF22-002Preliminary GET in test endpoint before SSRF validationValidate first; remove preliminary GET; use POST itself as reachability testCRITICAL
SSRF22-003redirect:'follow' allows redirect to RFC1918 at deliveryredirect:'error'; re-validate on each redirect if follow is requiredHIGH
SSRF22-004URL re-read from DB on retry; attacker swaps URL in race windowSnapshot URL once before first attempt; pass to retry loop without re-readHIGH