SA-SKL-SSRF33 — Server-Side Request Forgery
SSRF in MCP Skill Registry Audit Engine Plugin and Scanner Configuration Endpoints
The audit engine of an MCP skill registry integrates with external systems at several points: custom scanner plugins, rule update feeds, audit completion callbacks, and CVE data sources. SA-SKL-SSRF33 covers four SSRF vulnerabilities in these integration endpoints where user-controlled URLs are fetched without adequate allowlisting, enabling attackers to reach cloud instance metadata services, internal documentation systems, in-process Redis instances, and internal issue trackers.
scannerEndpoint for custom analysis rules — attacker sets to 169.254.169.254; IAM credentials in scanner response parsed as rule violations and stored in audit findings; fix: allowlist of approved scanner endpoint patterns from env var + DNS private-IP blockruleSourceUrl to sync custom detection rules — attacker sets to internal Confluence; wiki page content stored as detection rule YAML; fix: allowlist GitHub/GitLab raw URLs only; validate YAML as rule schemaauditCompleteUrl on scan finish — attacker sets to internal Redis:6379 via HTTP/1.0 protocol confusion; arbitrary Redis commands injected via audit completion payload; fix: HTTPS only + DNS private-IP block + redirect:error + return only booleancveSourceUrl to update vulnerability database — attacker sets to internal JIRA; JIRA REST API JSON stored as CVE records; fix: allowlist of official NVD and MITRE CVE feed URLs only; validate response as CVE JSON schemaSSRF33-001 — Custom scanner endpoint fetches cloud IMDS for IAM credentials
The custom scanner plugin system allows team plan users to register a webhook endpoint that the audit engine calls during scans to execute custom detection rules. The endpoint URL is stored in the team's scanner configuration and is fetched during every audit run. The URL is accepted without validation. An attacker who registers a team account can set scannerEndpoint to http://169.254.169.254/latest/meta-data/iam/security-credentials/ (AWS IMDS v1). The audit engine fetches this URL, receives the IAM credentials in JSON format, and parses the response as scanner findings — exposing the credentials in the audit result stored in the database.
// SSRF33-001 — VULNERABLE
// scannerEndpoint accepted without validation — SSRF to 169.254.169.254 leaks IAM creds.
async function runCustomScannerPlugin(auditContext, teamConfig) {
const { scannerEndpoint } = teamConfig; // user-controlled URL — no validation
const response = await fetch(scannerEndpoint, {
method: 'POST',
body: JSON.stringify(auditContext),
headers: { 'Content-Type': 'application/json' }
});
// Response body treated as rule violations — IMDS JSON parsed as findings
const findings = await response.json();
return findings; // IAM credentials appear as "findings" in audit report
}
// Attacker config: { scannerEndpoint: "http://169.254.169.254/latest/meta-data/iam/security-credentials/scanner-role" }
// Audit engine receives IAM JSON: { AccessKeyId, SecretAccessKey, Token } — stored in findings
Fix: Maintain an explicit allowlist of approved scanner endpoint domains in an environment variable, configured by the platform team. Resolve the hostname of any provided endpoint URL before making the request and block 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), and link-local addresses (169.254.0.0/16). Require HTTPS for all custom scanner endpoints. Apply a strict response schema (Zod) so only valid finding objects are accepted.
// SSRF33-001 — FIXED
const { isPrivateIP } = require('private-ip'); // blocks RFC1918 + 169.254.x.x + loopback
const ALLOWED_SCANNER_HOSTS = new Set(process.env.ALLOWED_SCANNER_HOSTS?.split(',') ?? []);
async function validateScannerEndpoint(url) {
const parsed = new URL(url); // throws on invalid URL
if (parsed.protocol !== 'https:') throw new Error('Scanner endpoint must use HTTPS');
if (!ALLOWED_SCANNER_HOSTS.has(parsed.hostname)) {
throw new Error(`Scanner host ${parsed.hostname} not in allowlist`);
}
// Resolve hostname and check for private IPs
const { address } = await dns.promises.lookup(parsed.hostname);
if (isPrivateIP(address)) throw new Error(`Scanner host resolves to private IP: ${address}`);
}
async function runCustomScannerPlugin(auditContext, teamConfig) {
await validateScannerEndpoint(teamConfig.scannerEndpoint); // throws if invalid
const response = await fetch(teamConfig.scannerEndpoint, {
method: 'POST', body: JSON.stringify(auditContext),
headers: { 'Content-Type': 'application/json' },
signal: AbortSignal.timeout(5000),
redirect: 'error' // block redirects
});
const raw = await response.json();
return z.array(FindingSchema).parse(raw); // strict schema — no arbitrary fields
}
SSRF33-002 — Rule update check fetches user-supplied URL to internal Confluence
The custom rule synchronization feature allows users to point the audit engine at a URL hosting their custom YAML detection rules. The engine fetches this URL on a periodic schedule and updates the team's rule set. The URL is accepted from the user without restriction. An attacker can set ruleSourceUrl to an internal Confluence instance URL (e.g., http://confluence.internal/rest/api/content/12345?expand=body.view). The engine fetches the page, receives Confluence REST API JSON, and attempts to parse it as a YAML rule set — with the page content stored in the rule database when YAML parsing partially succeeds on the embedded text content.
// SSRF33-002 — VULNERABLE
// ruleSourceUrl fetched without restriction — SSRF to internal Confluence stores wiki content as rules.
async function syncCustomRules(teamId, ruleSourceUrl) {
// No URL validation — any URL including internal services
const response = await fetch(ruleSourceUrl);
const yamlText = await response.text();
const rules = yaml.parse(yamlText); // Confluence JSON partially parsed as YAML — stored as rules
await db.customRules.upsert(teamId, rules);
}
Fix: Restrict ruleSourceUrl to an allowlist of trusted code hosting domains (GitHub raw content, GitLab raw content). Validate the URL scheme is HTTPS. After fetching, enforce a strict content-type check (text/plain or text/yaml). Parse the YAML and validate every entry against a strict RuleSchema before storing — reject any response that is not a valid array of detection rule objects.
// SSRF33-002 — FIXED
const ALLOWED_RULE_HOSTS = new Set([
'raw.githubusercontent.com',
'gitlab.com',
'raw.gitlab.com',
]);
async function syncCustomRules(teamId, ruleSourceUrl) {
const parsed = new URL(ruleSourceUrl);
if (parsed.protocol !== 'https:') throw new Error('Rule source URL must use HTTPS');
if (!ALLOWED_RULE_HOSTS.has(parsed.hostname)) {
throw new Error(`Rule source host ${parsed.hostname} not in allowlist`);
}
const response = await fetch(ruleSourceUrl, {
redirect: 'error', signal: AbortSignal.timeout(10000)
});
const contentType = response.headers.get('content-type') ?? '';
if (!contentType.includes('text/plain') && !contentType.includes('text/yaml')) {
throw new Error(`Unexpected content-type: ${contentType}`);
}
const yamlText = await response.text();
const raw = yaml.parse(yamlText);
// Strict schema — only valid rule objects accepted
const rules = z.array(RuleSchema).parse(raw);
await db.customRules.upsert(teamId, rules);
}
SSRF33-003 — Audit callback enables Redis injection via HTTP/1.0 protocol confusion
The audit completion webhook feature POSTs a JSON summary to a user-configured auditCompleteUrl when a scan finishes. The fetch call uses no explicit HTTP version setting, so Node.js's HTTP library may fall back to HTTP/1.0 for non-standard ports. An attacker can set auditCompleteUrl to http://localhost:6379/ (the local Redis port). The audit engine establishes a TCP connection to Redis and sends an HTTP/1.0 POST request. The HTTP headers and JSON body are interpreted by Redis as RESP commands, allowing the attacker to inject arbitrary Redis commands via crafted JSON keys in the audit completion payload — for example, writing arbitrary key-value pairs or flushing the cache.
// SSRF33-003 — VULNERABLE
// auditCompleteUrl fetched without restriction — HTTP/1.0 to localhost:6379 enables Redis injection.
async function notifyAuditComplete(auditId, auditCompleteUrl, summary) {
// No URL validation — attacker sets to http://localhost:6379/
await fetch(auditCompleteUrl, {
method: 'POST',
body: JSON.stringify(summary), // JSON body interpreted as RESP commands by Redis
headers: { 'Content-Type': 'application/json' }
});
}
// Attacker: auditCompleteUrl = "http://localhost:6379/"
// Audit engine sends HTTP POST to Redis port — headers/body interpreted as RESP
// Injected payload: {"SET": "session:admin": "attacker-controlled-value"}
Fix: Require HTTPS for all callback URLs. Resolve the hostname and block private IP ranges before making the request. Set redirect: 'error' to block redirects to internal services. Limit the callback response body read to a boolean acknowledgment — do not store or process the response body. Apply a short timeout. For high-security deployments, use an egress proxy that enforces domain allowlists for all outbound webhook calls.
// SSRF33-003 — FIXED
const { isPrivateIP } = require('private-ip');
async function validateCallbackUrl(url) {
const parsed = new URL(url);
if (parsed.protocol !== 'https:') throw new Error('Callback URL must use HTTPS');
const { address } = await dns.promises.lookup(parsed.hostname);
if (isPrivateIP(address)) throw new Error(`Callback URL resolves to private IP: ${address}`);
}
async function notifyAuditComplete(auditId, auditCompleteUrl, summary) {
await validateCallbackUrl(auditCompleteUrl);
let success = false;
try {
const res = await fetch(auditCompleteUrl, {
method: 'POST',
body: JSON.stringify({ auditId, grade: summary.grade }), // minimal payload — no sensitive data
headers: { 'Content-Type': 'application/json' },
redirect: 'error',
signal: AbortSignal.timeout(5000)
});
success = res.ok;
} catch (err) {
logger.warn('Audit callback failed', { auditId, error: err.message });
}
return success; // boolean only — response body not read
}
SSRF33-004 — CVE feed sync fetches user-supplied URL to internal JIRA
The vulnerability database sync feature allows organization admins to configure a custom CVE feed URL that supplements the default NVD and MITRE feeds. The engine periodically fetches this URL and imports new CVE records from the response. Without URL validation, an attacker can set cveSourceUrl to an internal JIRA REST API endpoint (e.g., http://jira.internal/rest/api/2/search?jql=project=SEC). The engine fetches the endpoint, receives JIRA issue JSON, and partially imports JIRA issue fields as CVE records — polluting the vulnerability database with internal issue tracker data and potentially exposing internal security issue descriptions in audit reports.
// SSRF33-004 — VULNERABLE
// cveSourceUrl fetched without restriction — SSRF to internal JIRA stores issue JSON as CVE records.
async function syncCveFeed(orgId, cveSourceUrl) {
const response = await fetch(cveSourceUrl); // no validation — attacker sets to internal JIRA
const data = await response.json();
// JIRA issue JSON partially parsed as CVE records — internal issue descriptions stored in DB
const cves = Array.isArray(data) ? data : data.issues ?? data.vulnerabilities ?? [];
await db.cveRecords.upsertMany(orgId, cves);
}
Fix: Restrict CVE feed URLs to an explicit allowlist of official NVD and MITRE CVE feed endpoints. After fetching, validate the response against a strict CVE JSON schema (NVD CVE API 2.0 format) before importing. Reject any response that does not conform to the expected schema. Do not allow custom CVE feed URLs from user configuration — use only the platform-configured official feeds.
// SSRF33-004 — FIXED
// Official NVD and MITRE CVE feed URLs — not user-configurable
const OFFICIAL_CVE_FEEDS = new Set([
'https://services.nvd.nist.gov/rest/json/cves/2.0',
'https://cveawg.mitre.org/api/cve',
]);
const CveRecordSchema = z.object({
id: z.string().regex(/^CVE-\d{4}-\d{4,}$/),
description: z.string().max(8192),
severity: z.enum(['CRITICAL', 'HIGH', 'MEDIUM', 'LOW', 'NONE']),
cvssScore: z.number().min(0).max(10).optional(),
publishedDate: z.string().datetime(),
});
async function syncCveFeed() {
for (const feedUrl of OFFICIAL_CVE_FEEDS) {
// No user-supplied URL — only platform-configured official feeds
const response = await fetch(feedUrl, {
redirect: 'error', signal: AbortSignal.timeout(30000)
});
const data = await response.json();
// Strict schema — only valid CVE records accepted
const cves = z.array(CveRecordSchema).parse(data.vulnerabilities ?? data);
await db.cveRecords.upsertMany(null, cves); // null orgId = platform-wide feed
}
}
Summary
| Finding | Pattern | Severity | Fix |
|---|---|---|---|
| SSRF33-001 | Custom scanner endpoint fetches 169.254.169.254 — IAM credential exposure | CRITICAL | Allowlist of approved scanner hosts from env var; DNS private-IP block; HTTPS only |
| SSRF33-002 | Rule update check fetches arbitrary URL including internal Confluence | HIGH | Allowlist GitHub/GitLab raw URLs only; strict YAML rule schema validation |
| SSRF33-003 | Audit callback to localhost:6379 via HTTP/1.0 enables Redis injection | HIGH | HTTPS only; DNS private-IP block; redirect:error; return boolean only |
| SSRF33-004 | CVE feed sync fetches user-supplied URL to internal JIRA | HIGH | Allowlist official NVD and MITRE URLs only; strict CVE JSON schema validation |
Related: SA-SKL-SSRF32 (skill installation and dependency download pipeline SSRF), SA-SKL-SSRF31 (skill repository clone and git metadata fetch SSRF). Run SkillAudit to detect all SSRF33 patterns in your MCP skill registry.