Claude MCP skill SSRF — skill changelog and release notes fetch endpoints

SA-SKL-SSRF39 documents four server-side request forgery vulnerabilities in MCP skill registry skill changelog and release notes fetch endpoints. The changelog sync endpoint fetches a user-supplied URL without hostname validation, allowing the attacker to target the EC2 metadata service and store IAM credentials as changelog content visible to all registry users; the release notes image embed endpoint fetches a user-supplied badge URL without Content-Type validation, allowing an attacker to point it at an internal Prometheus instance and serve raw metric data as badge bytes; the release diff comparison endpoint follows redirects on a user-supplied URL, enabling a CNAME chain to an internal Vault cluster from which KV secrets are returned as diff content; and the release asset download endpoint fetches a user-supplied asset URL and returns its body, allowing an attacker to point it at an internal etcd cluster and return raw key-value data to any user who downloads the asset.

Critical SSRF39-001 — Changelog fetch endpoint fetches user-supplied changelogUrl; attacker sets to 169.254.169.254; IAM credentials stored as changelog content and displayed publicly to all registry users
High SSRF39-002 — Release notes image embed fetches user-supplied imageUrl; attacker sets to internal Prometheus :9090/api/v1/query; metric JSON served as badge image bytes to all skill page viewers
High SSRF39-003 — Release diff comparison fetches user-supplied diffUrl with redirect:follow; attacker controls CNAME to internal Vault; KV secret returned as diff content
High SSRF39-004 — Release asset download fetches user-supplied assetUrl; attacker sets to internal etcd:2379/v3/kv/range; etcd key-value response stored as asset and returned to any user

SSRF39-001 — Changelog fetch SSRF via EC2 metadata endpoint credential theft

MCP skill registries that import changelog data from external repositories accept a changelogUrl field pointing to a raw changelog file. Without hostname validation and DNS-level private IP blocking, an attacker sets changelogUrl to http://169.254.169.254/latest/meta-data/iam/security-credentials/. The registry server fetches the URL from the EC2 instance running the registry service, receives the IAM role name, then fetches the credentials path and stores the full AccessKeyId, SecretAccessKey, and Token as the parsed changelog body. The credential JSON is then indexed, stored, and displayed in the skill’s public changelog tab to all registry viewers.

Vulnerable
// SSRF39-001 — VULNERABLE
router.post('/skills/:id/changelog/sync', requireSession, async (req, res) => {
  const { changelogUrl } = req.body;
  // No hostname validation — attacker sets changelogUrl to 169.254.169.254
  const response = await fetch(changelogUrl);
  const text = await response.text();

  // IAM credential JSON stored as changelog content — publicly displayed
  await db.skillChangelogs.upsert(req.params.id, {
    content: text, // stores AccessKeyId, SecretAccessKey, Token
    syncedAt: new Date(),
  });
  res.json({ synced: true });
});

Allowlist hostnames; block private IP ranges at DNS resolution time: Hostname validation alone is insufficient — DNS rebinding and CNAME chains can resolve an allowed hostname to a private IP after the validation check. Combine a hostname allowlist with a DNS resolver that blocks RFC-1918 addresses (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), link-local addresses (169.254.0.0/16), and loopback (127.0.0.0/8). Set redirect: 'error' to prevent redirect chains that bypass the DNS check.

Fixed
// SSRF39-001 — FIXED
// Hostname allowlist; DNS private-IP block; redirect:error; return only parsed CommonMark text.
const { z } = require('zod');

const CHANGELOG_ALLOWED_HOSTS = new Set([
  'raw.githubusercontent.com',
  'api.github.com',
  'gitlab.com',
  'raw.gitlab.com',
]);

function validateChangelogUrl(urlStr) {
  const url = new URL(urlStr);
  if (!['https:'].includes(url.protocol)) throw new Error('HTTPS only');
  if (!CHANGELOG_ALLOWED_HOSTS.has(url.hostname)) throw new Error('Host not allowed');
  return url;
}

