Claude MCP skill SSRF — skill documentation and README rendering endpoints — SA-SKL-SSRF47
SA-SKL-SSRF47 documents four server-side request forgery vulnerabilities in MCP skill registry documentation and README rendering endpoints. Documentation infrastructure presents a large SSRF attack surface because rendering pipelines legitimately need to fetch remote resources — images embedded in README markdown, external links previewed in documentation pages, CDN assets for documentation themes, and analytics beacons confirming documentation delivery. When each of these fetch operations trusts user-supplied URLs without an allowlist or private-IP block, the registry server becomes a network proxy into its own internal infrastructure. The four findings cover IAM credential exfiltration via a README image URL pointing at the EC2 metadata service, Consul catalog exposure via a documentation link preview endpoint, Vault KV secret exfiltration via a CNAME redirect in a theme asset fetch, and etcd key enumeration via an analytics beacon endpoint that stores raw HTTP responses as confirmation payloads.
imageUrl in markdown — attacker embeds 169.254.169.254 as image URL; IAM credentials returned in render response; fix: allowlist raw.githubusercontent.com, user-images.githubusercontent.com, camo.githubusercontent.com; DNS private-IP block; redirect:error; return only dimensions and content-typelinkUrl — attacker points to Consul:8500; Consul catalog JSON returned as link preview metadata; fix: allowlist of documentation hosting domains; Zod parse title and description only; never proxy raw bodyassetUrl with redirect:follow — CNAME to Vault returns theme assets as KV secrets; fix: redirect:error; allowlist of CDN hostnames; extract only binary asset bytes, reject JSON and text responsesbeaconUrl — attacker points to etcd:2379; etcd response stored as beacon confirmation; fix: allowlist of analytics domains; return only boolean delivered; never store raw response bodySSRF47-001 — README render endpoint fetches user-supplied imageUrl — IAM credentials exfiltrated via EC2 metadata service
MCP skill registry README rendering pipelines typically accept markdown authored by skill publishers and transform it into HTML for display on the skill detail page. When a README contains an image tag —  — the server-side renderer often pre-fetches the image to validate it exists, check its dimensions, or rehost it through a CDN proxy to avoid mixed-content warnings. In the SSRF47-001 pattern, the renderer accepts the raw imageUrl from the markdown AST and issues a server-side fetch(imageUrl) without validating whether the URL resolves to a public host. An attacker who controls a skill's README embeds http://169.254.169.254/latest/meta-data/iam/security-credentials/ as an image URL. The registry server, running on EC2 or ECS with an attached IAM role, fetches this URL from its own link-local address and receives the IAM role name. A second image URL targeting http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name> returns the full set of temporary credentials — AccessKeyId, SecretAccessKey, and Token — which the renderer stores in the response body as image metadata.
The credentials exfiltrated via SSRF47-001 are the registry server's own IAM credentials, not those of a skill publisher or consumer. The IAM role attached to an MCP skill registry server typically has permissions scoped to the registry's operational needs — read/write access to the S3 bucket storing skill artifacts, DynamoDB access for skill metadata, possibly Secrets Manager access for database connection strings, and ECR pull permissions for container images. Each of these permissions is separately abusable once the attacker holds the temporary credentials. The S3 bucket access allows exfiltration of every skill's source package. The DynamoDB access exposes the full registry user and skill database. The Secrets Manager access may reveal database master passwords or third-party API keys stored as secrets. All of this flows from a single crafted image URL embedded in a skill's README markdown.
The attack is especially dangerous because it requires no special privilege within the registry. Any skill publisher — including those operating on a free tier with minimal vetting — can author a README and submit it for rendering. The rendering pipeline is a standard onboarding flow that is exercised by every new skill publication. There is typically no additional review gate between a skill publisher submitting a README and the server-side renderer fetching its image URLs. The attacker does not need to social-engineer an admin or exploit an authenticated session; they simply publish a skill with a crafted README and read the render response.
SSRF47-001 fix: Before fetching any imageUrl extracted from README markdown, validate the URL against an allowlist of permitted image hosting hostnames: raw.githubusercontent.com, user-images.githubusercontent.com, and camo.githubusercontent.com cover the overwhelming majority of legitimate README images. Resolve the hostname via DNS and reject any resolution that lands in RFC 1918 private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), loopback (127.0.0.0/8), or link-local (169.254.0.0/16) address space. Set redirect: 'error' in node-fetch to prevent open-redirect chains that bypass hostname validation. After fetching, return only the image dimensions and content-type to the render pipeline — never include raw response bytes from an external URL in the render output visible to end users.
// README render endpoint — WRONG: fetches user-supplied imageUrl without allowlist or private-IP block
const { unified } = require('unified');
const remarkParse = require('remark-parse');
const remarkHtml = require('remark-html');
const fetch = require('node-fetch');
router.post('/skills/:id/readme/render', requireSession, async (req, res) => {
const { markdown } = req.body;
const tree = unified().use(remarkParse).parse(markdown);
// collect image nodes and pre-fetch each one for dimension metadata
const imageNodes = [];
visit(tree, 'image', node => imageNodes.push(node));
const imageMeta = {};
for (const node of imageNodes) {
// WRONG: fetches any URL including http://169.254.169.254/latest/meta-data/iam/security-credentials/
const resp = await fetch(node.url);
const body = await resp.text(); // IAM credentials land here
imageMeta[node.url] = { status: resp.status, body, contentType: resp.headers.get('content-type') };
}
const html = unified().use(remarkParse).use(remarkHtml).processSync(markdown).toString();
res.json({ html, imageMeta }); // imageMeta contains raw IAM credential response
});
const fetch = require('node-fetch');
const dns = require('dns').promises;
const { isPrivateIP } = require('./ssrf-guard'); // checks RFC1918/loopback/link-local
const README_IMAGE_ALLOWLIST = new Set([
'raw.githubusercontent.com',
'user-images.githubusercontent.com',
'camo.githubusercontent.com',
]);
async function safeImageFetch(rawUrl) {
let parsed;
try { parsed = new URL(rawUrl); } catch { return null; }
// allowlist check on declared hostname
if (!README_IMAGE_ALLOWLIST.has(parsed.hostname)) return null;
// DNS resolution check — block if any resolved IP is private/loopback/link-local
let addrs;
try { addrs = await dns.resolve4(parsed.hostname); } catch { return null; }
for (const addr of addrs) {
if (isPrivateIP(addr)) return null;
}
// fetch with redirect:error to prevent open-redirect SSRF bypass
const resp = await fetch(rawUrl, {
redirect: 'error',
size: 0, // stream only headers, do not buffer body
timeout: 3000,
});
if (!resp.ok) return null;
const contentType = resp.headers.get('content-type') || '';
if (!contentType.startsWith('image/')) return null;
// return only safe metadata — never the response body
return { contentType, width: null, height: null };
}
router.post('/skills/:id/readme/render', requireSession, async (req, res) => {
const { markdown } = req.body;
const tree = unified().use(remarkParse).parse(markdown);
const imageNodes = [];
visit(tree, 'image', node => imageNodes.push(node));
const imageMeta = {};
for (const node of imageNodes) {
const meta = await safeImageFetch(node.url);
if (meta) imageMeta[node.url] = meta;
// if null, the image node is stripped from render output
}
const html = unified().use(remarkParse).use(remarkHtml).processSync(markdown).toString();
res.json({ html, imageMeta }); // imageMeta contains only content-type, never raw body
});
SSRF47-002 — Documentation link preview endpoint fetches user-supplied linkUrl — Consul catalog exposed as link preview metadata
Documentation pages in MCP skill registries often include a link preview feature that generates rich card-style previews for external links — displaying the page title, description, and thumbnail for links embedded in skill documentation. The preview endpoint receives a linkUrl from the client, fetches the target page server-side to extract Open Graph tags and <title> elements, and returns structured preview metadata. In the SSRF47-002 pattern, the endpoint passes the user-supplied linkUrl directly to fetch() without validating whether the URL is a public documentation host. An attacker submits http://consul.internal:8500/v1/catalog/services as the link URL. The registry server, which shares a network namespace with its Consul service mesh, fetches the Consul HTTP API endpoint and receives the full JSON catalog of registered services — including service names, tags, metadata, and health check addresses for every microservice in the registry's internal infrastructure.
The Consul catalog response returned by SSRF47-002 is a roadmap of the registry's internal service mesh. It enumerates every microservice by name, its registered health check endpoint, its metadata tags (which often include environment names, version strings, and deployment identifiers), and the IP addresses and ports of all registered instances. This information dramatically accelerates lateral movement: the attacker no longer needs to port-scan or enumerate the internal network because Consul has done that work for them and the SSRF endpoint delivers the results in a single request. Services that would otherwise be invisible from the external network — internal admin APIs, database sidecar proxies, secret rotation services, internal metrics endpoints — are all listed in the catalog with their internal addresses, giving the attacker a precise target list for further SSRF requests or for use after gaining initial code execution on any internal host.
The link preview endpoint is particularly dangerous as an SSRF vector because it is designed to return structured data extracted from the response body. Unlike an image fetch that only returns dimensions, the link preview endpoint actively parses and returns content from the fetched URL. Even implementations that attempt to restrict what they return are vulnerable if they parse the response body liberally: an attacker who can point the endpoint at a JSON-returning internal API will receive some portion of that JSON as "title" or "description" fields in the preview metadata, since HTML parsers applied to JSON text often extract text nodes that happen to contain key-value data. A proper fix requires both an allowlist to prevent fetching internal URLs and a strict schema parser that extracts only specific HTML meta tag values from the response.
SSRF47-002 fix: Validate linkUrl against an allowlist of permitted documentation hosting domains before issuing any server-side fetch. Permitted domains should include major documentation platforms (docs.github.com, readthedocs.io, npmjs.com, pkg.go.dev) rather than arbitrary URLs. After fetching, use Zod to parse only title and description fields extracted from HTML <meta> tags — never proxy the raw response body back to the caller, even partially. Apply DNS private-IP blocking on the resolved hostname. Set redirect: 'error' and a short timeout.
// Documentation link preview endpoint — WRONG: fetches user-supplied linkUrl, returns raw body content
router.post('/skills/:id/docs/link-preview', requireSession, async (req, res) => {
const { linkUrl } = req.body;
// WRONG: no allowlist — attacker submits http://consul.internal:8500/v1/catalog/services
const resp = await fetch(linkUrl, { timeout: 5000 });
const body = await resp.text(); // Consul catalog JSON lands here
// naive HTML parse that leaks JSON as "text nodes"
const title = body.match(/<title>([^<]*)<\/title>/i)?.[1] || body.substring(0, 200);
const description = body.match(/<meta[^>]+description[^>]+content="([^"]*)"/i)?.[1] || body.substring(0, 500);
res.json({ title, description, url: linkUrl }); // description may contain Consul catalog data
});
const fetch = require('node-fetch');
const dns = require('dns').promises;
const { z } = require('zod');
const { parse: parseHtml } = require('node-html-parser');
const { isPrivateIP } = require('./ssrf-guard');
const LINK_PREVIEW_ALLOWLIST = new Set([
'docs.github.com', 'github.com', 'raw.githubusercontent.com',
'readthedocs.io', 'npmjs.com', 'pkg.go.dev',
'developer.mozilla.org', 'docs.anthropic.com',
]);
const PreviewSchema = z.object({
title: z.string().max(200).optional(),
description: z.string().max(500).optional(),
});
router.post('/skills/:id/docs/link-preview', requireSession, async (req, res) => {
const { linkUrl } = req.body;
let parsed;
try { parsed = new URL(linkUrl); } catch {
return res.status(400).json({ error: 'invalid URL' });
}
// allowlist check
if (!LINK_PREVIEW_ALLOWLIST.has(parsed.hostname)) {
return res.status(400).json({ error: 'link preview not available for this domain' });
}
// DNS private-IP block
let addrs;
try { addrs = await dns.resolve4(parsed.hostname); } catch {
return res.status(400).json({ error: 'DNS resolution failed' });
}
for (const addr of addrs) {
if (isPrivateIP(addr)) return res.status(400).json({ error: 'forbidden' });
}
const resp = await fetch(linkUrl, { redirect: 'error', timeout: 4000, size: 65536 });
if (!resp.ok) return res.json({ title: null, description: null });
const contentType = resp.headers.get('content-type') || '';
// reject non-HTML responses entirely — never parse JSON/text as preview
if (!contentType.includes('text/html')) return res.json({ title: null, description: null });
const html = await resp.text();
const root = parseHtml(html);
const rawTitle = root.querySelector('title')?.text || root.querySelector('meta[property="og:title"]')?.getAttribute('content');
const rawDesc = root.querySelector('meta[name="description"]')?.getAttribute('content')
|| root.querySelector('meta[property="og:description"]')?.getAttribute('content');
// strict Zod parse — only title and description, length-capped
const preview = PreviewSchema.parse({ title: rawTitle?.trim(), description: rawDesc?.trim() });
res.json(preview); // never raw body, never URL-derived fields
});
SSRF47-003 — Docs theme asset fetch follows redirects — CNAME to Vault returns KV secrets as theme assets
Documentation theme customization in MCP skill registries allows skill publishers to reference external CSS files, fonts, and image assets that are served as part of their documentation page. A theme asset fetch endpoint accepts an assetUrl pointing to a CDN-hosted stylesheet or font file, fetches the asset server-side (to rehost it through the registry's CDN or validate its content), and stores the bytes for serving. In the SSRF47-003 pattern, the endpoint uses redirect: 'follow' in its fetch configuration. An attacker registers a custom domain whose CNAME record points to vault.internal — the registry's internal HashiCorp Vault instance. The endpoint allowlist check passes because the initial URL uses an attacker-controlled public domain that appears legitimate; the redirect follows the CNAME chain to Vault's HTTP API at http://vault.internal:8200/v1/secret/data/registry/db. Vault, which accepts unauthenticated reads for certain KV paths in development configurations or misconfigurations, returns the database connection string as a JSON body that the endpoint stores as a "theme asset."
The CNAME-based SSRF bypass is particularly effective against allowlist implementations that check the hostname in the submitted URL but do not re-validate after DNS resolution. The attacker's domain passes the allowlist check as a superficially plausible CDN hostname. After the check, the fetch call issues the HTTP request and follows the redirect chain, which the operating system's DNS resolver resolves using the CNAME record — bypassing the application-layer allowlist entirely. This class of SSRF bypass is frequently overlooked in security reviews because it requires the attacker to control external DNS, which seems like an elevated prerequisite; in practice, any attacker who can register a domain and configure DNS records can mount this attack against any endpoint that uses redirect: 'follow' without post-redirect hostname re-validation.
The Vault KV secrets returned as "theme assets" include the most sensitive credentials in the registry's infrastructure. Vault is typically the authoritative store for database master passwords, encryption keys, third-party API credentials (Stripe, Twilio, SendGrid), internal service-to-service tokens, and TLS private keys. A single SSRF47-003 request that reaches a permissive Vault path can return credentials sufficient for complete database compromise, payment processor account takeover, or forged authentication tokens that grant admin access to every service in the registry. The impact scales with the breadth of Vault's key-value store, which in a mature registry deployment can represent years of accumulated secrets.
SSRF47-003 fix: Set redirect: 'error' to prevent redirect-chain SSRF bypasses entirely — theme assets must be served directly from their declared URL without redirects. Validate the declared hostname against an allowlist of known CDN providers (unpkg.com, cdn.jsdelivr.net, fonts.gstatic.com, cdnjs.cloudflare.com). Resolve the hostname via DNS and block any private or link-local resolution. After fetching, inspect the response Content-Type header: reject any response with a JSON or text content-type, since legitimate CSS, font, and image assets never return JSON. Store only the raw binary bytes of asset responses that pass all checks.
// Docs theme asset fetch — WRONG: redirect:follow enables CNAME-chain SSRF to Vault
router.post('/skills/:id/docs/theme/asset', requireSession, async (req, res) => {
const { assetUrl } = req.body;
const parsed = new URL(assetUrl);
// allowlist check on declared hostname — bypassed by CNAME redirect to vault.internal
if (!THEME_ASSET_ALLOWLIST.has(parsed.hostname)) {
return res.status(400).json({ error: 'forbidden' });
}
// WRONG: redirect:follow — follows CNAME chain to vault.internal after allowlist passes
const resp = await fetch(assetUrl, { redirect: 'follow', timeout: 5000 });
const buffer = await resp.buffer(); // Vault KV JSON lands here
await db.storeThemeAsset(req.params.id, assetUrl, buffer); // Vault secrets stored as "theme asset"
res.json({ ok: true, bytes: buffer.length });
});
const fetch = require('node-fetch');
const dns = require('dns').promises;
const { isPrivateIP } = require('./ssrf-guard');
const THEME_ASSET_CDN_ALLOWLIST = new Set([
'unpkg.com', 'cdn.jsdelivr.net',
'fonts.gstatic.com', 'fonts.googleapis.com',
'cdnjs.cloudflare.com', 'cdn.skypack.dev',
]);
const ASSET_CONTENT_TYPE_ALLOWLIST = ['text/css', 'font/', 'image/', 'application/font'];
function isPermittedAssetContentType(ct) {
return ASSET_CONTENT_TYPE_ALLOWLIST.some(prefix => ct.startsWith(prefix));
}
router.post('/skills/:id/docs/theme/asset', requireSession, async (req, res) => {
const { assetUrl } = req.body;
let parsed;
try { parsed = new URL(assetUrl); } catch {
return res.status(400).json({ error: 'invalid URL' });
}
// allowlist on declared hostname
if (!THEME_ASSET_CDN_ALLOWLIST.has(parsed.hostname)) {
return res.status(400).json({ error: 'asset host not in CDN allowlist' });
}
// DNS resolution — block CNAME chains that resolve to private IPs
let addrs;
try { addrs = await dns.resolve4(parsed.hostname); } catch {
return res.status(400).json({ error: 'DNS resolution failed' });
}
for (const addr of addrs) {
if (isPrivateIP(addr)) return res.status(400).json({ error: 'forbidden' });
}
// redirect:error — prevents CNAME-chain SSRF bypass entirely
const resp = await fetch(assetUrl, {
redirect: 'error', // any redirect is an error — no CNAME chain bypass possible
timeout: 5000,
size: 1024 * 1024, // 1 MB max for theme assets
});
if (!resp.ok) return res.status(400).json({ error: 'asset fetch failed' });
const contentType = resp.headers.get('content-type') || '';
// reject JSON and plain-text responses — Vault, Consul, etcd all return these
if (!isPermittedAssetContentType(contentType)) {
return res.status(400).json({ error: 'asset content-type not permitted' });
}
const buffer = await resp.buffer();
await db.storeThemeAsset(req.params.id, assetUrl, buffer);
res.json({ ok: true, bytes: buffer.length });
});
SSRF47-004 — Docs analytics beacon endpoint fetches user-supplied beaconUrl — etcd data stored as beacon confirmation
Documentation analytics in MCP skill registries track page views, time-on-page, and scroll depth for skill documentation pages. Some implementations use a server-side beacon confirmation pattern: the client-side analytics script sends a beaconUrl to a registry endpoint, which fetches the URL server-side to confirm the beacon was delivered to the analytics provider, then stores the confirmation response. In the SSRF47-004 pattern, the endpoint accepts an arbitrary beaconUrl and fetches it without an allowlist. An attacker submits http://etcd.internal:2379/v3/kv/range as the beacon URL. The registry server fetches the etcd HTTP API endpoint and receives a JSON response containing key-value pairs from the etcd cluster — which typically stores distributed configuration, service discovery data, Kubernetes cluster state (if the registry runs on Kubernetes), and leader election records. The etcd response is then stored in the registry's database as a "beacon confirmation payload."
The etcd data exposed by SSRF47-004 is architecturally significant because etcd is the single source of truth for distributed state in Kubernetes-based deployments. If the MCP skill registry runs on Kubernetes, the etcd cluster stores every Kubernetes object — Deployments, Services, Secrets, ConfigMaps, ServiceAccounts, and RBAC policies — as serialized protobuf values accessible via the HTTP API. A single etcd key range query can return base64-encoded Kubernetes Secret objects containing database credentials, TLS certificates, and service account tokens. Even in non-Kubernetes deployments, etcd commonly stores distributed locks, feature flag configurations, and service mesh configuration that reveals the registry's internal architecture in detail sufficient to plan a targeted attack.
SSRF47-004 fix: Validate beaconUrl against an allowlist of known analytics provider domains (analytics.google.com, api.segment.io, api.mixpanel.com, api.amplitude.com) before issuing any server-side fetch. Apply DNS private-IP blocking on the resolved address. After fetching, discard the response body entirely — return only a boolean delivered: true to the caller. Never store raw HTTP response bodies from external fetch operations as confirmation payloads, regardless of the content; the confirmation record should contain only a timestamp, a status code, and the allowlisted beacon domain, not the response body from an arbitrary URL.
// Docs analytics beacon — WRONG: fetches user-supplied beaconUrl and stores raw response body
router.post('/skills/:id/docs/beacon', requireSession, async (req, res) => {
const { beaconUrl, pageId, sessionId } = req.body;
// WRONG: no allowlist — attacker submits http://etcd.internal:2379/v3/kv/range
const resp = await fetch(beaconUrl, { method: 'POST', timeout: 3000 });
const confirmation = await resp.json(); // etcd KV range response lands here
// stores raw etcd response body as "beacon confirmation"
await db.storeBeaconConfirmation({ skillId: req.params.id, pageId, sessionId, beaconUrl, confirmation });
res.json({ ok: true });
});
const fetch = require('node-fetch');
const dns = require('dns').promises;
const { isPrivateIP } = require('./ssrf-guard');
const BEACON_ALLOWLIST = new Set([
'analytics.google.com', 'www.google-analytics.com',
'api.segment.io', 'cdn.segment.com',
'api.mixpanel.com', 'api.amplitude.com',
'api.posthog.com',
]);
router.post('/skills/:id/docs/beacon', requireSession, async (req, res) => {
const { beaconUrl, pageId, sessionId } = req.body;
let parsed;
try { parsed = new URL(beaconUrl); } catch {
return res.status(400).json({ error: 'invalid beacon URL' });
}
// allowlist on analytics provider domains
if (!BEACON_ALLOWLIST.has(parsed.hostname)) {
return res.status(400).json({ error: 'beacon host not in analytics allowlist' });
}
// DNS private-IP block
let addrs;
try { addrs = await dns.resolve4(parsed.hostname); } catch {
return res.status(400).json({ error: 'DNS resolution failed' });
}
for (const addr of addrs) {
if (isPrivateIP(addr)) return res.status(400).json({ error: 'forbidden' });
}
let delivered = false;
try {
const resp = await fetch(beaconUrl, {
method: 'POST',
redirect: 'error',
timeout: 3000,
size: 0, // consume no response body
});
delivered = resp.ok;
// body is explicitly NOT read or stored
resp.body.destroy();
} catch {
delivered = false;
}
// store only safe confirmation metadata — never raw response body
await db.storeBeaconConfirmation({
skillId: req.params.id,
pageId,
sessionId,
beaconDomain: parsed.hostname, // allowlisted domain only, not full URL
delivered,
confirmedAt: new Date().toISOString(),
});
// return only boolean — no response content that could encode SSRF output
res.json({ delivered });
});
SkillAudit scans for SSRF in README image fetch pipelines, documentation link preview endpoints, theme asset CDN fetchers, and analytics beacon confirmation handlers — including CNAME-redirect bypass patterns, missing private-IP DNS blocking, and raw-response-body storage that leaks internal service data across all documentation and rendering sub-routers in your MCP skill registry codebase.
Scan your registry| Finding | Severity | Endpoint | Impact |
|---|---|---|---|
| SSRF47-001 | CRITICAL | POST /skills/:id/readme/render | IAM credential exfiltration via EC2 metadata service using user-supplied imageUrl in README markdown |
| SSRF47-002 | CRITICAL | POST /skills/:id/docs/link-preview | Consul catalog JSON exposed as link preview metadata via user-supplied linkUrl |
| SSRF47-003 | CRITICAL | POST /skills/:id/docs/theme/asset | Vault KV secrets exfiltrated as theme asset bytes via CNAME redirect bypass with redirect:follow |
| SSRF47-004 | HIGH | POST /skills/:id/docs/beacon | etcd key-value data stored as beacon confirmation payload via user-supplied beaconUrl |
See also: SA-SKL-SSRF46 (badge generation and embedding endpoint SSRF patterns) and SA-SKL-SSRF45 (audit report export and download endpoint SSRF patterns) for related server-side request forgery chains that compound with documentation rendering SSRF to enable full internal network enumeration from MCP skill registry infrastructure.