← Security advisories

Claude MCP skill SSRF — skill source repository and Git integration endpoints — SA-SKL-SSRF61

SA-SKL-SSRF61 documents four server-side request forgery vulnerabilities in MCP skill registry source repository and Git integration endpoints. Git integration infrastructure processes user-supplied URLs across multiple operations: webhook registration, clone status callbacks, repository synchronization, and ref validation. Each URL-fetching operation is reachable from an authenticated skill publisher account and proxies the internal network response back to the caller, the external webhook target, or persistent storage. SSRF61 covers the full attack surface: IAM credential exfiltration via the webhook registration confirmation response, Consul topology disclosure via the clone status callback, Vault secret exfiltration via CNAME-based redirect chain in the sync endpoint, and persistent etcd data storage via the ref validation record.

SA-SKL-SSRF61 findings at a glance
CRITICALSSRF61-001 — Git webhook registration endpoint fetches user-supplied webhookUrl — attacker sets to 169.254.169.254; IAM credentials embedded in webhook registration confirmation response returned to caller; fix: allowlist; DNS private-IP block; redirect:error; return only HTTP status boolean
CRITICALSSRF61-002 — repository clone status endpoint fetches user-supplied cloneStatusCallbackUrl — attacker points to Consul:8500; Consul catalog JSON returned as clone status confirmation containing full internal network topology; fix: allowlist; Zod parse only boolean completed; never proxy raw response body
CRITICALSSRF61-003 — repository sync endpoint fetches user-supplied syncTargetUrl with redirect:follow — CNAME chain to Vault:8200 returns KV secrets as sync confirmation; CNAME-based rebinding defeats IP-only allowlists; fix: redirect:error; allowlist; extract only structured sync schema
HIGHSSRF61-004 — Git ref validation endpoint fetches user-supplied refValidationUrl and stores raw response as validation record — attacker points to etcd:2379; etcd configuration data stored persistently as ref validation record readable via repo history API; fix: allowlist; return only boolean valid; never store raw response body

SSRF61-001 — IAM credential exfiltration via Git webhook registration URL

Severity: CRITICAL

The Git webhook registration endpoint accepts a webhookUrl parameter and makes an outbound HTTP request to that URL to verify the webhook endpoint is reachable and to deliver a registration confirmation payload. The endpoint returns the HTTP response body from the target URL in the API response to the caller. An attacker registers a webhook pointing to the IMDS endpoint at http://169.254.169.254/latest/meta-data/iam/security-credentials/. The registration request returns the IAM role name, and a second request to the full credentials path returns the AccessKeyId, SecretAccessKey, and Token fields. These credentials are valid for the remaining rotation window (typically 30-60 minutes) and grant access to all IAM-permissioned AWS resources under the registry service account.

Never return raw HTTP response bodies from server-side URL fetches to API callers. Any endpoint that fetches a user-supplied URL and returns the response body is a direct SSRF exfiltration channel for internal metadata services, IMDSv1 endpoints, and cloud provider credential APIs. The confirmation response must be validated and reduced to a structured schema before being returned.

Vulnerable
// POST /api/repos/:id/webhooks — fetches webhookUrl and returns raw response body
router.post('/webhooks', requireSession, async (req, res) => {
  const { webhookUrl, events } = req.body;
  // attacker sets webhookUrl to 169.254.169.254/latest/meta-data/iam/...
  const confirmation = await fetch(webhookUrl, {
    method: 'POST',
    body: JSON.stringify({ event: 'webhook.registered', repoId: req.params.id }),
  });
  const body = await confirmation.json();
  // returns IAM credentials embedded in response from metadata service
  return res.json({ registered: true, confirmation: body });
});
Fixed
// POST /api/repos/:id/webhooks — allowlist + DNS block + boolean confirmation only
const { z } = require('zod');
const dns = require('dns').promises;

const WEBHOOK_ALLOWLIST = /^https:\/\/(hooks\.slack\.com|api\.github\.com|[\w.\-]+\.yourcompany\.com)\//;
const PRIVATE_IP = /^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.|127\.|169\.254\.|::1|fc00:|fe80:)/;

async function isPrivateTarget(url) {
  const { hostname } = new URL(url);
  const addrs = await dns.resolve4(hostname).catch(() => []);
  return addrs.some(ip => PRIVATE_IP.test(ip));
}

const WebhookSchema = z.object({
  webhookUrl: z.string().url().max(500),
  events: z.array(z.enum(['push', 'tag', 'pr'])).min(1),
});

