← Security advisories

Claude MCP skill SSRF — skill badge generation and embedding endpoints — SA-SKL-SSRF46

SA-SKL-SSRF46 documents four SSRF vulnerabilities in MCP skill registry badge generation and embedding endpoints. Badge and embed systems are particularly SSRF-prone because their core function is fetching external resources — icons, preview images, themes, destination URLs — and embedding or proxying that content in generated output. Each fetch operation is a potential SSRF vector if the URL is not strictly validated before the HTTP request is issued from the server. SSRF46-001 fetches a user-supplied badge icon URL allowing cloud IMDS credential exfiltration. SSRF46-002 fetches a user-supplied embed preview URL returning internal service topology. SSRF46-003 fetches a user-supplied theme URL with redirect following, reaching Vault KV secrets. SSRF46-004 fetches a user-supplied redirect URL for click verification, returning internal etcd data.

SA-SKL-SSRF46 findings at a glance
CRITICALSSRF46-001 — Badge generation fetches user-supplied badgeIconUrl — attacker sets to 169.254.169.254; IAM credentials embedded as badge icon bytes in SVG response; fix: allowlist; DNS private-IP block; redirect:error; use pre-uploaded icon only
CRITICALSSRF46-002 — Embed preview fetches user-supplied previewUrl — attacker points to Consul:8500; Consul catalog JSON returned as embed preview content; fix: allowlist of known preview hosting domains; Zod parse only preview metadata; never proxy external URL body
CRITICALSSRF46-003 — Badge theme fetch follows user-supplied themeUrl with redirect:follow — CNAME to Vault returns theme as KV secret; fix: redirect:error; allowlist; extract only CSS color tokens; sandbox theme rendering
HIGHSSRF46-004 — Badge click tracking fetches user-supplied redirectUrl to verify destination — attacker points to etcd:2379; etcd response stored as redirect verification result; fix: allowlist; return only boolean valid and destination domain; never store raw response body

SSRF46-001 — IAM credential exfiltration via badge icon URL fetch

The badge generation endpoint fetches the user-supplied badgeIconUrl parameter to embed a custom icon in the generated SVG badge. When no URL allowlist is applied, an attacker can set badgeIconUrl=http://169.254.169.254/latest/meta-data/iam/security-credentials/ (AWS IMDS) or the equivalent cloud provider metadata endpoint. The registry server fetches the URL from within the VPC, the IMDS responds with IAM role credentials, and those credential bytes are embedded as the icon content in the returned SVG badge — delivered directly to the attacker in the HTTP response.

SSRF46-001 fix: Replace user-supplied URL fetch with a pre-upload flow: users upload their badge icon to a presigned S3 URL first, then reference the resulting asset path. For badge generation itself, only accept asset paths from your own CDN domain (assets.skillaudit.dev). Never fetch arbitrary external URLs server-side during badge rendering. If external icon fetch is required, apply a strict hostname allowlist (e.g., raw.githubusercontent.com, shields.io), block all private IP ranges via DNS resolution validation, and set redirect:error.

WRONG
router.post('/skills/:id/badge/generate',
  requireSession,
  async (req, res) => {
    const iconBytes = await fetch(req.body.badgeIconUrl).then(r => r.arrayBuffer());
    // IAM credentials are now in iconBytes if badgeIconUrl = 169.254.169.254/...
    const svg = await generateBadge({ iconBytes, ...req.body });
    res.type('image/svg+xml').send(svg);
  }
);
RIGHT
const ICON_HOSTNAME_ALLOWLIST = new Set(['assets.skillaudit.dev', 'raw.githubusercontent.com']);

async function safeIconFetch(iconUrl) {
  const parsed = new URL(iconUrl);
  if (!ICON_HOSTNAME_ALLOWLIST.has(parsed.hostname)) {
    throw new Error('icon URL hostname not in allowlist');
  }
  // DNS resolution check for private IP ranges
  const addrs = await dns.promises.resolve4(parsed.hostname);
  for (const addr of addrs) {
    if (isPrivateIP(addr)) throw new Error('icon URL resolves to private IP');
  }
  return fetch(iconUrl, { redirect: 'error' }).then(r => r.arrayBuffer());
}

router.post('/skills/:id/badge/generate',
  requireSession,
  async (req, res) => {
    const iconBytes = await safeIconFetch(req.body.badgeIconUrl);
    const svg = await generateBadge({ iconBytes, ...req.body });
    res.type('image/svg+xml').send(svg);
  }
);

SSRF46-002 — Consul topology exfiltration via embed preview URL fetch

The embed preview endpoint fetches the user-supplied previewUrl to generate an embed preview card showing the target page's content. Without URL validation, an attacker can point previewUrl to http://consul:8500/v1/catalog/services. The registry server fetches the Consul catalog from within the internal network, and the resulting JSON payload — containing the full list of internal services, their addresses, and health status — is returned as the embed preview content to the attacker. This provides a full map of the internal service topology with no authentication required from the internal Consul instance.

SSRF46-002 fix: Apply a strict hostname allowlist limited to known embed preview hosting domains. Never proxy the raw response body — instead, parse only the metadata fields you need (title, description, thumbnail URL) using a Zod schema, and return only those structured fields in the preview response. Use a dedicated preview metadata service (or rely on client-side Open Graph parsing) rather than server-side URL fetch.

