Claude MCP skill SSRF — skill documentation generation and API schema export webhook endpoints (SA-SKL-SSRF85)
SA-SKL-SSRF85 identifies four server-side request forgery vulnerabilities in MCP skill registry skill documentation generation and API schema export webhook endpoints. The documentation build callback endpoint fetches a publisher-supplied docBuildCallbackUrl without validating the target address — pointing this URL at 169.254.169.254/latest/meta-data/iam/security-credentials/ returns the registry server's AWS IAM role credentials including AccessKeyId, SecretAccessKey, and session token in the callback response body; the API schema export webhook endpoint fetches a publisher-supplied schemaExportWebhookUrl and returns the response as the webhook acknowledgment body — pointing this at consul.internal:8500/v1/catalog/services returns the full internal service catalog; the documentation delivery endpoint follows HTTP redirects on a publisher-supplied docDeliveryUrl — a CNAME chain pointing this domain to vault.internal:8200/v1/secret/data/registry returns Vault KV secrets through the redirect chain; and the API schema export endpoint fetches a publisher-supplied schemaExportUrl and stores the raw response body as a schema record in the database — pointing this at etcd.internal:2379/v2/keys/ stores the full etcd key-value store in a schema record that is then readable by any publisher via the documentation history API.
docBuildCallbackUrl — attacker sets to 169.254.169.254; IAM credentials in documentation build callback response bodyschemaExportWebhookUrl — attacker points to Consul:8500; full service catalog as schema export webhook acknowledgment bodydocDeliveryUrl with redirect:follow — CNAME chain to Vault:8200 returns KV secretsschemaExportUrl and stores raw response as schema record — attacker points to etcd:2379; etcd config stored persistently via documentation history APISSRF85-001 — docBuildCallbackUrl fetches IMDS returning IAM credentials
The documentation generation pipeline triggers a callback to a publisher-supplied URL after each documentation build completes, delivering the build result payload to the publisher's CI system. The callback URL is stored as part of the skill's documentation webhook configuration and is fetched server-side by the registry worker. Without URL validation, an attacker registers docBuildCallbackUrl: "http://169.254.169.254/latest/meta-data/iam/security-credentials/registry-role". When the next documentation build completes for that skill, the registry worker fetches this URL and receives the AWS IMDS response containing the full IAM role credentials — AccessKeyId, SecretAccessKey, and Token — which are included in the callback response body that the registry returns to the caller. The attacker now has valid AWS credentials with the full permissions of the registry-role IAM identity.
// SSRF85-001 — VULNERABLE
router.post('/skills/:id/docs/build/complete',
requireInternalBuildToken,
async (req, res) => {
const webhookConfig = await db.getDocWebhookConfig(req.params.id);
if (webhookConfig.docBuildCallbackUrl) {
// No URL validation — SSRF to 169.254.169.254 returns IAM credentials
const callbackResp = await fetch(webhookConfig.docBuildCallbackUrl, {
method: 'POST',
body: JSON.stringify(req.body),
headers: { 'Content-Type': 'application/json' }
});
const callbackBody = await callbackResp.json();
res.json({ delivered: true, callbackResponse: callbackBody });
}
}
);
// SSRF85-001 — FIXED: assertSafeExternalUrl; redirect:error; return only statusCode
const { assertSafeExternalUrl } = require('../lib/ssrf-guard');
router.post('/skills/:id/docs/build/complete',
requireInternalBuildToken,
async (req, res) => {
const webhookConfig = await db.getDocWebhookConfig(req.params.id);
if (webhookConfig.docBuildCallbackUrl) {
assertSafeExternalUrl(webhookConfig.docBuildCallbackUrl);
const callbackResp = await fetch(webhookConfig.docBuildCallbackUrl, {
method: 'POST',
body: JSON.stringify({ buildId: req.body.buildId, status: req.body.status }),
headers: { 'Content-Type': 'application/json' },
redirect: 'error' // never follow redirects
});
// Never return response body — only status code
res.json({ delivered: true, callbackStatusCode: callbackResp.status });
}
}
);
IMDS at 169.254.169.254 returns short-lived credentials that are immediately usable. An attacker with these credentials can enumerate all S3 buckets, read secrets from Secrets Manager, and invoke Lambda functions — all with the registry server's full IAM permissions. assertSafeExternalUrl() must block link-local ranges (169.254.0.0/16), loopback (127.0.0.0/8), and RFC-1918 private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16). Never return response bodies from webhook callbacks.
SSRF85-002 — schemaExportWebhookUrl fetches Consul service catalog
The API schema export pipeline delivers the exported schema to a publisher-supplied webhook URL, returning the HTTP response body as the webhook acknowledgment that the registry stores for audit purposes. Without URL validation, an attacker registers schemaExportWebhookUrl: "http://consul.internal:8500/v1/catalog/services". When the schema export job completes, the registry fetches this URL and receives the full Consul service catalog response — every internal service name, its registered health check addresses, and the port numbers each service listens on. This response is stored as the webhook acknowledgment body in the database and is readable by the attacker via the registry's schema export history API, giving them a complete map of the registry's internal service mesh.
// SSRF85-002 — VULNERABLE
router.post('/skills/:id/schema/export/complete',
requireInternalExportToken,
async (req, res) => {
const exportConfig = await db.getSchemaExportConfig(req.params.id);
if (exportConfig.schemaExportWebhookUrl) {
// No URL validation — SSRF to Consul:8500 exposes service catalog
const webhookResp = await fetch(exportConfig.schemaExportWebhookUrl, {
method: 'POST',
body: JSON.stringify(req.body.schemaData),
headers: { 'Content-Type': 'application/json' }
});
const ackBody = await webhookResp.json();
await db.storeWebhookAck(req.params.id, ackBody);
res.json({ delivered: true });
}
}
);
// SSRF85-002 — FIXED: assertSafeExternalUrl; HEAD-only; return only statusCode
const { assertSafeExternalUrl } = require('../lib/ssrf-guard');
router.post('/skills/:id/schema/export/complete',
requireInternalExportToken,
async (req, res) => {
const exportConfig = await db.getSchemaExportConfig(req.params.id);
if (exportConfig.schemaExportWebhookUrl) {
assertSafeExternalUrl(exportConfig.schemaExportWebhookUrl);
// HEAD probe only — never send body, never read response body
const probeResp = await fetch(exportConfig.schemaExportWebhookUrl, {
method: 'HEAD',
redirect: 'error'
});
await db.storeWebhookAck(req.params.id, {
url: exportConfig.schemaExportWebhookUrl,
probeStatusCode: probeResp.status,
probedAt: new Date()
});
res.json({ delivered: true, webhookStatusCode: probeResp.status });
}
}
);
Webhook delivery acknowledgments should never store the response body from the target URL. The acknowledgment proves delivery — a status code is sufficient. Any response body is attacker-controlled data that may contain sensitive information exfiltrated from internal services. HEAD requests prevent response bodies from being transmitted at all, eliminating the data exfiltration channel even if URL validation has a bypass.
SSRF85-003 — docDeliveryUrl with redirect:follow enables CNAME chain to Vault
The documentation delivery pipeline fetches a publisher-supplied docDeliveryUrl to retrieve rendered documentation from an external CDN and cache it locally. The fetch is performed with redirect: 'follow' to handle CDN redirects. An attacker registers a documentation delivery URL pointing to a domain they control, then configures that domain's DNS with a CNAME record pointing to vault.internal. When the registry server resolves the DNS and follows the resulting CNAME chain, it makes an HTTP request directly to the internal Vault service at port 8200. Vault's unauthenticated /v1/sys/health endpoint reveals version and seal status; paths like /v1/secret/data/registry return KV secrets if the network allows unauthenticated access from internal hosts. The registry's response includes the full Vault response body.
// SSRF85-003 — VULNERABLE: redirect:follow enables CNAME chain SSRF
router.post('/skills/:id/docs/deliver',
requireSession,
requireSkillOwnerRole,
async (req, res) => {
const { docDeliveryUrl } = req.body;
// redirect:follow traverses CNAME chains to internal services
const docResp = await fetch(docDeliveryUrl, { redirect: 'follow' });
const docContent = await docResp.text();
await db.cacheDocumentation(req.params.id, docContent);
res.json({ cached: true, size: docContent.length });
}
);
// SSRF85-003 — FIXED: assertSafeExternalUrl; redirect:error; return only statusCode
const { assertSafeExternalUrl } = require('../lib/ssrf-guard');
router.post('/skills/:id/docs/deliver',
requireSession,
requireSkillOwnerRole,
async (req, res) => {
const { docDeliveryUrl } = req.body;
assertSafeExternalUrl(docDeliveryUrl);
// redirect:error — never follow redirects that could resolve to internal addresses
const docResp = await fetch(docDeliveryUrl, { redirect: 'error' });
if (!docResp.ok) return res.status(422).json({ error: 'doc delivery URL unreachable' });
// Only store status code — never the response body from an external URL
await db.recordDocDelivery(req.params.id, {
url: docDeliveryUrl,
statusCode: docResp.status,
deliveredAt: new Date()
});
res.json({ recorded: true, statusCode: docResp.status });
}
);
CNAME-based SSRF bypasses IP-level blocklists because the initial URL looks external. DNS-level validation — resolving the hostname and checking the resulting IP against the blocklist before the HTTP request is made — catches CNAME chains. redirect: 'error' prevents mid-flight redirects from changing the target after the initial DNS check. Both defenses together are required; either alone is bypassable.
SSRF85-004 — schemaExportUrl stores etcd config persistently via documentation history API
The API schema export endpoint allows publishers to specify a schemaExportUrl from which the registry fetches the OpenAPI schema for the skill, storing the response body as the canonical schema record in the database. Without URL validation, an attacker sets schemaExportUrl: "http://etcd.internal:2379/v2/keys/?recursive=true". The registry fetches this URL and receives the full etcd key-value store dump — including service discovery configurations, feature flag overrides, database connection strings with credentials, and internal certificate material. This response is stored as the schema record in the database and is immediately readable by the attacker via the documentation history API, which is accessible to all authenticated publishers. Unlike the other SSRF findings, this one persists the exfiltrated data into the application database, making it readable indefinitely until the schema record is manually purged.
// SSRF85-004 — VULNERABLE: response body stored as schema record
router.post('/skills/:id/schema/import',
requireSession,
requireSkillOwnerRole,
async (req, res) => {
const { schemaExportUrl } = req.body;
// No URL validation — SSRF to etcd:2379 stores internal config in DB
const schemaResp = await fetch(schemaExportUrl);
const schemaContent = await schemaResp.text();
await db.storeSchemaRecord(req.params.id, {
content: schemaContent,
sourceUrl: schemaExportUrl,
importedAt: new Date()
});
res.json({ imported: true, size: schemaContent.length });
}
);
// SSRF85-004 — FIXED: assertSafeExternalUrl; HEAD-only; store only URL and probeStatusCode
const { assertSafeExternalUrl } = require('../lib/ssrf-guard');
router.post('/skills/:id/schema/import',
requireSession,
requireSkillOwnerRole,
async (req, res) => {
const { schemaExportUrl } = req.body;
assertSafeExternalUrl(schemaExportUrl);
// HEAD probe only — verify URL is reachable without reading response body
const probeResp = await fetch(schemaExportUrl, {
method: 'HEAD',
redirect: 'error'
});
await db.storeSchemaRecord(req.params.id, {
sourceUrl: schemaExportUrl,
probeStatusCode: probeResp.status,
importedAt: new Date()
// content: intentionally omitted — never store body from external URLs
});
res.json({ recorded: true, probeStatusCode: probeResp.status });
}
);
SSRF that writes to a database is worse than SSRF that returns a response — it persists the exfiltrated data for anyone with database read access. Never store response bodies from publisher-supplied URLs. If the schema content genuinely needs to be fetched, do it in a sandboxed process that validates the content against an OpenAPI schema definition before writing any data to the database, and enforce a strict content-type allowlist (application/json, application/yaml only).
SkillAudit checks for all SA-SKL-SSRF vulnerability patterns including IMDS credential exfiltration via callback URLs, internal service catalog exposure via webhook endpoints, CNAME-chain SSRF through redirect following, and persistent SSRF via database-stored response bodies. Get a graded report with line-level code fixes in 60 seconds.
Get a free audit