router.post('/webhooks', requireSession, async (req, res) => {
  const parsed = WebhookSchema.safeParse(req.body);
  if (!parsed.success) return res.status(400).json({ error: 'Invalid payload' });

  if (!WEBHOOK_ALLOWLIST.test(parsed.data.webhookUrl)) {
    return res.status(400).json({ error: 'webhookUrl not in allowlist' });
  }
  if (await isPrivateTarget(parsed.data.webhookUrl)) {
    return res.status(400).json({ error: 'webhookUrl resolves to private IP' });
  }

  const resp = await fetch(parsed.data.webhookUrl, {
    method: 'POST',
    redirect: 'error', // block redirect chains
    signal: AbortSignal.timeout(5000),
    body: JSON.stringify({ event: 'webhook.registered', repoId: req.params.id }),
  });

  // return only HTTP status — never proxy response body
  return res.json({ registered: true, webhookStatusCode: resp.status });
});

SSRF61-002 — Consul topology disclosure via clone status callback URL

Severity: CRITICAL

When a skill publisher initiates a repository clone operation, they can supply a cloneStatusCallbackUrl that the registry worker fetches upon clone completion to deliver a status notification. The worker fetches the callback URL and includes the response body in the clone status record. An attacker supplies http://consul:8500/v1/catalog/services as the callback URL. When the clone completes, the worker fetches the Consul API and stores the catalog response — a JSON map of all internal service names and their registered tags — in the clone status record. The attacker retrieves this data via the clone history API, learning the full internal service topology for use in subsequent targeted SSRF attacks against specific internal endpoints.

Vulnerable
// Clone worker — fetches cloneStatusCallbackUrl and stores raw response
async function notifyCloneComplete(cloneJob) {
  if (!cloneJob.callbackUrl) return;
  // attacker supplied http://consul:8500/v1/catalog/services
  const resp = await fetch(cloneJob.callbackUrl, { method: 'POST',
    body: JSON.stringify({ completed: true, repoId: cloneJob.repoId }) });
  const callbackBody = await resp.json(); // contains Consul catalog
  await CloneRecord.findByIdAndUpdate(cloneJob.id, {
    status: 'complete', callbackResponse: callbackBody, // stored and later returned
  });
}
Fixed
// Clone worker — allowlist + return only boolean
async function notifyCloneComplete(cloneJob) {
  if (!cloneJob.callbackUrl) return;

  if (!WEBHOOK_ALLOWLIST.test(cloneJob.callbackUrl)) {
    logger.warn('clone callback URL not in allowlist', { url: cloneJob.callbackUrl });
    return;
  }

  const resp = await fetch(cloneJob.callbackUrl, {
    method: 'POST',
    redirect: 'error',
    signal: AbortSignal.timeout(5000),
    body: JSON.stringify({ completed: true, repoId: cloneJob.repoId }),
  });

  await CloneRecord.findByIdAndUpdate(cloneJob.id, {
    status: 'complete',
    callbackDelivered: resp.ok, // boolean only — never store response body
  });
}

SSRF61-003 — Vault secret exfiltration via CNAME chain in repository sync endpoint

Severity: CRITICAL

The repository sync endpoint accepts a syncTargetUrl parameter pointing to the external system to push sync confirmations to. The fetch() call uses redirect: 'follow'. An attacker registers a DNS CNAME chain: attacker-sync.example.com → CNAME vault → resolves to 10.0.0.5 (internal Vault service). Because the initial URL hostname passes the allowlist check (the registry checks the user-supplied domain, not the final resolved IP), the redirect chain proceeds. The Vault API at the final resolved address returns KV secrets as the sync confirmation body. The API response includes these secrets in the syncConfirmation field. CNAME-based rebinding attacks consistently defeat IP-only allowlist implementations because the IP check is performed before DNS resolution completes.

IP-only allowlists are defeated by CNAME chains. Allowlist checks must be performed after full DNS resolution, not against the user-supplied hostname. Set redirect: 'error' to prevent redirect-based bypass. Re-resolve the final destination IP after each redirect hop and validate it against the private IP blocklist before following.

