Claude MCP skill SSRF via import webhook and skill manifest URL fetching in skill registry — SA-SKL-SSRF18
MCP skill registries perform server-side HTTP requests at multiple points in the skill lifecycle: fetching the manifest from a developer-supplied URL during import, downloading the skill's icon for local caching, retrieving the npm package homepage for the skill's listing page, and calling the developer's skill endpoint when a user clicks "test this skill." Each of these fetch operations can be redirected to internal infrastructure if the URL is under attacker control. SA-SKL-SSRF18 covers four SSRF entry points across a typical skill registry: manifest URL to EC2 Instance Metadata Service (IMDS), npm homepage to internal Elasticsearch, icon URL to Kubernetes secrets API, and test-skill endpoint to internal Redis.
http://169.254.169.254/latest/meta-data/iam/security-credentials/; registry worker retrieves IAM access key, secret key, and session token from IMDShomepage field in package.json fetched server-side to generate skill landing page preview — attacker package sets homepage: "http://10.0.0.1:9200/_cat/indices"; registry worker fetches internal Elasticsearch, exposing index names and cluster datamanifest.icon) fetched server-side and stored in CDN cache — attacker manifest sets icon: "http://internal-k8s-api:8001/api/v1/secrets"; registry fetches Kubernetes secrets API response and stores it as the skill's icon fileendpointUrl — no SSRF validation; attacker sets endpoint to http://redis-primary:6379/ and sends RESP-formatted commands as request body, triggering Redis commands via HTTPSSRF18-001 — Skill manifest URL fetch to EC2 IMDS
When a developer submits a new skill to the registry via the import webhook, they supply a manifest URL — a JSON file hosted on their server or GitHub that describes the skill's name, version, permissions, and endpoint. The registry worker fetches this URL to validate and store the manifest. If the registry runs on AWS EC2 or ECS, the link-local address 169.254.169.254 provides IAM role credentials with no authentication required. An attacker registers as a developer, sets their manifest URL to the IMDS endpoint, and waits for the registry import worker to fetch it.
// VULNERABLE — skill import worker
async function importSkill(manifestUrl, developerId) {
const response = await fetch(manifestUrl); // <-- no SSRF check
const manifest = await response.json();
await db.skills.insert({ ...manifest, developerId });
}
// Attacker submits: manifestUrl = "http://169.254.169.254/latest/meta-data/iam/security-credentials/app-role"
// Worker fetches → { AccessKeyId: "AKIA...", SecretAccessKey: "...", Token: "..." }
// manifest = { AccessKeyId: "AKIA..." } — stored in skills table as the manifest body
IMDSv2 note: AWS IMDSv2 requires a preliminary PUT request to obtain a session token before the metadata endpoint responds. This mitigates simple GET-based SSRF to IMDS. However, IMDSv2 is not universally enforced — older instances may still respond to IMDSv1 GET requests. Additionally, SSRF18-001 applies equally to other internal endpoints: Kubernetes API servers, internal service mesh control planes, and other HTTP-accessible infrastructure on RFC1918 addresses. Never rely solely on IMDSv2 as the SSRF defense; validate at the fetch point.
The correct defense resolves the manifest URL's hostname to an IP address before fetching and blocks requests whose destination IP falls in private, loopback, or link-local ranges. This DNS-based check must happen after DNS resolution — a custom DNS server can return an internal IP for an external-looking hostname (DNS rebinding).
// FIXED — DNS IP check before fetch
const dns = require('dns').promises;
const ipRangeCheck = require('ip-range-check'); // or manual CIDR check
const BLOCKED_RANGES = [
'10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16', // RFC1918
'127.0.0.0/8', // loopback
'169.254.0.0/16', // link-local (IMDS lives here)
'::1/128', 'fc00::/7', 'fe80::/10' // IPv6 equivalents
];
async function safeManifestFetch(url) {
const parsed = new URL(url);
if (parsed.protocol !== 'https:') {
throw new Error('Manifest URL must use HTTPS');
}
const { address } = await dns.lookup(parsed.hostname);
if (ipRangeCheck(address, BLOCKED_RANGES)) {
throw new Error('Manifest URL resolves to a blocked IP range');
}
// Fetch with no-redirect or validate redirect targets too
const response = await fetch(url, { redirect: 'error' });
return response.json();
}
SSRF18-002 — npm package homepage fetched server-side
MCP skill registry listing pages show a preview of the skill's GitHub repository or documentation homepage. The registry fetches the homepage URL from the skill's package.json field server-side to render an Open Graph preview card. The package.json homepage field is freely set by the package publisher. An attacker publishes an npm package with "homepage": "http://10.0.0.1:9200/_cat/indices" — an internal Elasticsearch endpoint. When the registry worker fetches the homepage to build the preview, it reaches the internal service and returns a JSON response containing index names, document counts, and cluster health data.
// VULNERABLE — skill listing page builder
async function buildSkillListing(packageJson) {
const preview = {};
if (packageJson.homepage) {
// Fetch to get OG tags for the preview card
const html = await fetch(packageJson.homepage).then(r => r.text());
preview.title = extractOgTitle(html);
preview.description = extractOgDescription(html);
}
return { ...packageJson, preview };
}
// package.json with: "homepage": "http://10.0.0.1:9200/_cat/indices?v"
// Worker fetches → ES index list: "health status index pri rep docs.count ..."
// extractOgTitle(elasticsearchResponse) = "" — no OG tags
// But the full ES response body was read by the registry worker process
Detection via response analysis: This SSRF is detectable beyond the initial fetch — if the registry logs HTTP responses for debugging, internal service responses (JSON APIs, plaintext data, non-HTML content types) in the homepage preview log are a signal that SSRF is occurring. Add content-type validation: reject any homepage response that is not text/html before attempting OG tag extraction.
// FIXED — hostname allowlist for homepage fetch
const ALLOWED_HOMEPAGE_HOSTS = new Set([
'github.com', 'gitlab.com', 'bitbucket.org',
'npmjs.com', 'docs.npmjs.com'
]);
async function buildSkillListing(packageJson) {
const preview = {};
if (packageJson.homepage) {
const parsed = new URL(packageJson.homepage);
if (parsed.protocol !== 'https:' || !ALLOWED_HOMEPAGE_HOSTS.has(parsed.hostname)) {
// Skip preview for non-allowlisted URLs; don't fetch
return { ...packageJson, preview: null };
}
const response = await fetch(packageJson.homepage, { redirect: 'error' });
if (!response.headers.get('content-type')?.startsWith('text/html')) {
return { ...packageJson, preview: null };
}
const html = await response.text();
preview.title = extractOgTitle(html);
preview.description = extractOgDescription(html);
}
return { ...packageJson, preview };
}
SSRF18-003 — Skill icon URL fetch to Kubernetes secrets API
Skill manifests include an icon URL for the skill's listing page icon. The registry caches icons locally by fetching the developer-supplied URL and storing the response in object storage or a CDN. The fetch occurs server-side in a worker process. When the registry runs in Kubernetes, the internal Kubernetes API server listens on a well-known port (commonly 8001 when exposed via kubectl proxy, or 443 on the internal service IP). An attacker's manifest sets icon to the Kubernetes secrets API URL. The registry fetches the response — a JSON document containing secret names and values — and stores it in the CDN as the skill's icon file, where it may be publicly accessible or at least accessible to the registry process.
// VULNERABLE — icon caching worker
async function cacheSkillIcon(iconUrl, skillId) {
const response = await fetch(iconUrl); // <-- no validation
const buffer = await response.arrayBuffer();
await cdn.put(`icons/${skillId}.png`, buffer);
return `https://cdn.skillaudit.dev/icons/${skillId}.png`;
}
// manifest.icon = "http://10.96.0.1/api/v1/namespaces/default/secrets"
// Worker fetches → { "kind": "SecretList", "items": [{ "metadata": {"name": "db-credentials"},
// "data": { "password": "BASE64_ENCODED_PASSWORD" } }] }
// Stored as cdn/icons/${skillId}.png — JSON file with secrets
k8s service account auto-mount: Kubernetes pods by default have a service account token mounted at /var/run/secrets/kubernetes.io/serviceaccount/token. Combined with SSRF18-003, an attacker who discovers this token (via a directory traversal or error page) can call the Kubernetes API with the registry worker's service account identity. Set automountServiceAccountToken: false in the registry deployment's pod spec unless the registry explicitly needs to call the k8s API.
// FIXED — DNS IP check + content-type validation for icon fetch
async function cacheSkillIcon(iconUrl, skillId) {
const parsed = new URL(iconUrl);
if (parsed.protocol !== 'https:') throw new Error('Icon URL must use HTTPS');
const { address } = await dns.lookup(parsed.hostname);
if (ipRangeCheck(address, BLOCKED_RANGES)) {
throw new Error('Icon URL resolves to blocked IP range');
}
const response = await fetch(iconUrl, {
redirect: 'error',
signal: AbortSignal.timeout(5000)
});
const contentType = response.headers.get('content-type') || '';
if (!['image/png', 'image/jpeg', 'image/svg+xml', 'image/webp'].some(t => contentType.startsWith(t))) {
throw new Error(`Unexpected content-type for icon: ${contentType}`);
}
const buffer = await response.arrayBuffer();
if (buffer.byteLength > 5 * 1024 * 1024) throw new Error('Icon exceeds 5MB limit');
await cdn.put(`icons/${skillId}`, buffer);
}
SSRF18-004 — Test-skill endpoint to internal Redis
The registry developer console offers a "Test your skill" button that sends a POST request from the registry server to the developer's skill endpoint URL, allowing them to verify the skill responds correctly before publishing. The endpoint URL is supplied by the developer in the skill manifest. With no SSRF validation, an attacker sets their skill endpoint to an internal Redis instance's HTTP management interface or any other internal HTTP-based service. If the request body is also attacker-controlled (the test payload), they can craft RESP (REdis Serialization Protocol) commands inside the HTTP body that Redis interprets when it receives the HTTP request data on its TCP socket — an HTTP-to-RESP smuggling attack on Redis instances with no authentication.
// VULNERABLE — test-skill proxy
app.post('/developer/test-skill', async (req, res) => {
const { endpointUrl, testPayload } = req.body;
const result = await fetch(endpointUrl, { // <-- no SSRF check
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(testPayload)
});
res.json({ status: result.status, body: await result.json() });
});
// Attacker sets:
// endpointUrl = "http://redis-primary.internal:6379/"
// testPayload = crafted to smuggle RESP commands through HTTP body
// FIXED — block RFC1918, loopback, link-local; require HTTPS
async function safeTestSkillFetch(endpointUrl, testPayload) {
const parsed = new URL(endpointUrl);
// Require HTTPS for skill endpoints
if (parsed.protocol !== 'https:') {
throw new Error('Skill endpoint URL must use HTTPS');
}
// DNS IP check
const { address } = await dns.lookup(parsed.hostname);
if (ipRangeCheck(address, BLOCKED_RANGES)) {
throw new Error('Skill endpoint URL resolves to a blocked IP range');
}
// Port check — block non-standard ports that commonly host internal services
const allowedPorts = new Set(['', '443']);
if (!allowedPorts.has(parsed.port)) {
throw new Error('Skill endpoint must use standard HTTPS port 443');
}
return fetch(endpointUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(testPayload),
redirect: 'error',
signal: AbortSignal.timeout(10000)
});
}
Detection summary
| Finding | Severity | Fetch source | Fix |
|---|---|---|---|
| SSRF18-001 | CRITICAL | Manifest import URL | DNS IP check + HTTPS only + no-redirect |
| SSRF18-002 | CRITICAL | npm homepage preview | Hostname allowlist + content-type check |
| SSRF18-003 | CRITICAL | Icon URL cache fetch | DNS IP check + image content-type + 5MB limit |
| SSRF18-004 | HIGH | Test-skill proxy | RFC1918 blocklist + HTTPS + standard port only |
SkillAudit scans MCP skill registry codebases for all four SSRF18 patterns. Any fetch() or axios.get() call where the URL is derived from registry-submitted data (manifest fields, package.json fields, developer console inputs) without a DNS IP check triggers a CRITICAL SSRF finding. See also SA-SKL-SSRF17 for SSRF via PDF generation services and SA-SKL-INJECTION10 for code injection via dynamic module loading in skill runtimes.