Claude MCP skill SSRF — CI/CD pipeline webhook and build trigger endpoints (SA-SKL-SSRF81)
SA-SKL-SSRF81 identifies four server-side request forgery vulnerabilities in MCP skill registry skill CI/CD pipeline webhook and build trigger endpoints. The CI pipeline webhook delivery endpoint fetches a caller-supplied pipelineWebhookUrl from the registry server without validating the target host; an attacker registers a webhook pointing to the EC2 instance metadata endpoint at 169.254.169.254, and the resulting IAM role credentials appear in the webhook delivery response body which the registry stores as pipeline execution history. The build trigger callback endpoint fetches a caller-supplied buildCallbackUrl and returns its body as the build trigger acknowledgment payload; an attacker points this URL to a Consul agent on the internal network, receiving the full service catalog as the acknowledgment body. The pipeline status notification endpoint fetches a caller-supplied statusNotificationUrl with redirect:follow enabled; an attacker constructs a CNAME chain resolving to the Vault server on port 8200, and the notification delivery returns the Vault KV secret engine's raw key-value response. The build artifact export endpoint fetches a caller-supplied artifactExportUrl and stores the raw response body as a build record in the registry's build history table; an attacker points this URL to an etcd node on port 2379, and the etcd configuration data persists indefinitely as a queryable build artifact.
pipelineWebhookUrl — attacker sets to 169.254.169.254; IAM credentials in pipeline webhook delivery response bodybuildCallbackUrl — attacker points to Consul:8500; full service catalog as build trigger acknowledgment bodystatusNotificationUrl with redirect:follow — CNAME chain to Vault:8200 returns KV secretsartifactExportUrl and stores raw response as build record — attacker points to etcd:2379; etcd config stored persistently via build history APISSRF81-001 — Pipeline webhook SSRF leaks IAM credentials via IMDS
The CI pipeline webhook delivery worker makes a POST request to the URL registered by the skill author as the pipeline event delivery target. No validation is performed on the target hostname before the request is dispatched. An attacker registers http://169.254.169.254/latest/meta-data/iam/security-credentials/ as the pipelineWebhookUrl for their skill's pipeline configuration. When the registry triggers a pipeline event (build start, build complete, test failure), the worker fetches this URL and receives the IAM role name. A second fetch to the full credentials path returns a JSON document containing AccessKeyId, SecretAccessKey, and Token. The worker logs the response body and stores it in the pipeline execution record, making the credentials accessible to any user with read access to that skill's pipeline history.
// SSRF81-001 — VULNERABLE
async function deliverPipelineWebhook(skillId, event) {
const pipeline = await db.getPipelineConfig(skillId);
// No host validation — pipelineWebhookUrl fetched directly
const response = await fetch(pipeline.pipelineWebhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(event)
});
const responseBody = await response.text();
await db.recordPipelineDelivery(skillId, event.id, response.status, responseBody);
}
// SSRF81-001 — FIXED: host allowlist + private IP block + return status code only
const { URL } = require('url');
const dns = require('dns').promises;
const PRIVATE_IP_RE = /^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.|127\.|169\.254\.|::1|fc00:|fe80:)/;
async function validateWebhookUrl(rawUrl) {
const url = new URL(rawUrl);
if (url.protocol !== 'https:') throw new Error('webhook_url_must_be_https');
const { address } = await dns.lookup(url.hostname);
if (PRIVATE_IP_RE.test(address)) throw new Error('webhook_url_private_ip_blocked');
return url;
}
async function deliverPipelineWebhook(skillId, event) {
const pipeline = await db.getPipelineConfig(skillId);
const url = await validateWebhookUrl(pipeline.pipelineWebhookUrl);
const response = await fetch(url.toString(), {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(event),
redirect: 'error' // no redirects
});
// Store only the status code — never the response body
await db.recordPipelineDelivery(skillId, event.id, response.status);
}
SSRF81-002 — Build callback SSRF returns Consul service catalog
The build trigger endpoint accepts a buildCallbackUrl parameter that the registry server fetches after recording the build trigger event, returning the response body as the acknowledgment payload to the calling client. An attacker submits a build trigger request with buildCallbackUrl set to http://consul.internal:8500/v1/catalog/services. The registry server fetches this internal Consul API endpoint and receives the full service catalog JSON document, which is then returned directly in the HTTP response body of the build trigger API call. This exposes the internal service topology, including service names, tags, and metadata for every service registered in the Consul cluster.
// SSRF81-002 — VULNERABLE
router.post('/skills/:id/ci/build/trigger', requireSession, async (req, res) => {
const { buildCallbackUrl, buildArgs } = req.body;
const buildId = await buildQueue.enqueue({ skillId: req.params.id, buildArgs });
// Fetches buildCallbackUrl and echoes body back to caller
const ack = await fetch(buildCallbackUrl);
const ackBody = await ack.json();
res.json({ buildId, acknowledgment: ackBody }); // leaks internal service response
});
// SSRF81-002 — FIXED: private IP block; return build ID only; no callback body reflection
router.post('/skills/:id/ci/build/trigger', requireSession, async (req, res) => {
const { buildCallbackUrl } = req.body;
if (buildCallbackUrl) {
await validateWebhookUrl(buildCallbackUrl); // throws on private IP
// Deliver async notification — never reflect response body
setImmediate(() => notifyBuildCallback(buildCallbackUrl, buildId));
}
const buildId = await buildQueue.enqueue({
skillId: req.params.id,
buildArgs: {} // never accept caller-supplied buildArgs
});
res.json({ buildId }); // return only the build ID
});
SSRF81-003 — Status notification CNAME chain reaches Vault KV secrets
The pipeline status notification endpoint fetches a caller-supplied statusNotificationUrl with the HTTP client configured to follow redirects. The registry's internal DNS resolver resolves an attacker-controlled domain whose CNAME chain ultimately resolves to vault.internal:8200. Because the final hop is an HTTPS redirect to the Vault API, and the HTTP client follows redirects without re-validating the resolved IP address at each hop, the client fetches the Vault KV secret engine endpoint. The response includes raw secret key-value pairs that the registry worker deserializes and stores as the notification delivery confirmation record, persisting internal secrets in the pipeline history table.
// SSRF81-003 — VULNERABLE: redirect:follow allows CNAME chain to internal services
async function sendStatusNotification(skillId, statusUrl, status) {
const response = await fetch(statusUrl, {
method: 'POST',
redirect: 'follow', // follows CNAME chain to vault.internal:8200
body: JSON.stringify({ status, skillId }),
headers: { 'Content-Type': 'application/json' }
});
const confirmation = await response.json();
await db.recordNotificationDelivery(skillId, response.status, confirmation);
}
// SSRF81-003 — FIXED: DNS validation after each redirect; redirect:error; no body storage
async function sendStatusNotification(skillId, statusUrl, status) {
const url = await validateWebhookUrl(statusUrl); // DNS check at registration time
const response = await fetch(url.toString(), {
method: 'POST',
redirect: 'error', // reject any redirect
signal: AbortSignal.timeout(5000),
body: JSON.stringify({ status, skillId }),
headers: { 'Content-Type': 'application/json' }
});
// Record only delivery status — never the response body
await db.recordNotificationDelivery(skillId, response.status);
}
SSRF81-004 — Artifact export SSRF persists etcd configuration via build history
The build artifact export endpoint fetches a caller-supplied artifactExportUrl and stores the raw response body as a build artifact record associated with the build job ID. An attacker submits an artifact export request with artifactExportUrl pointing to http://etcd.internal:2379/v3/kv/range with an appropriate gRPC-Gateway body for a full keyspace range query. The registry fetches this URL and stores the response — which contains the full etcd key-value store dump including cluster configuration, service credentials, and bootstrap secrets — as a build artifact record. This artifact is then queryable through the standard build history API by any user with read access to that skill's pipeline, and may persist indefinitely if the artifact retention policy does not expire it.
// SSRF81-004 — VULNERABLE: stores raw SSRF response as build artifact
router.post('/skills/:id/ci/builds/:buildId/artifacts/export',
requireSession, requireBuildWritePermission,
async (req, res) => {
const { artifactExportUrl, artifactName } = req.body;
// Fetches any URL — attacker points to etcd:2379
const artifactResponse = await fetch(artifactExportUrl);
const artifactBody = await artifactResponse.text();
// Stores raw response body — etcd config now in build history
await db.storeBuildArtifact(req.params.buildId, artifactName, artifactBody);
res.json({ stored: true });
}
);
// SSRF81-004 — FIXED: allowlist S3/GCS presigned URLs only; never store raw response
const ALLOWED_ARTIFACT_HOSTS = new Set([
's3.amazonaws.com', 'storage.googleapis.com', 'artifactory.internal'
]);
router.post('/skills/:id/ci/builds/:buildId/artifacts/export',
requireSession, requireBuildWritePermission,
async (req, res) => {
const { artifactExportUrl, artifactName } = req.body;
const url = new URL(artifactExportUrl);
if (url.protocol !== 'https:') throw new Error('artifact_url_must_be_https');
if (!ALLOWED_ARTIFACT_HOSTS.has(url.hostname)) {
throw new Error(`artifact_host_not_allowed: ${url.hostname}`);
}
// Store only the metadata reference — never fetch or store the content
await db.storeBuildArtifactRef(req.params.buildId, artifactName, artifactExportUrl);
res.json({ stored: true });
}
);
SkillAudit detects all SA-SKL-SSRF81 patterns via static AST analysis. Run a free audit on your MCP skill or Claude plugin and get a graded report with fix guidance in under 60 seconds.