Claude MCP skill SSRF — skill metadata enrichment and external data source integration endpoints — SA-SKL-SSRF63
SA-SKL-SSRF63 documents four Server-Side Request Forgery vulnerabilities in MCP skill registry metadata enrichment and external data source integration endpoints. Metadata enrichment endpoints allow skill publishers to configure external data sources that the registry fetches to augment skill metadata — adding download statistics, compatibility signals, and license information from third-party sources. SSRF63 identifies four distinct server-side request forgery paths: the metadata enrichment endpoint fetches a user-supplied URL, allowing attackers to retrieve IAM credentials from the cloud metadata service; the data source validation endpoint returns raw response bodies from internal service URLs to callers; the metadata sync endpoint follows redirects including CNAME chains that resolve to internal secrets infrastructure; and the enrichment cache refresh endpoint stores raw HTTP response bodies as enrichment records, enabling persistent internal data exfiltration via the metadata history API.
metadataSourceUrl — attacker sets to 169.254.169.254; IAM credentials embedded in metadata enrichment response returned to caller; fix: allowlist; DNS private-IP block; redirect:error; return only HTTP status booleandataSourceValidationUrl — attacker points to Consul:8500; Consul catalog JSON returned as validation result containing full internal network topology; fix: allowlist; Zod parse only boolean valid; never proxy raw response bodysyncTargetUrl with redirect:follow — CNAME chain to Vault:8200 returns KV secrets as sync result; fix: redirect:error; allowlist; extract only structured sync schemacacheRefreshUrl and stores raw response as enrichment record — attacker points to etcd:2379; etcd configuration data stored persistently as enrichment record readable via metadata history API; fix: allowlist; return only boolean refreshed; never store raw response bodySSRF63-001 — IAM credential exfiltration via metadata source URL
Severity: CRITICAL
The metadata enrichment endpoint accepts a user-supplied metadataSourceUrl parameter that specifies the external data source URL the registry should fetch to augment the skill's metadata. The endpoint uses node-fetch or axios without URL allowlist validation, allowing an attacker to supply the AWS EC2 instance metadata service URL (http://169.254.169.254/latest/meta-data/iam/security-credentials/) or the equivalent for GCP (http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token).
The registry server fetches this URL from its own network context, where the cloud metadata service is reachable. The IAM credentials or OAuth access token returned by the metadata service are then embedded in the metadata enrichment response returned to the caller. The attacker receives temporary cloud credentials with the registry server's IAM role, which may include permissions to read all S3 buckets, describe EC2 instances, or access RDS databases depending on the registry's deployment IAM policy. These credentials are valid for the metadata service's token lifetime (typically one hour) and can be used to pivot to any resource the registry server's role has access to.
Server-side URL fetching without allowlist validation enables SSRF to cloud metadata services. Any endpoint that fetches a user-supplied URL must validate the URL against an explicit allowlist of trusted hostnames before making the request. DNS-based private-IP blocking is insufficient because DNS rebinding can cause the initial DNS resolution to return a public IP, with subsequent requests resolved to a private address. Use an HTTP client with redirect: 'error' and validate the resolved IP against a private-range blocklist before each TCP connection attempt.
// Metadata enrichment — fetches user-supplied URL, returns raw response
router.post('/skills/:id/metadata/enrich', requireSession, async (req, res) => {
const { metadataSourceUrl } = req.body;
// no URL allowlist validation — attacker can supply 169.254.169.254
const response = await fetch(metadataSourceUrl);
const enrichmentData = await response.json();
await Metadata.updateOne({ skillId: req.params.id }, { $set: { enrichment: enrichmentData } });
return res.json({ enrichment: enrichmentData }); // IAM credentials returned to caller
});
// Metadata enrichment — URL allowlist + private-IP block + status-only response
import { URL } from 'url';
import dns from 'dns/promises';
const METADATA_SOURCE_ALLOWLIST = (process.env.METADATA_SOURCE_ALLOWLIST || '').split(',').map(s => s.trim());
const PRIVATE_IP_RANGES = [/^10\./, /^172\.(1[6-9]|2\d|3[01])\./, /^192\.168\./, /^127\./, /^169\.254\./];
async function isSafeUrl(urlString) {
const parsed = new URL(urlString);
if (!METADATA_SOURCE_ALLOWLIST.includes(parsed.hostname)) return false;
const { address } = await dns.lookup(parsed.hostname);
return !PRIVATE_IP_RANGES.some(r => r.test(address));
}
router.post('/skills/:id/metadata/enrich', requireSession, async (req, res) => {
const { metadataSourceUrl } = req.body;
if (!await isSafeUrl(metadataSourceUrl)) {
return res.status(400).json({ error: 'metadataSourceUrl is not in the allowed list' });
}
const response = await fetch(metadataSourceUrl, { redirect: 'error' });
if (!response.ok) return res.json({ enriched: false, status: response.status });
// parse only expected schema fields — never return raw response body
const EnrichSchema = z.object({ license: z.string().optional(), downloads: z.number().int().nonneg().optional() });
const parsed = EnrichSchema.safeParse(await response.json());
if (!parsed.success) return res.json({ enriched: false });
await Metadata.updateOne({ skillId: req.params.id }, { $set: { enrichment: parsed.data } });
return res.json({ enriched: true });
});
SSRF63-002 — Consul catalog leak via data source validation URL
Severity: CRITICAL
The external data source validation endpoint accepts a user-supplied dataSourceValidationUrl and returns the parsed response body as the validation result. An attacker supplies the internal Consul service catalog URL (http://consul.internal:8500/v1/catalog/services). The registry server fetches this URL from within the internal network where Consul is accessible without authentication, and the full Consul catalog JSON — containing the names, addresses, and ports of every internal service — is returned to the attacker as the validation result response body.
The Consul catalog exposes the full internal network topology: service names, instance counts, health check endpoints, and tagged metadata including environment labels and version identifiers. This reconnaissance data enables an attacker to identify high-value targets for subsequent SSRF attacks against specific internal services, understand the registry's deployment architecture, and discover services that are accessible from the registry server's network context but not exposed publicly.
Validation endpoints must never return raw HTTP response bodies from fetched URLs. The purpose of a validation endpoint is to return a boolean indicating whether the data source is reachable and returns expected data. Any endpoint that proxies the raw HTTP response body from a fetched URL is an SSRF exfiltration channel. Return only { valid: boolean } and validate the response body against a strict expected schema before even reading it fully.
// Data source validation — returns raw response body from fetched URL
router.post('/skills/:id/metadata/validate-source', requireSession, async (req, res) => {
const { dataSourceValidationUrl } = req.body;
const response = await fetch(dataSourceValidationUrl);
const body = await response.json();
// returns full Consul catalog if attacker supplies consul:8500
return res.json({ valid: response.ok, details: body });
});
// Data source validation — allowlist + boolean-only response
router.post('/skills/:id/metadata/validate-source', requireSession, async (req, res) => {
const { dataSourceValidationUrl } = req.body;
if (!await isSafeUrl(dataSourceValidationUrl)) {
return res.status(400).json({ error: 'dataSourceValidationUrl is not in the allowed list' });
}
try {
const response = await fetch(dataSourceValidationUrl, {
redirect: 'error',
signal: AbortSignal.timeout(5000),
});
// return only boolean — never proxy response body
return res.json({ valid: response.ok && response.status === 200 });
} catch {
return res.json({ valid: false });
}
});
SSRF63-003 — Vault secret exfiltration via CNAME chain in sync endpoint
Severity: CRITICAL
The metadata sync endpoint fetches a user-supplied syncTargetUrl using an HTTP client configured with redirect: 'follow'. An attacker registers a DNS CNAME chain for a domain they control: the first DNS record resolves to a public IP that returns an HTTP 302 redirect to http://vault.internal:8200/v1/secret/data/registry. Because the HTTP client follows redirects, the registry server follows the redirect chain and fetches the Vault URL from within its internal network where Vault is accessible.
The Vault KV secrets engine returns the registry's stored secrets — including database connection strings, API signing keys, Stripe API keys, and third-party service credentials — as the sync result JSON. This data is returned to the attacker as the sync response body. CNAME-based redirect chains defeat hostname-only allowlist checks because the initial URL being fetched appears to be on an allowlisted domain; only after following the redirect does the fetch reach the internal service. Preventing this attack requires using redirect: 'error' to disable redirect following entirely and validating each request target independently.
HTTP redirect following enables CNAME-based SSRF that bypasses hostname allowlists. An attacker who controls a domain on the allowlist (or exploits subdomain takeover on a previously allowlisted domain) can use an HTTP redirect to route the registry server to any internal service. The only safe mitigation is to disable redirect following entirely with redirect: 'error' and require that sync targets be pre-registered server-side rather than user-supplied at request time.
// Metadata sync — follows redirects, returns raw response as sync result
router.post('/skills/:id/metadata/sync', requireSession, async (req, res) => {
const { syncTargetUrl } = req.body;
// redirect:follow enables CNAME chain to vault:8200
const response = await fetch(syncTargetUrl, { redirect: 'follow' });
const syncResult = await response.json();
await Metadata.updateOne({ skillId: req.params.id }, { $set: { syncData: syncResult } });
return res.json({ synced: true, data: syncResult }); // Vault secrets returned to caller
});
// Metadata sync — allowlist + redirect:error + structured schema extraction
const SyncResultSchema = z.object({
lastModified: z.string().datetime().optional(),
checksum: z.string().regex(/^[a-f0-9]{64}$/).optional(),
version: z.string().optional(),
});
router.post('/skills/:id/metadata/sync', requireSession, async (req, res) => {
const { syncTargetUrl } = req.body;
if (!await isSafeUrl(syncTargetUrl)) {
return res.status(400).json({ error: 'syncTargetUrl is not in the allowed list' });
}
const response = await fetch(syncTargetUrl, {
redirect: 'error', // never follow redirects
signal: AbortSignal.timeout(10000),
});
if (!response.ok) return res.json({ synced: false });
const parsed = SyncResultSchema.safeParse(await response.json());
if (!parsed.success) return res.json({ synced: false });
await Metadata.updateOne({ skillId: req.params.id }, { $set: { syncData: parsed.data } });
return res.json({ synced: true });
});
SSRF63-004 — etcd config persistence via enrichment cache refresh
Severity: HIGH
The enrichment cache refresh endpoint accepts a user-supplied cacheRefreshUrl, fetches its response, and stores the raw response body as a new enrichment record in the metadata history. An attacker supplies the internal etcd v2 API URL (http://etcd.internal:2379/v2/keys/), causing the registry server to fetch the etcd key listing from within its internal network. The raw etcd JSON response — containing the full key-value store configuration including infrastructure parameters, feature flags, and service configuration — is stored as an enrichment record associated with the skill.
Unlike SSRF63-001 through SSRF63-003, which return the exfiltrated data directly in the HTTP response, SSRF63-004 stores the data persistently. The attacker retrieves the etcd configuration by calling the standard metadata history API to list enrichment records for the skill. This persistence mechanism means the attack is not visible in real-time HTTP logs as an unusual response body — it appears as a normal cache refresh followed by a normal metadata history read, with the sensitive data stored in the application database as a legitimate-appearing enrichment record.
Persistent SSRF via stored response bodies is harder to detect than direct exfiltration. Enrichment endpoints that store HTTP response bodies from user-supplied URLs create a persistent SSRF channel: the attacker fetches internal service data in one request and reads it back via the application's own read APIs in a second request. Any endpoint that stores fetched content must validate the response body against a strict schema and store only parsed, structured fields — never raw response bytes or JSON blobs.
// Enrichment cache refresh — stores raw response body as enrichment record
router.post('/skills/:id/metadata/cache-refresh', requireSession, async (req, res) => {
const { cacheRefreshUrl } = req.body;
const response = await fetch(cacheRefreshUrl);
const body = await response.text();
// stores etcd configuration data as enrichment record — readable via metadata history API
await EnrichmentRecord.create({ skillId: req.params.id, source: cacheRefreshUrl, content: body });
return res.json({ refreshed: true });
});
// Enrichment cache refresh — allowlist + status-only response + no raw body storage
router.post('/skills/:id/metadata/cache-refresh', requireSession, async (req, res) => {
const { cacheRefreshUrl } = req.body;
if (!await isSafeUrl(cacheRefreshUrl)) {
return res.status(400).json({ error: 'cacheRefreshUrl is not in the allowed list' });
}
try {
const response = await fetch(cacheRefreshUrl, {
redirect: 'error',
signal: AbortSignal.timeout(5000),
});
// record only the boolean outcome — never store response body
await EnrichmentRecord.create({
skillId: req.params.id,
source: 'cache_refresh',
refreshedAt: new Date(),
success: response.ok,
});
return res.json({ refreshed: response.ok });
} catch {
return res.json({ refreshed: false });
}
});
All four SA-SKL-SSRF63 vulnerabilities reflect a consistent pattern of unrestricted server-side URL fetching in metadata enrichment and data source integration endpoints that extend the registry's metadata with external information. SkillAudit detects SSRF63-001, SSRF63-002, and SSRF63-004 by identifying fetch() or axios.get() calls where the URL argument derives from request body or query parameters without an explicit allowlist check in the same function scope; SSRF63-003 by detecting HTTP client calls with redirect: 'follow' (or no redirect option, which defaults to follow in most libraries) on user-supplied URLs. See also SA-SKL-SSRF62 on notification alert delivery endpoints for the companion chain targeting notification infrastructure SSRF.
SkillAudit detection
SkillAudit's static analysis rules detect all four SSRF63 vulnerability classes during CI pipeline scanning. The unvalidated URL fetch detector flags any fetch(), axios.get(), got(), or superagent.get() call where the first argument is derived from req.body, req.query, or req.params without an intervening allowlist check. The redirect-follow detector flags HTTP client calls that do not explicitly set redirect: 'error' or equivalent on user-supplied URL targets. The raw-body-storage detector flags patterns where the full response body of a fetched URL is stored directly in a database collection without schema validation. All findings include remediation snippets and links to this advisory.