router.post('/skills/:id/changelog/sync', requireSession, async (req, res) => {
  const url = validateChangelogUrl(req.body.changelogUrl); // throws on invalid host
  const response = await fetch(url.toString(), {
    redirect: 'error', // no redirect chains
    signal: AbortSignal.timeout(5000),
  });
  if (!response.ok) return res.status(422).json({ error: 'Fetch failed' });

  const raw = await response.text();
  // Parse as CommonMark — extract plain text only; discard HTML, links, images
  const content = parseChangelogMarkdown(raw); // strips script/iframe/links; plain text + heading structure
  await db.skillChangelogs.upsert(req.params.id, { content, syncedAt: new Date() });
  res.json({ synced: true });
});

SSRF39-002 — Release notes image embed SSRF reaches internal Prometheus metrics endpoint

Release notes pages on skill registries often display badge images embedded by the skill author — CI status, coverage, security grade. The image proxy endpoint GET /api/skills/:id/releases/:ver/badge accepts a user-supplied imageUrl parameter and proxies the response body to the browser. Without Content-Type validation and hostname allowlisting, an attacker sets imageUrl to http://prometheus.internal:9090/api/v1/query?query=up. The registry server fetches the Prometheus query API, receives a JSON metrics response with Content-Type: application/json, and serves it as the badge image bytes to every browser that loads the skill’s release notes page. The metric exposition text reveals internal service names, instance counts, and infrastructure topology.

Vulnerable
// SSRF39-002 — VULNERABLE
router.get('/skills/:id/releases/:ver/badge', async (req, res) => {
  const { imageUrl } = req.query;
  // No hostname check — attacker points to internal Prometheus instance
  const response = await fetch(imageUrl);
  const buffer = await response.arrayBuffer();
  // No Content-Type validation — Prometheus JSON proxied as "image"
  res.set('Content-Type', response.headers.get('content-type') || 'image/svg+xml');
  res.send(Buffer.from(buffer));
});
Fixed
// SSRF39-002 — FIXED
// Badge CDN hostname allowlist; Content-Type: image/* validation; 2 MB size limit.
const BADGE_ALLOWED_HOSTS = new Set([
  'img.shields.io',
  'codecov.io',
  'coveralls.io',
  'badgen.net',
  'flat.badgen.net',
]);

router.get('/skills/:id/releases/:ver/badge', async (req, res) => {
  let url;
  try {
    url = new URL(req.query.imageUrl);
    if (!['https:'].includes(url.protocol)) throw new Error();
    if (!BADGE_ALLOWED_HOSTS.has(url.hostname)) throw new Error();
  } catch {
    return res.status(422).json({ error: 'Invalid badge URL' });
  }

  const response = await fetch(url.toString(), { redirect: 'error', signal: AbortSignal.timeout(5000) });
  const contentType = response.headers.get('content-type') || '';
  if (!contentType.startsWith('image/') && !contentType.includes('svg')) {
    return res.status(422).json({ error: 'Response is not an image' });
  }

  const buffer = await response.arrayBuffer();
  if (buffer.byteLength > 2 * 1024 * 1024) return res.status(422).json({ error: 'Image too large' });

  res.set('Content-Type', 'image/svg+xml'); // normalize to SVG regardless of response header
  res.send(Buffer.from(buffer));
});

SSRF39-003 — Release diff SSRF via CNAME chain to internal Vault secret store

Release diff comparison endpoints that accept a user-supplied diffUrl and follow redirects are vulnerable to CNAME-chain SSRF. An attacker registers a public domain and creates a CNAME record pointing to vault.internal. Because the initial DNS lookup resolves to the public domain’s IP (which passes hostname validation), the fetch client follows the redirect or CNAME chain and ultimately reaches the internal Vault instance at http://vault.internal:8200/v1/secret/data/registry-prod. The Vault response — containing database passwords, API keys, and service credentials — is returned as the “diff content” and stored in the release diff record.

Vulnerable
// SSRF39-003 — VULNERABLE
router.post('/skills/:id/releases/:ver/diff', requireSession, async (req, res) => {
  const { diffUrl } = req.body;
  // redirect:follow enables CNAME chain to vault.internal
  const response = await fetch(diffUrl, { redirect: 'follow' }); // VULNERABLE
  const diff = await response.text();
  // Vault secret JSON stored as diff content
  await db.releaseDiffs.upsert(req.params.id, req.params.ver, { diff, fetchedAt: new Date() });
  res.json({ stored: true });
});
Fixed
// SSRF39-003 — FIXED
// redirect:error; hostname allowlist; infra-level egress rules blocking internal service ports.
const DIFF_ALLOWED_HOSTS = new Set(['raw.githubusercontent.com', 'api.github.com', 'gitlab.com']);

