Claude MCP skill SSRF — CI/CD pipeline integration and build trigger endpoints
SA-SKL-SSRF35 documents four server-side request forgery vulnerabilities in MCP skill registry CI/CD pipeline integration and build trigger endpoints. Build trigger SSRF leaks cloud IAM credentials from the metadata service, status polling SSRF reads Consul key-value data, artifact download SSRF reads internal S3-compatible storage credentials, and deployment webhook SSRF writes arbitrary keys to etcd.
pipelineUrl; attacker sets to 169.254.169.254; IAM credentials in response stored as build metadata and returned in API response
statusUrl; attacker sets to internal Consul service; Consul KV JSON response stored as build status object and returned to attacker
artifactUrl; attacker sets to internal S3-compatible storage; arbitrary bucket read returns stored credentials in object body
deployUrl on completion; attacker sets to internal etcd; POST body from webhook triggers an etcd key write via the etcd v2 API
SSRF35-001 (Critical): Build trigger SSRF leaks cloud IAM credentials via metadata service
MCP skill registry CI/CD integration features allow users to connect their continuous integration pipelines by supplying a webhook URL that the registry calls when a skill audit completes. When the trigger endpoint makes an outbound HTTP request to the user-supplied URL without validating that the destination is a legitimate external CI provider, the registry server can be directed to fetch from internal cloud infrastructure endpoints. The AWS EC2 instance metadata service endpoint http://169.254.169.254/latest/meta-data/iam/security-credentials/ is reachable from any process running on an EC2 instance and returns the temporary IAM credentials associated with the instance's attached role — without authentication.
When the registry stores the HTTP response body as build trigger metadata and returns it in the subsequent pipeline-status API response, the IAM credentials — including AccessKeyId, SecretAccessKey, and Token — are delivered directly to the attacker. These temporary credentials carry whatever permissions the registry's IAM role has: typically access to the production S3 buckets hosting skill packages, the ECR container registry, the RDS database connection credentials stored in Secrets Manager, and potentially IAM rights to escalate further. The attack requires only a single API call to the pipeline trigger endpoint with a crafted pipelineUrl.
// VULNERABLE — pipeline trigger fetches user-supplied URL; metadata service accessible
// File: routes/ciIntegration.js
router.post('/pipelines/trigger', authenticate, async (req, res) => {
const { pipelineUrl, skillId, eventType } = req.body;
const userId = req.user.sub;
// VULNERABILITY: pipelineUrl is user-supplied; no host validation
// Attacker sets pipelineUrl: "http://169.254.169.254/latest/meta-data/iam/security-credentials/registry-role"
const triggerResponse = await fetch(pipelineUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ skillId, event: eventType, triggeredBy: userId }),
});
const responseBody = await triggerResponse.json();
// IAM credentials stored in build metadata and returned in response
await db.query(
'INSERT INTO pipeline_runs (user_id, skill_id, url, trigger_response) VALUES ($1,$2,$3,$4)',
[userId, skillId, pipelineUrl, JSON.stringify(responseBody)]
);
res.json({ status: 'triggered', response: responseBody }); // credentials leaked here
});
Fix: Validate pipelineUrl against an allowlist of known CI provider hostname patterns before making the outbound request. Additionally, resolve the target hostname to an IP address and reject any resolution that falls within private IP ranges (RFC 1918: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), loopback (127.0.0.0/8), link-local (169.254.0.0/16), and IPv6 private ranges. Use redirect: 'error' in the fetch options to prevent redirect-based SSRF bypasses. Never return the raw outbound response body to the caller — return only a boolean success indicator after verifying the downstream response code.
// FIXED — URL validated against CI allowlist + private IP block; response not returned
// File: routes/ciIntegration.js
const { URL } = require('url');
const dns = require('dns').promises;
const ipRangeCheck = require('ip-range-check');
const ALLOWED_CI_HOSTNAMES = [
/^api\.github\.com$/,
/^gitlab\.com$/,
/^app\.circleci\.com$/,
/^api\.bitbucket\.org$/,
/^jenkins\.[a-z0-9-]+\.example\.com$/, // internal Jenkins on known subdomain only
];
const PRIVATE_RANGES = [
'10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16',
'127.0.0.0/8', '169.254.0.0/16', '::1/128', 'fc00::/7',
];
async function validatePipelineUrl(urlStr) {
let parsed;
try { parsed = new URL(urlStr); } catch { throw new Error('Invalid URL'); }
if (!['https:'].includes(parsed.protocol)) throw new Error('HTTPS only');
const allowed = ALLOWED_CI_HOSTNAMES.some(re => re.test(parsed.hostname));
if (!allowed) throw new Error('Hostname not in CI provider allowlist');
// Resolve hostname and check for private IPs (DNS rebinding prevention)
const { address } = await dns.lookup(parsed.hostname);
if (ipRangeCheck(address, PRIVATE_RANGES)) throw new Error('Private IP blocked');
return parsed;
}
router.post('/pipelines/trigger', authenticate, async (req, res) => {
const { pipelineUrl, skillId, eventType } = req.body;
const userId = req.user.sub;
await validatePipelineUrl(pipelineUrl); // throws on invalid/private URL
const triggerResponse = await fetch(pipelineUrl, {
method: 'POST',
redirect: 'error', // block redirect-based bypass
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ skillId, event: eventType, triggeredBy: userId }),
signal: AbortSignal.timeout(5000),
});
const success = triggerResponse.ok;
await db.query(
'INSERT INTO pipeline_runs (user_id, skill_id, url, succeeded) VALUES ($1,$2,$3,$4)',
[userId, skillId, pipelineUrl, success]
// response body NOT stored; success boolean only
);
res.json({ status: success ? 'triggered' : 'failed' });
// Raw response body never returned to caller
});
SSRF35-002 (High): Build status polling SSRF reads Consul key-value store
After triggering a CI build, MCP skill registry integrations typically poll a status URL to track build progress and reflect that status in the registry's audit workflow. When the status polling endpoint accepts a user-supplied statusUrl and fetches it on demand, an attacker can point it at the internal Consul HTTP API (http://consul.service.consul:8500/v1/kv/), which is typically accessible from application servers without authentication in many Consul deployments. The Consul KV API returns all stored key-value pairs as a JSON array, including service configuration, internal credentials stored as Consul KV entries, feature flags with their current state, and infrastructure addresses.
Because the registry stores the status polling response as the build status object, the full Consul KV JSON response is persisted in the registry database and returned to the attacker through the status-check API. The attack is particularly effective for enumerating the internal service mesh configuration: Consul KV typically stores database connection strings, API keys for internal services, Vault unseal tokens, and service discovery data that provides a complete map of the internal network topology — all valuable for escalating to other internal services.
// VULNERABLE — status polling fetches user-supplied URL; Consul accessible internally
// File: routes/ciIntegration.js
router.get('/pipelines/:runId/status', authenticate, async (req, res) => {
const { runId } = req.params;
const { rows } = await db.query('SELECT * FROM pipeline_runs WHERE id = $1', [runId]);
const run = rows[0];
// VULNERABILITY: statusUrl was supplied by user at trigger time; no host validation
// Attacker sets statusUrl: "http://consul.service.consul:8500/v1/kv/?recurse=true"
const statusResponse = await fetch(run.status_url);
const statusData = await statusResponse.json();
// Consul KV JSON (with internal credentials) stored as build status and returned
await db.query('UPDATE pipeline_runs SET last_status = $1 WHERE id = $2',
[JSON.stringify(statusData), runId]);
res.json({ runId, status: statusData }); // internal Consul data returned to attacker
});
Fix: Apply the same URL allowlist and private IP blocking validation to statusUrl as described for SSRF35-001. Store the CI provider's build ID in the registry database at trigger time — derived from the trigger response — and use the CI provider's official API (via pre-configured API keys stored server-side, not supplied by the user) to poll status. The user should never supply a URL for status polling; the registry should derive the correct status URL from the build ID and the pre-configured CI provider API base URL.
// FIXED — status URL derived from build ID + pre-configured CI provider base URL
// File: routes/ciIntegration.js
const CI_PROVIDERS = {
github: { statusBase: 'https://api.github.com/repos/{owner}/{repo}/actions/runs/{runId}' },
gitlab: { statusBase: 'https://gitlab.com/api/v4/projects/{projectId}/pipelines/{runId}' },
};
router.get('/pipelines/:runId/status', authenticate, async (req, res) => {
const { runId } = req.params;
const { rows } = await db.query(
'SELECT provider, provider_build_id, provider_project_id FROM pipeline_runs WHERE id = $1 AND user_id = $2',
[runId, req.user.sub]
);
if (!rows.length) return res.status(404).json({ error: 'Not found' });
const { provider, provider_build_id } = rows[0];
const providerConfig = CI_PROVIDERS[provider];
if (!providerConfig) return res.status(400).json({ error: 'Unknown provider' });
// Status URL is constructed server-side from pre-configured base; user cannot influence it
const statusUrl = providerConfig.statusBase
.replace('{runId}', encodeURIComponent(provider_build_id))
.replace('{projectId}', encodeURIComponent(rows[0].provider_project_id));
const statusResponse = await fetch(statusUrl, {
headers: { Authorization: `Bearer ${process.env.CI_API_TOKEN}` },
redirect: 'error',
signal: AbortSignal.timeout(5000),
});
// Return only the status field — not the full provider response
const { status, conclusion } = await statusResponse.json();
res.json({ runId, status, conclusion });
});
SSRF35-003 (High): Artifact download SSRF reads internal S3-compatible storage credentials
Build artifact download endpoints in MCP skill registries allow users to retrieve compiled skill packages and audit reports produced by CI runs. When the artifact download endpoint fetches a user-supplied artifactUrl and streams the response to the client, an attacker can redirect it to internal S3-compatible object storage (MinIO, Ceph, or AWS S3 internal endpoints) that is accessible from the registry host. Internal object storage frequently contains credentials files, backup archives, and configuration bundles stored by deployment automation — objects whose contents are sensitive but whose storage bucket policies do not restrict access from within the VPC.
By constructing an artifactUrl that points to a known bucket path pattern (e.g., http://minio.internal:9000/config/database.env), an attacker can read arbitrary objects from internal storage. The registry's artifact download endpoint proxies the full object body to the attacker's HTTP client, delivering the credential file without any authentication against the internal storage service — because the request originates from the registry host, which may have ambient IAM permissions or network access that bypasses storage bucket policies.
// VULNERABLE — artifact download proxies user-supplied URL; internal S3 accessible
// File: routes/ciIntegration.js
router.get('/pipelines/:runId/artifact', authenticate, async (req, res) => {
const { artifactUrl } = req.query;
// VULNERABILITY: artifactUrl from query param; no host validation
// Attacker: artifactUrl=http://minio.internal:9000/secrets/database.env
const artifactResponse = await fetch(artifactUrl);
// Full internal file content proxied to attacker
res.setHeader('Content-Type', artifactResponse.headers.get('content-type') || 'application/octet-stream');
artifactResponse.body.pipe(res);
});
Fix: Validate artifactUrl against the CI provider allowlist and private IP block from SSRF35-001. Additionally, validate that the Content-Type of the fetched resource matches expected artifact types (e.g., application/zip, application/gzip) before streaming it to the client — this prevents a text/plain credential file from being returned even if the URL validation is bypassed. The most robust fix is to avoid fetching user-supplied URLs entirely: use pre-signed download URLs generated server-side from the CI provider API, keyed on the internal build ID.
// FIXED — artifact URL generated server-side from CI provider API; no user-supplied URL
// File: routes/ciIntegration.js
const ALLOWED_ARTIFACT_CONTENT_TYPES = new Set([
'application/zip', 'application/gzip', 'application/x-tar',
'application/octet-stream',
]);
router.get('/pipelines/:runId/artifact', authenticate, async (req, res) => {
const { runId } = req.params;
// Look up the internal CI build ID — user cannot supply the artifact URL
const { rows } = await db.query(
'SELECT provider, provider_build_id, provider_artifact_id FROM pipeline_runs WHERE id = $1 AND user_id = $2',
[runId, req.user.sub]
);
if (!rows.length) return res.status(404).json({ error: 'Not found' });
const { provider, provider_build_id, provider_artifact_id } = rows[0];
// Fetch a pre-signed download URL from the CI provider API (server-side only)
const downloadUrl = await getCIArtifactUrl(provider, provider_build_id, provider_artifact_id);
// downloadUrl is from ALLOWED_CI_HOSTNAMES — no user influence on target
const artifactResponse = await fetch(downloadUrl, {
redirect: 'error',
signal: AbortSignal.timeout(30000),
});
const contentType = artifactResponse.headers.get('content-type') || '';
if (!ALLOWED_ARTIFACT_CONTENT_TYPES.has(contentType.split(';')[0].trim())) {
return res.status(400).json({ error: 'Unexpected artifact content type' });
}
res.setHeader('Content-Type', contentType);
artifactResponse.body.pipe(res);
});
SSRF35-004 (Critical): Deployment webhook SSRF writes to internal etcd via v2 API
Deployment webhook callbacks in MCP skill registry CI/CD integrations notify user-supplied URLs when a build completes and the skill is deployed to the registry. When the callback endpoint issues a POST request to the user-supplied deployUrl without restricting the target to external hosts, an attacker can direct the webhook POST to the internal etcd v2 HTTP API (http://etcd.internal:2379/v2/keys/). The etcd v2 API accepts key-value writes via PUT requests, but critically also processes the JSON body of a POST to /v2/keys/{key} as a create-or-update operation in some etcd configurations. Because the webhook POST body contains the deployment event data as a JSON document, an attacker who controls the deployUrl path can write arbitrary data to etcd keys — overwriting service configuration, corrupting feature flags, or injecting malicious values into keys that downstream services read during startup.
Writing to etcd can have immediate operational impact: service discovery entries can be overwritten to redirect traffic, database connection strings can be replaced to point to attacker-controlled hosts, Kubernetes pod spec templates stored in etcd can be modified, and leader election keys can be disrupted to cause service outages. The attack requires only a single POST to the deployment webhook endpoint with a crafted deployUrl pointing to the target etcd key path.
// VULNERABLE — deployment webhook POST to user-supplied URL; etcd v2 API writable
// File: routes/ciIntegration.js
router.post('/pipelines/:runId/deploy-webhook', authenticate, async (req, res) => {
const { deployUrl } = req.body;
const { runId } = req.params;
const deploymentEvent = {
runId,
status: 'deployed',
deployedAt: new Date().toISOString(),
skillId: req.body.skillId,
};
// VULNERABILITY: deployUrl is user-supplied; no host validation
// Attacker sets deployUrl: "http://etcd.internal:2379/v2/keys/services/registry/config"
// POST to etcd v2 /keys/ endpoint writes deploymentEvent JSON as a new key value
await fetch(deployUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(deploymentEvent),
});
res.json({ notified: true });
});
Fix: Apply the CI provider allowlist and private IP blocking to deployUrl. Use redirect: 'error' to block redirect-based bypasses. Return only a boolean success indicator from the webhook response — never the downstream response body. As a defence-in-depth measure for all SSRF35 variants, implement an egress firewall rule at the infrastructure level (security group, iptables, or service mesh policy) that blocks outbound connections from the registry application to private IP ranges and to the etcd, Consul, and metadata service ports — so that SSRF attempts fail at the network layer even if application-level validation is bypassed.
// FIXED — deployUrl validated; response not returned; infrastructure-level egress rules
// File: routes/ciIntegration.js
router.post('/pipelines/:runId/deploy-webhook', authenticate, async (req, res) => {
const { deployUrl } = req.body;
const { runId } = req.params;
// Throws on private IP, non-allowlisted hostname, non-HTTPS
await validatePipelineUrl(deployUrl); // reuse from SSRF35-001 fix
const deploymentEvent = {
runId,
status: 'deployed',
deployedAt: new Date().toISOString(),
};
// skillId and sensitive fields excluded from webhook body
const webhookResponse = await fetch(deployUrl, {
method: 'POST',
redirect: 'error', // block redirect-based bypass
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(deploymentEvent),
signal: AbortSignal.timeout(5000),
});
// Return success boolean only — never the downstream response body
res.json({ notified: webhookResponse.ok });
});
// Infrastructure-level defence (Terraform security group rule, not application code):
// aws_security_group_rule "deny_egress_private" {
// type = "egress"
// from_port = 0
// to_port = 65535
// protocol = "-1"
// cidr_blocks = ["10.0.0.0/8","172.16.0.0/12","192.168.0.0/16","169.254.0.0/16"]
// description = "Block SSRF to internal infrastructure"
// }
Compound attack chain: CI integration to full infrastructure compromise
These four SSRF35 vulnerabilities compose an infrastructure compromise chain in which an attacker with a registered MCP registry account progressively escalates from credential theft to full control over the registry's internal services.
Phase 1 — IAM credential theft (SSRF35-001). The attacker registers a CI pipeline integration with pipelineUrl pointing to the AWS metadata service. The registry triggers the pipeline, fetching the IAM role credentials and storing them in the pipeline run record. The attacker retrieves the credentials via the pipeline status API. With IAM credentials, the attacker gains direct access to production S3 buckets, Secrets Manager, and ECR.
Phase 2 — Internal service enumeration (SSRF35-002 + SSRF35-003). The attacker uses statusUrl pointing to the Consul KV API to enumerate all internal service configuration, extracting database connection strings, internal API keys, and service discovery topology. Using artifactUrl pointing to internal MinIO, they download stored configuration archives and credential files, completing the internal credential inventory.
Phase 3 — Configuration hijacking (SSRF35-004). With full knowledge of the etcd key schema from Phase 2, the attacker submits a deployment webhook with deployUrl pointing to a critical etcd key. The POST body overwrites the service discovery entry for the registry's database proxy, redirecting all database connections to an attacker-controlled host. All subsequent registry requests deliver credentials and audit data to the attacker's infrastructure.
Chain severity: The combined chain achieves full infrastructure compromise from a standard authenticated API call. The root cause in all four cases is the same: accepting a user-supplied URL and making server-side HTTP requests to it without validating that the target is an authorised external service. The fix is a shared validatePipelineUrl() function applied consistently to every CI integration URL parameter, backed by infrastructure-level egress filtering.
Detection with tree-sitter queries
Query 1 — fetch() with user-supplied URL variable. Matches fetch() call expressions where the first argument is an identifier or member expression that traces to a request body or query parameter field. This is the structural signature of all four SSRF35 variants.
; tree-sitter query: fetch() with request-body-sourced URL (SSRF35 pattern)
; Matches: fetch(req.body.url), fetch(pipelineUrl), fetch(run.status_url) etc.
(call_expression
function: (identifier) @fn (#eq? @fn "fetch")
arguments: (arguments
[
(member_expression
object: (member_expression
object: (identifier) @req (#match? @req "req")
property: (property_identifier) @source (#match? @source "(body|query|params)")
)
)
(identifier) @url-var (#match? @url-var "(url|Url|URL|endpoint|webhook|callback|pipeline|status|artifact|deploy)")
]
)
) @ssrf-candidate
; Each @ssrf-candidate: confirm whether the URL is validated against an allowlist
; before the fetch call. No validation = SSRF vulnerability.
; Fix: call validatePipelineUrl(url) before fetch(); block private IP ranges.
Summary
| ID | Severity | Surface | Root cause | Fix |
|---|---|---|---|---|
| SSRF35-001 | Critical | POST /pipelines/trigger — build trigger | User-supplied pipelineUrl fetched without host validation; IAM metadata service accessible |
CI provider allowlist + private IP DNS block; return success boolean only |
| SSRF35-002 | High | GET /pipelines/:id/status — status polling | Stored user-supplied statusUrl fetched on each poll; Consul KV accessible internally |
Derive status URL from build ID + pre-configured provider base; never store user-supplied URL |
| SSRF35-003 | High | GET /pipelines/:id/artifact — artifact download | User-supplied artifactUrl proxied without validation; internal S3 accessible from registry host |
Generate pre-signed download URL from CI provider API; validate Content-Type before streaming |
| SSRF35-004 | Critical | POST /pipelines/:id/deploy-webhook — deploy callback | User-supplied deployUrl receives POST with event JSON; etcd v2 API writable from registry host |
CI provider allowlist + private IP block; redirect:'error'; infrastructure egress rules for etcd/Consul ports |
Checklist for MCP skill registry operators: (1) Grep all CI integration routes for fetch(req.body or fetch(req.query patterns — every instance is an SSRF candidate. (2) Implement a shared validatePipelineUrl() that enforces CI provider allowlist + DNS private IP block + HTTPS-only + redirect:'error'. (3) Never store user-supplied URLs for future server-side fetching — derive them from internal build IDs at fetch time. (4) Never return downstream HTTP response bodies to callers — return success boolean or typed status objects only. (5) Add infrastructure-level egress rules blocking 169.254.0.0/16, 10.0.0.0/8, and service ports 2379 (etcd), 8500 (Consul), 8200 (Vault) from the registry application tier. Use the tree-sitter query above in CI to prevent regressions across the full SA-SKL-SSRF series.