Claude MCP skill SSRF — dependency resolution and package analysis pipeline — SA-SKL-SSRF27
Package analysis pipelines perform server-side HTTP fetches to enrich audit reports: contributor statistics from repository APIs, vulnerability advisories from npm registries, CI workflow configurations from GitHub, and license text from declared URLs. Every field a package author controls that is later fetched server-side is a potential SSRF vector. SA-SKL-SSRF27 covers four SSRF patterns in MCP skill registry dependency resolution and package analysis — repository URL, registry proxy, workflow YAML path, and license URL — each of which can probe internal infrastructure or exfiltrate cloud provider metadata credentials.
package.json repository.url field fetched server-side to display contributor statistics — attacker sets the field to ssh://169.254.169.254/latest/meta-data/; the fetch library's URL parsing resolves this to an HTTP probe of the cloud IMDS endpoint, returning IAM credentials that are stored in the contributor stats cache and returned in audit reports to all visitorshttp://10.0.0.1:9200 (internal Elasticsearch); the proxy returns Elasticsearch's index list as the advisory feed JSON, exposing internal index names and document counts.github/workflows/ path URL — attacker sets the path to http://jenkins.internal:8080/api/json; the YAML parser receives Jenkins JSON output as the workflow definition and the raw response body is included in the audit report, exposing internal CI job names, build parameters, and environment variable keyslicenseUrl field in the package manifest without SSRF guard or hostname allowlist — attacker sets to 169.254.169.254/latest/meta-data/iam/security-credentials/; the response (IAM role name list) is cached as the license text and displayed in the public-facing audit report badge page to all subsequent visitorsBackground: package metadata fields as SSRF vectors
Package analysis pipelines are rich SSRF attack surfaces because they consume many URL-valued fields from untrusted package manifests: repository.url, homepage, bugs.url, licenseUrl, registryUrl, and paths to CI configuration files. Each field is set by the package author — who may be an adversary — and each field that is subsequently fetched server-side without validation is a potential SSRF vector.
The SA-SKL-SSRF27 findings all share the same root cause: a URL-valued field in a package manifest is passed to an HTTP client without first validating that the hostname resolves to a public, non-RFC1918, non-link-local address. The fixes all share the same structure: a reusable SSRF guard that validates the URL scheme (HTTPS only), resolves the hostname to an IP, and blocks RFC1918 (10.x, 172.16-31.x, 192.168.x), loopback (127.x, ::1), and link-local (169.254.x) address ranges.
Related patterns: SA-SKL-SSRF26 (badge and social preview SSRF), SA-SKL-SSRF25 (documentation fetch SSRF), SA-SKL-INJECTION15 (CI/CD injection).
SSRF27-001 — CRITICAL — repository.url SSRF to cloud IMDS leaks IAM credentials
The package analysis pipeline fetches the repository.url field from a skill's package.json to display contributor statistics in the audit report. The fetch uses the got HTTP library with default settings. The got library's URL parsing accepts ssh:// URLs and, depending on the version and OS resolver, may resolve the hostname portion against the network — in this case, 169.254.169.254 — resulting in an HTTP GET to the cloud provider's Instance Metadata Service.
The AWS IMDS endpoint at http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE_NAME returns a JSON object containing AccessKeyId, SecretAccessKey, and Token for the EC2 instance's IAM role. Because the pipeline caches contributor stats by repository URL, the IMDS response (which looks like arbitrary JSON) is stored as the contributor stats payload and returned in the audit report's contributor section — visible to any user who views the report.
The fix requires a DNS-resolving SSRF guard that: (1) accepts only https:// scheme; (2) resolves the hostname to an IP address before allowing the connection; (3) blocks RFC1918, loopback, and link-local ranges; (4) uses the resolved IP for the actual connection (to prevent DNS rebinding between resolution and connection); (5) sets a 2-second timeout and 512KB body limit.
// VULNERABLE — SSRF27-001
// analysis/repository-stats.js
const got = require('got');
// BUG: repository.url from package.json passed directly to got()
// Attacker sets repository.url: "ssh://169.254.169.254/latest/meta-data/"
// got resolves hostname and fetches IMDS — returns IAM role credentials
// Response cached as contributor stats and returned in audit report
async function fetchContributorStats(repositoryUrl) {
const response = await got(repositoryUrl, { // BUG: no SSRF guard
timeout: { request: 10000 },
responseType: 'json',
});
return response.body;
}
// FIXED — SSRF27-001
// analysis/repository-stats.js
const got = require('got');
const dns = require('dns').promises;
const { URL } = require('url');
const ipaddr = require('ipaddr.js');
// Reusable SSRF guard
async function ssrfGuard(urlString) {
let parsed;
try { parsed = new URL(urlString); } catch { throw new Error('SSRF27: invalid URL'); }
if (parsed.protocol !== 'https:') {
throw new Error(`SSRF27: only HTTPS allowed, got ${parsed.protocol}`);
}
// Resolve hostname to IP; reject private/link-local/loopback ranges
const records = await dns.resolve4(parsed.hostname).catch(() => {
throw new Error(`SSRF27: DNS resolution failed for ${parsed.hostname}`);
});
for (const ip of records) {
const addr = ipaddr.parse(ip);
const range = addr.range();
if (range !== 'unicast') {
throw new Error(`SSRF27: blocked IP range ${range} for ${ip}`);
}
}
// Return first resolved IP — use it directly to prevent DNS rebinding
return { url: urlString, resolvedIp: records[0] };
}
async function fetchContributorStats(repositoryUrl) {
// Validate URL scheme and destination IP before any network request
const { resolvedIp } = await ssrfGuard(repositoryUrl);
// Only allow known GitHub/GitLab repository host patterns
const parsed = new URL(repositoryUrl);
const ALLOWED_HOSTS = new Set([
'api.github.com', 'github.com',
'gitlab.com', 'api.gitlab.com',
]);
if (!ALLOWED_HOSTS.has(parsed.hostname)) {
throw new Error(`SSRF27-001: repository host not in allowlist: ${parsed.hostname}`);
}
const response = await got(repositoryUrl, {
headers: { 'User-Agent': 'SkillAudit/1.0' },
timeout: { request: 2000 },
followRedirect: false, // never follow redirects — rebinding risk
decompress: true,
responseType: 'json',
});
// Cap response body size to prevent memory exhaustion
if (JSON.stringify(response.body).length > 512 * 1024) {
throw new Error('SSRF27-001: response too large');
}
return response.body;
}
SSRF27-001 impact: IAM credentials (AccessKeyId, SecretAccessKey, Token) for the EC2 instance role are exfiltrated via the audit report's contributor stats section. The credentials grant full AWS API access with the instance role's permissions — typically including S3 bucket read/write, DynamoDB access, and Secrets Manager read. The attack requires only publishing a package with a crafted repository.url and triggering an audit. SkillAudit detects this by identifying all HTTP fetch calls where the URL is derived from package manifest fields without an intervening SSRF guard function call.
SSRF27-002 — HIGH — npm audit proxy SSRF to internal Elasticsearch via user-supplied registry URL
The dependency vulnerability scanner proxies npm advisory requests through a configurable registry URL. The skill manifest can specify a custom registryUrl field to point the scanner to a private npm registry. The proxy fetches {registryUrl}/-/npm/v1/security/advisories/bulk and returns the advisory list as part of the audit result. The registryUrl value is not validated before the fetch.
An attacker sets registryUrl: "http://10.0.0.1:9200" in their skill manifest. The proxy constructs http://10.0.0.1:9200/-/npm/v1/security/advisories/bulk and sends a POST request to it. If the internal Elasticsearch node responds (it will on a default-open port), it returns its own JSON response (an error document or partial index metadata) rather than an npm advisory list. The proxy's JSON parser accepts any valid JSON, and the raw response is included in the audit result, exposing internal Elasticsearch index names, version information, and node configuration.
The fix requires a strict hostname allowlist for registry URLs: only known public npm-compatible registries (registry.npmjs.org, registry.yarnpkg.com, and optionally a list of admin-approved private registries) may be used. User-supplied registry URLs must be validated against this allowlist before any fetch.
// VULNERABLE — SSRF27-002
// analysis/dependency-audit.js
const got = require('got');
// BUG: user-supplied registryUrl used in HTTP fetch without validation
// Attacker sets: registryUrl: "http://10.0.0.1:9200"
// Proxy fetches http://10.0.0.1:9200/-/npm/v1/security/advisories/bulk
// Elasticsearch responds — internal index list returned in audit result
async function fetchAdvisories(packageNames, registryUrl) {
const url = `${registryUrl}/-/npm/v1/security/advisories/bulk`;
const response = await got.post(url, { // BUG: no SSRF guard or allowlist
json: { name: packageNames },
responseType: 'json',
});
return response.body;
}
// FIXED — SSRF27-002
// analysis/dependency-audit.js
const got = require('got');
// Allowlist of approved npm-compatible registry hostnames
const APPROVED_REGISTRY_HOSTS = new Set([
'registry.npmjs.org',
'registry.yarnpkg.com',
'registry.npmmirror.com',
]);
function validateRegistryUrl(registryUrl) {
let parsed;
try { parsed = new URL(registryUrl); } catch { throw new Error('Invalid registry URL'); }
if (parsed.protocol !== 'https:') {
throw new Error(`SSRF27-002: registry URL must use HTTPS, got ${parsed.protocol}`);
}
if (!APPROVED_REGISTRY_HOSTS.has(parsed.hostname)) {
throw new Error(`SSRF27-002: registry host not in allowlist: ${parsed.hostname}`);
}
// Strip any path — only the origin is controlled by the manifest
return `${parsed.protocol}//${parsed.host}`;
}
async function fetchAdvisories(packageNames, rawRegistryUrl) {
// Default to public npm registry; use allowlist-validated URL if provided
const baseUrl = rawRegistryUrl
? validateRegistryUrl(rawRegistryUrl)
: 'https://registry.npmjs.org';
const url = `${baseUrl}/-/npm/v1/security/advisories/bulk`;
const response = await got.post(url, {
json: { name: packageNames },
timeout: { request: 5000 },
followRedirect: false,
responseType: 'json',
});
// Validate response structure to prevent unexpected data formats
if (!response.body || typeof response.body !== 'object') {
throw new Error('SSRF27-002: unexpected advisory feed response format');
}
return response.body;
}
SSRF27-002 impact: Server-side probe of internal services listening on port 9200 (Elasticsearch), 6379 (Redis), 8080 (Jenkins/Tomcat), or any other port that accepts HTTP requests. The response body is returned in the audit result, potentially exposing internal index names, service version banners, job configurations, or other sensitive metadata. SkillAudit detects this by identifying HTTP fetch calls where the URL base is sourced from package manifest fields (registryUrl, repositoryUrl, etc.) without an intervening hostname allowlist check.
SSRF27-003 — HIGH — GitHub Actions workflow YAML SSRF to internal Jenkins
The CI compatibility check in the package analysis pipeline fetches the skill's GitHub Actions workflow YAML to verify that it includes the SkillAudit CI action. The workflow path URL is constructed from the skill manifest's ciWorkflowUrl field. The URL is expected to point to a raw GitHub content URL like https://raw.githubusercontent.com/owner/repo/main/.github/workflows/skillaudit.yml, but it is not validated against a hostname allowlist before fetching.
An attacker sets ciWorkflowUrl: "http://jenkins.internal:8080/api/json". The analysis worker fetches this URL, receives Jenkins' job listing JSON response, and attempts to parse it as YAML (since YAML is a superset of JSON, the parse succeeds). The raw response body — containing Jenkins job names, build parameters, environment variable keys, and labels — is included in the CI compatibility section of the audit report, exposed to anyone who views the report.
The fix requires a strict hostname allowlist for workflow URL fetches. Only raw.githubusercontent.com and raw.gitlab.com (and optionally a whitelist of approved private CI hosts) should be reachable from the CI compatibility checker. Additionally, the fetched content should be validated as a YAML document with an expected structure (must contain on: and jobs: top-level keys) before being stored in the audit result.
// VULNERABLE — SSRF27-003
// analysis/ci-compat.js
const got = require('got');
const yaml = require('js-yaml');
// BUG: ciWorkflowUrl from manifest fetched without hostname allowlist
// Attacker sets: ciWorkflowUrl: "http://jenkins.internal:8080/api/json"
// Jenkins JSON response parsed as YAML (valid, since JSON ⊂ YAML)
// Jenkins job names, params, and env var keys returned in audit report
async function fetchWorkflowConfig(ciWorkflowUrl) {
const response = await got(ciWorkflowUrl, { // BUG: no SSRF guard
timeout: { request: 5000 },
responseType: 'text',
});
return yaml.load(response.body, { schema: yaml.FAILSAFE_SCHEMA });
}
// FIXED — SSRF27-003
// analysis/ci-compat.js
const got = require('got');
const yaml = require('js-yaml');
const { URL } = require('url');
const { z } = require('zod');
// Allowlist: only raw GitHub and GitLab content hosts
const ALLOWED_WORKFLOW_HOSTS = new Set([
'raw.githubusercontent.com',
'raw.gitlab.com',
]);
// Expected workflow YAML structure
const WorkflowSchema = z.object({
on: z.any(), // trigger configuration
jobs: z.record(z.any()), // job map
}).passthrough(); // allow additional top-level keys
function validateWorkflowUrl(urlString) {
let parsed;
try { parsed = new URL(urlString); } catch { throw new Error('Invalid workflow URL'); }
if (parsed.protocol !== 'https:') {
throw new Error(`SSRF27-003: workflow URL must use HTTPS, got ${parsed.protocol}`);
}
if (!ALLOWED_WORKFLOW_HOSTS.has(parsed.hostname)) {
throw new Error(`SSRF27-003: workflow host not in allowlist: ${parsed.hostname}. Allowed: ${[...ALLOWED_WORKFLOW_HOSTS].join(', ')}`);
}
return urlString;
}
async function fetchWorkflowConfig(ciWorkflowUrl) {
const validatedUrl = validateWorkflowUrl(ciWorkflowUrl);
const response = await got(validatedUrl, {
timeout: { request: 3000 },
followRedirect: false, // no redirects — prevents open redirect to internal hosts
responseType: 'text',
headers: { 'User-Agent': 'SkillAudit/1.0' },
});
// 512KB limit — workflow files should be small
if (response.body.length > 512 * 1024) {
throw new Error('SSRF27-003: workflow file too large');
}
// Parse with FAILSAFE_SCHEMA — no !!js/function type tags
const parsed = yaml.load(response.body, { schema: yaml.FAILSAFE_SCHEMA });
// Validate expected structure — reject Jenkins JSON, Terraform, etc.
return WorkflowSchema.parse(parsed);
}
SSRF27-003 impact: Server-side probe of internal HTTP services (Jenkins, Nexus, Artifactory, internal documentation servers). The response body is included in the audit report's CI compatibility section, exposing internal job configurations, build parameter names, environment variable keys, and service version banners. The attack requires only crafting a skill manifest with a malicious ciWorkflowUrl. SkillAudit detects this by enumerating all YAML or HTTP fetch calls where the URL is sourced from package manifest fields and cross-referencing against a list of approved URL patterns.
SSRF27-004 — HIGH — licenseUrl SSRF to IMDS cached in public audit report
The license compliance checker in the analysis pipeline fetches the full license text from a URL declared in the skill manifest's licenseUrl field. The intent is to display the license text alongside the SPDX identifier in the audit report. The licenseUrl is fetched without an SSRF guard and without a hostname allowlist. The fetched text is cached in the database under the skill's audit record and displayed in the public audit report badge page.
An attacker sets licenseUrl: "http://169.254.169.254/latest/meta-data/iam/security-credentials/". The license text fetcher retrieves the IMDS response (a list of IAM role names, e.g., skillaudit-prod-api-role), caches it as the skill's license text, and renders it in the public audit report badge page. Any visitor to the audit report page — including unauthenticated users — sees the IAM role name. A follow-up request to http://169.254.169.254/latest/meta-data/iam/security-credentials/skillaudit-prod-api-role would retrieve the full credentials, but even the role name disclosure confirms the application is running on EC2 and reveals the IAM role naming convention.
Beyond IMDS, the same attack vector can reach internal Redis (port 6379), internal Elasticsearch (port 9200), or any HTTP service accessible from the analysis worker. The license text display does not require authentication — caching and public display amplifies the SSRF into a persistent, publicly-visible information disclosure.
// VULNERABLE — SSRF27-004
// analysis/license-checker.js
const got = require('got');
// BUG: licenseUrl from package manifest fetched without SSRF guard
// Attacker sets: licenseUrl: "http://169.254.169.254/latest/meta-data/iam/..."
// IMDS response cached as license text, displayed in public audit badge page
async function fetchLicenseText(licenseUrl) {
if (!licenseUrl) return null;
const response = await got(licenseUrl, { // BUG: no SSRF guard or allowlist
timeout: { request: 5000 },
responseType: 'text',
});
// Cache and return — displayed publicly in audit report
return response.body.slice(0, 10_000); // limit length but not URL destination
}
// FIXED — SSRF27-004
// analysis/license-checker.js
const got = require('got');
const dns = require('dns').promises;
const { URL } = require('url');
const ipaddr = require('ipaddr.js');
// License text allowlist: only well-known license repositories
const ALLOWED_LICENSE_HOSTS = new Set([
'raw.githubusercontent.com',
'opensource.org',
'www.gnu.org',
'apache.org',
'www.apache.org',
'mit-license.org',
'creativecommons.org',
]);
async function fetchLicenseText(licenseUrl) {
if (!licenseUrl) return null;
let parsed;
try { parsed = new URL(licenseUrl); } catch {
throw new Error('SSRF27-004: invalid licenseUrl');
}
// Scheme check
if (parsed.protocol !== 'https:') {
throw new Error(`SSRF27-004: licenseUrl must use HTTPS`);
}
// Hostname allowlist check — before any DNS resolution
if (!ALLOWED_LICENSE_HOSTS.has(parsed.hostname)) {
throw new Error(`SSRF27-004: licenseUrl host not in allowlist: ${parsed.hostname}`);
}
// DNS resolution + private IP block (defense-in-depth: allowlist may have
// entries that resolve to private IPs via split-horizon DNS)
const records = await dns.resolve4(parsed.hostname);
for (const ip of records) {
const range = ipaddr.parse(ip).range();
if (range !== 'unicast') {
throw new Error(`SSRF27-004: licenseUrl resolved to private IP range ${range}`);
}
}
const response = await got(licenseUrl, {
timeout: { request: 3000 },
followRedirect: false,
responseType: 'text',
headers: { 'User-Agent': 'SkillAudit/1.0' },
});
if (response.body.length > 100 * 1024) {
throw new Error('SSRF27-004: license text exceeds 100KB limit');
}
return response.body;
}
SSRF27-004 impact: IAM role name disclosure (or full IMDS credentials in a two-step attack), internal service enumeration via response body caching in public audit reports, and persistent publicly-accessible disclosure of internal infrastructure details. The attack does not require the attacker to have an authenticated session on the target platform — only the ability to publish a skill with a crafted licenseUrl. SkillAudit detects this by scanning all HTTP fetch calls in the analysis pipeline where the URL is sourced from package manifest fields and flagging those without both a hostname allowlist check and a DNS-resolving private-IP block.
Detection with SkillAudit
SkillAudit's static analysis scans the dependency resolution and package analysis pipeline for all four SA-SKL-SSRF27 patterns. For SSRF27-001 through SSRF27-004 it identifies HTTP fetch calls where the URL is derived from package manifest fields (any field parsed from package.json or equivalent manifest files) and checks whether each call is preceded by both a URL scheme check and a hostname allowlist or DNS-based private-IP block. Calls that lack either guard are flagged with the specific SSRF27 sub-finding ID.
| Finding | Severity | Root cause | Fix |
|---|---|---|---|
| SSRF27-001 | CRITICAL | repository.url fetched without SSRF guard; ssh:// URL resolves to 169.254.169.254 IMDS — IAM credentials in contributor stats cache | HTTPS-only + DNS resolve + RFC1918/link-local block + GitHub/GitLab hostname allowlist |
| SSRF27-002 | HIGH | registryUrl passed to npm advisory proxy without allowlist; probes internal Elasticsearch on port 9200 | Strict hostname allowlist (registry.npmjs.org etc.); strip path from user-supplied base URL |
| SSRF27-003 | HIGH | ciWorkflowUrl fetched without hostname allowlist; Jenkins JSON returned as workflow YAML in audit report | Allowlist raw.githubusercontent.com / raw.gitlab.com; validate parsed YAML against schema |
| SSRF27-004 | HIGH | licenseUrl fetched without SSRF guard; IMDS response cached as license text in public audit badge page | Allowlist known license host domains + DNS private-IP block; 100KB body limit |
Related findings: SA-SKL-SSRF26 (badge generation SSRF), SA-SKL-SSRF25 (documentation fetch SSRF), SA-SKL-UPLOAD17 (file upload vulnerabilities).
SkillAudit scans your MCP skill registry for all SA-SKL-SSRF27 patterns — repository URL SSRF, registry proxy SSRF, workflow YAML path SSRF, and license URL SSRF — and delivers a prioritized fix report in minutes.
Join the waitlist →