router.post('/skills/:id/releases/:ver/diff', requireSession, async (req, res) => {
  let url;
  try {
    url = new URL(req.body.diffUrl);
    if (!['https:'].includes(url.protocol)) throw new Error();
    if (!DIFF_ALLOWED_HOSTS.has(url.hostname)) throw new Error();
  } catch {
    return res.status(422).json({ error: 'Invalid diff URL' });
  }

  const response = await fetch(url.toString(), {
    redirect: 'error', // no redirects — no CNAME chain exploitation
    signal: AbortSignal.timeout(5000),
  });
  const raw = await response.text();
  const diff = parseDiffOutput(raw); // extract only unified diff lines; discard JSON/HTML
  await db.releaseDiffs.upsert(req.params.id, req.params.ver, { diff, fetchedAt: new Date() });
  res.json({ stored: true });
});

SSRF39-004 — Release asset download SSRF exfiltrates etcd key-value data

Release asset download endpoints that proxy arbitrary URLs to allow downloading release artifacts (compiled binaries, WASM modules, documentation bundles) are vulnerable to SSRF when assetUrl is not validated against an allowlist. An attacker sets assetUrl to http://etcd.internal:2379/v3/kv/range with a JSON body requesting all keys. The registry server proxies the request to the internal etcd cluster, receives a JSON response containing all stored key-value pairs — including service discovery data, feature flags, and configuration secrets — stores them as the “downloaded asset,” and returns them to any user who requests the release asset download.

Vulnerable
// SSRF39-004 — VULNERABLE
router.get('/skills/:id/releases/:ver/asset', requireSession, async (req, res) => {
  const { assetUrl } = req.query;
  // No URL validation — attacker points to etcd:2379
  const response = await fetch(assetUrl);
  const buffer = await response.arrayBuffer();
  // etcd KV JSON returned as "asset" to all authorized users
  res.set('Content-Type', response.headers.get('content-type') || 'application/octet-stream');
  res.set('Content-Disposition', 'attachment');
  res.send(Buffer.from(buffer));
});
Fixed
// SSRF39-004 — FIXED
// Allowlist of known GitHub release and npm CDN domains; extract only parsed field list.
const ASSET_ALLOWED_HOSTS = new Set([
  'github.com',
  'objects.githubusercontent.com',
  'registry.npmjs.org',
  'cdn.jsdelivr.net',
]);

router.get('/skills/:id/releases/:ver/asset', requireSession, async (req, res) => {
  let url;
  try {
    url = new URL(req.query.assetUrl);
    if (!['https:'].includes(url.protocol)) throw new Error();
    if (!ASSET_ALLOWED_HOSTS.has(url.hostname)) throw new Error();
  } catch {
    return res.status(422).json({ error: 'Invalid asset URL' });
  }

  const response = await fetch(url.toString(), {
    redirect: 'error',
    signal: AbortSignal.timeout(10000),
  });
  if (!response.ok) return res.status(422).json({ error: 'Asset fetch failed' });

  const contentType = response.headers.get('content-type') || 'application/octet-stream';
  // Only allow binary and archive content types — no JSON, HTML, text
  const ALLOWED_TYPES = ['application/octet-stream', 'application/zip', 'application/wasm', 'application/gzip'];
  if (!ALLOWED_TYPES.some(t => contentType.startsWith(t))) {
    return res.status(422).json({ error: 'Asset content type not allowed' });
  }

  const buffer = await response.arrayBuffer();
  res.set('Content-Type', 'application/octet-stream');
  res.set('Content-Disposition', `attachment; filename="${encodeURIComponent(url.pathname.split('/').pop())}"`);
  res.send(Buffer.from(buffer));
});

Related advisories: For SSRF in npm package dependency resolution and lockfile fetch endpoints, see SA-SKL-SSRF38. For SSRF in external documentation and README sync endpoints, see SA-SKL-SSRF37. For code injection in dependency vulnerability scanner and patch application endpoints, see SA-SKL-INJECTION27.

Scan your MCP server or Claude skill

SkillAudit checks for SSRF39, SSRF38, CORS, injection, prototype pollution, and 50+ more vulnerability patterns — in 60 seconds, with a shareable grade badge.

Get early access