// WRONG — raw response body proxied; Consul catalog returned as preview
const preview = await fetch(req.body.previewUrl).then(r => r.json());
res.json(preview); // internal service topology if previewUrl = consul:8500/v1/catalog/services

// RIGHT — allowlist + Zod metadata extraction; never proxy raw response body
const PREVIEW_HOSTNAME_ALLOWLIST = new Set(['github.com', 'npmjs.com', 'pkg.go.dev']);
const parsed = new URL(req.body.previewUrl);
if (!PREVIEW_HOSTNAME_ALLOWLIST.has(parsed.hostname)) {
  return res.status(400).json({ error: 'preview URL hostname not allowed' });
}
const raw = await fetch(req.body.previewUrl, { redirect: 'error' }).then(r => r.text());
const metadata = PreviewMetadataSchema.parse(extractOpenGraph(raw)); // title/description/image only
res.json(metadata); // structured metadata, never the raw response body

SSRF46-003 — Vault secret exfiltration via badge theme URL with redirect following

The badge theme fetch endpoint fetches a user-supplied themeUrl with redirect:follow (the default behavior of most HTTP clients). An attacker registers a DNS record for a controlled domain that is an alias (CNAME) to the internal Vault instance (vault.internal:8200). The registry server resolves the DNS entry at the time of the HTTP request, follows the alias, and fetches from Vault's KV secrets API. The Vault response — containing sensitive application secrets — is then processed as CSS theme data and returned to the attacker.

The redirect-follow vector is particularly dangerous because it bypasses allowlist checks performed only at the initial URL hostname. The initial URL passes hostname validation; the redirect target does not receive the same validation because the HTTP client follows redirects transparently. Setting redirect:error (or redirect:'error' in node-fetch) prevents the HTTP client from following any redirect, eliminating this bypass entirely.

SSRF46-003 fix: Set redirect:'error' on all server-side theme fetch requests. Apply a hostname allowlist before making the request. After fetching, parse the response body with a strict CSS color token regex — accept only hex color codes and named CSS colors, reject any response that is not a valid CSS color palette. Sandbox theme rendering to prevent CSS injection attacks from theme content.

SSRF46-004 — etcd data exfiltration via badge click tracking redirect verification

The badge click tracking system fetches the user-supplied redirectUrl to verify that the redirect destination is reachable before storing the click event. Without URL validation, an attacker can supply redirectUrl=http://etcd:2379/v2/keys/. The registry server fetches from etcd's HTTP API, and the response — containing application configuration keys stored in etcd — is stored as the redirect verification result. The attacker then reads the stored result via the click analytics API, extracting the etcd data.

SSRF46-004 fix: Replace server-side destination verification with DNS resolution only: resolve the hostname, check it does not resolve to a private IP, and return a boolean reachability result. Never store the raw HTTP response body from a user-supplied URL. If redirect destination validation is required, use a client-side verification flow or limit the check to returning the HTTP status code only.

// WRONG — raw etcd response stored as redirect verification result
const verifyResult = await fetch(req.body.redirectUrl).then(r => r.json());
await db.storeClickVerification(skillId, req.body.redirectUrl, verifyResult);
// attacker reads verifyResult via analytics API → etcd configuration keys exfiltrated

// RIGHT — DNS resolution only; boolean result; never store raw response body
const ALLOWED_REDIRECT_HOSTNAMES = new Set(['github.com', 'npmjs.com', 'skillaudit.dev']);
async function verifyRedirectDestination(url) {
  const parsed = new URL(url);
  if (!ALLOWED_REDIRECT_HOSTNAMES.has(parsed.hostname)) return { valid: false, reason: 'hostname not allowed' };
  const addrs = await dns.promises.resolve4(parsed.hostname).catch(() => []);
  if (addrs.some(isPrivateIP)) return { valid: false, reason: 'resolves to private IP' };
  return { valid: true, domain: parsed.hostname };
}
const result = await verifyRedirectDestination(req.body.redirectUrl);
await db.storeClickVerification(skillId, req.body.redirectUrl, result); // only {valid, domain}
Detect SA-SKL-SSRF46 in your registry

SkillAudit scans for server-side fetch calls on user-supplied URL parameters in badge generation, embed preview, theme fetch, and click verification endpoints — including redirect-following fetch calls and raw response body proxying patterns — across all badge and embedding sub-routers in your MCP skill registry codebase.

Scan your registry
FindingSeverityVectorImpact
SSRF46-001CRITICALbadgeIconUrl fetch to cloud IMDSIAM credentials embedded as icon bytes in SVG badge response delivered to attacker
SSRF46-002CRITICALpreviewUrl fetch to Consul:8500Consul catalog JSON (full internal service topology) returned as embed preview content
SSRF46-003CRITICALthemeUrl fetch with redirect:follow via CNAME to VaultVault KV secrets returned as theme data; redirect bypass defeats hostname allowlist
SSRF46-004HIGHredirectUrl verification fetch to etcd:2379etcd configuration data stored as click verification result; readable via analytics API

See also: SA-SKL-SSRF45 (audit report export and download SSRF patterns) for the same IMDS, Consul, Vault, and etcd target patterns in report generation endpoints.