Vulnerable
// POST /api/repos/:id/sync — follows redirects, checks only initial hostname
router.post('/sync', requireSession, async (req, res) => {
  const { syncTargetUrl } = req.body;
  // allowlist checks syncTargetUrl hostname — but CNAME can redirect to internal
  if (!isTrustedHostname(new URL(syncTargetUrl).hostname)) {
    return res.status(400).json({ error: 'Not allowed' });
  }
  const resp = await fetch(syncTargetUrl, {
    redirect: 'follow', // follows CNAME chain to internal Vault
    method: 'POST',
    body: JSON.stringify({ synced: true, repoId: req.params.id }),
  });
  const syncConfirmation = await resp.json(); // returns Vault KV secrets
  return res.json({ synced: true, syncConfirmation });
});
Fixed
// POST /api/repos/:id/sync — no redirects + DNS resolution check + schema-only response
router.post('/sync', requireSession, async (req, res) => {
  const { syncTargetUrl } = req.body;
  const parsed = z.string().url().max(500).safeParse(syncTargetUrl);
  if (!parsed.success) return res.status(400).json({ error: 'Invalid URL' });

  if (!WEBHOOK_ALLOWLIST.test(parsed.data)) {
    return res.status(400).json({ error: 'syncTargetUrl not in allowlist' });
  }
  if (await isPrivateTarget(parsed.data)) {
    return res.status(400).json({ error: 'syncTargetUrl resolves to private IP' });
  }

  const resp = await fetch(parsed.data, {
    redirect: 'error', // never follow redirects
    method: 'POST',
    signal: AbortSignal.timeout(5000),
    body: JSON.stringify({ synced: true, repoId: req.params.id }),
  });

  // validate response — accept only expected confirmation schema
  const SyncConfirmSchema = z.object({ received: z.boolean() }).strict();
  const body = await resp.json().catch(() => ({}));
  const confirmation = SyncConfirmSchema.safeParse(body);

  return res.json({ synced: resp.ok, confirmed: confirmation.success && confirmation.data.received });
});

SSRF61-004 — Persistent etcd data via Git ref validation URL fetch and storage

Severity: HIGH

The Git ref validation endpoint allows a skill publisher to supply a refValidationUrl pointing to an external service that confirms whether a given ref (branch, tag, or commit) exists in a remote repository. The endpoint fetches the URL and stores the raw response body as the ref validation record in the database. An attacker supplies http://etcd:2379/v3/kv/range as the validation URL. The etcd gRPC-Gateway returns the full key-value store contents as the validation response body. This data — which typically includes internal configuration values, feature flags, service discovery records, and distributed lock state — is stored persistently in the ref validation record and readable by any user who can access the repo history API, including other skill publishers with read access to the same repository.

Vulnerable
// GET /api/repos/:id/refs/validate — fetches refValidationUrl and stores raw response
router.get('/refs/validate', requireSession, async (req, res) => {
  const { ref, refValidationUrl } = req.query;
  // attacker supplies http://etcd:2379/v3/kv/range
  const resp = await fetch(refValidationUrl, { signal: AbortSignal.timeout(5000) });
  const validationBody = await resp.json(); // contains etcd key-value data

  await RefValidation.create({
    repoId: req.params.id, ref,
    validationResponse: validationBody, // stored persistently
    validatedAt: new Date(),
  });

  return res.json({ valid: resp.ok, validation: validationBody }); // also returned to caller
});
Fixed
// GET /api/repos/:id/refs/validate — allowlist + return boolean only + no raw storage
router.get('/refs/validate', requireSession, async (req, res) => {
  const { ref } = req.query;
  const refParsed = z.string().regex(/^[\w.\-\/]{1,200}$/).safeParse(ref);
  if (!refParsed.success) return res.status(400).json({ error: 'Invalid ref' });

  // validate ref against known-good patterns only — no external URL fetch
  const repo = await Repo.findById(req.params.id).select('remoteUrl ownerId');
  if (!repo || repo.ownerId.toString() !== req.session.userId) {
    return res.status(403).json({ error: 'Forbidden' });
  }

  // validate ref exists in the already-registered remote (allowlisted at registration time)
  const isValid = await gitClient.refExists(repo.remoteUrl, refParsed.data);

  await RefValidation.create({
    repoId: req.params.id, ref: refParsed.data,
    valid: isValid, // boolean only — never store raw external response
    validatedAt: new Date(),
  });

  return res.json({ valid: isValid }); // boolean only
});

All four SA-SKL-SSRF61 vulnerabilities reflect a consistent pattern of server-side URL fetching without adequate allowlisting, DNS-resolution-based private IP blocking, redirect prevention, or response body validation in Git integration infrastructure. SkillAudit detects SSRF61-001 by flagging fetch(userSuppliedUrl) calls that return the response body in the API response; SSRF61-002 by detecting user-supplied URL fetch results stored in database records; SSRF61-003 by flagging redirect: 'follow' in combination with allowlist checks performed only on the initial URL; and SSRF61-004 by detecting fetch(req.query.url) patterns where the response is stored. See also SA-SKL-SSRF60 on CI/CD pipeline integration trigger endpoints for the companion chain targeting build pipeline SSRF paths.