← Blog

Claude MCP skill SSRF — badge generation and social preview rendering — SA-SKL-SSRF26

Badge generation and social preview rendering are trust signals in MCP skill registries — they tell consumers at a glance whether a skill is well-tested and maintained. When these rendering pipelines make server-side HTTP requests to developer-supplied URLs without an SSRF guard, they expose the registry's internal network to probing and credential theft. SA-SKL-SSRF26 covers four SSRF patterns that emerge from the SVG badge endpoint, Puppeteer social screenshots, wkhtmltopdf PDF export, and oEmbed discovery polling in a typical MCP skill registry.

By SkillAudit  |  13 Nov 2026
SA-SKL-SSRF26 findings at a glance
CRITICALSSRF26-001 — SVG badge generator reads auditScoreEndpoint from the DB (a user-supplied URL) and makes a server-side GET to retrieve the live score; attacker sets it to http://169.254.169.254/latest/meta-data/iam/security-credentials/prod-role and the JSON AWS credentials are cached in the badge SVG for 5 minutes and served to all badge consumers
HIGHSSRF26-002 — Puppeteer loads the skill's CSS theme URL when generating 1200×630 social preview screenshots; attacker sets theme to http://10.0.0.100:6379/ (Redis) or http://localhost:9200/ (Elasticsearch); Puppeteer fetches the URL and returns the internal service banner in the preview error response
HIGHSSRF26-003 — wkhtmltopdf generates PDF audit exports by rendering README markdown-to-HTML; image src values in the HTML are fetched server-side by wkhtmltopdf; attacker submits a README with ![](file:///etc/passwd) or ![](http://169.254.169.254/latest/meta-data/) and the fetched content is embedded as a data URI in the exported PDF
MEDIUMSSRF26-004 — The registry periodically fetches each skill's oembedDiscovery field server-side to check oEmbed registration status; attacker sets oembedDiscovery to http://internal-ci.company.com/api/jobs or http://10.0.0.1:8080 and the registry probes internal services on each scheduled poll

Background: rendering pipelines as SSRF entry points

Badge generators, screenshot tools, PDF exporters, and oEmbed integrators all share a common pattern: they accept a URL from a developer-controlled field and make a server-side HTTP request to that URL as part of rendering. Unlike webhook delivery (where the URL is validated once at configuration time), rendering pipelines often fetch the URL at request time, creating a persistent SSRF channel for as long as the skill is registered. SA-SKL-SSRF26 is distinct from earlier SSRF findings in that the attack vector is embedded in the visual identity features of the registry — the badge that developers embed in their READMEs, the OG image that appears in social shares, and the PDF that auditors download.

The four findings share the same root cause — missing SSRF guard — but differ in the data path. SSRF26-001 caches credentials in a public CDN edge. SSRF26-002 exploits headless browser network access. SSRF26-003 abuses a legacy PDF tool's local file access. SSRF26-004 creates a persistent polling SSRF via a scheduled job. Each requires a different layer in the fix stack.

SSRF26-001 — CRITICAL — Badge endpoint fetches auditScoreEndpoint without SSRF guard

The SVG badge generator at GET /api/badges/:skillId reads the skill's auditScoreEndpoint field from the database and makes a server-side HTTP GET request to that URL to retrieve the current numeric grade. The response is parsed for a JSON score field and embedded in the SVG template. The result is cached in the CDN edge for 5 minutes. An attacker registers a skill and sets auditScoreEndpoint to http://169.254.169.254/latest/meta-data/iam/security-credentials/prod-role. The badge server fetches this URL, receives the AWS IAM temporary credentials JSON (AccessKeyId, SecretAccessKey, Token), embeds it in the SVG's <text> element, and caches the response. Any consumer that fetches the badge URL — including GitHub README renderers, CI dashboards, and monitoring tools — receives the credentials in the SVG source. The attacker inspects the SVG text content to extract the credentials and uses them to access the registry's AWS resources.

The fix is to validate auditScoreEndpoint through an SSRF guard at both write time (when the skill is registered or updated) and fetch time (when the badge is generated). HTTPS-only, DNS IP range validation blocking RFC1918 and link-local ranges, redirect: 'error' to prevent redirect chains, a 2-second timeout, and a 64 KB body limit. Prefer an allowlist of known monitoring domains (api.github.com, shields.io, badgen.net) over a blocklist.

Vulnerable
// VULNERABLE — SSRF26-001
// routes/badges.js

router.get('/api/badges/:skillId', async (req, res) => {
  const skill = await db.skills.findOne({ id: req.params.skillId });
  if (!skill) return res.status(404).send('Not found');

  let score = 'N/A';

  // BUG: auditScoreEndpoint is a user-supplied URL — no SSRF guard
  // attacker sets: http://169.254.169.254/latest/meta-data/iam/security-credentials/prod-role
  if (skill.auditScoreEndpoint) {
    try {
      const r = await fetch(skill.auditScoreEndpoint, {
        signal: AbortSignal.timeout(5000),
        headers: { Accept: 'application/json' },
      });
      const data = await r.json();
      score = data.score ?? 'N/A';  // AWS creds JSON has no .score — 'N/A' but full JSON cached
    } catch { /* silent — still caches last response body in CDN */ }
  }

  const svg = buildBadgeSvg(skill.name, score);
  res.set('Content-Type', 'image/svg+xml');
  res.set('Cache-Control', 'public, max-age=300');  // 5-min CDN cache of IMDS response
  res.send(svg);
});
Fixed
// FIXED — SSRF26-001
// routes/badges.js
const { validateSsrfSafe } = require('../utils/ssrf-guard');

// Allowlist: auditScoreEndpoint must be on an approved monitoring platform
const SCORE_ENDPOINT_ALLOWLIST = new Set([
  'api.github.com',
  'shields.io',
  'badgen.net',
  'api.skillaudit.dev',
]);

async function fetchScore(auditScoreEndpoint) {
  const url = new URL(auditScoreEndpoint);

  // Allowlist check: reject unknown hosts before SSRF guard
  if (!SCORE_ENDPOINT_ALLOWLIST.has(url.hostname)) {
    throw new Error(`Score endpoint host not in allowlist: ${url.hostname}`);
  }

  // SSRF guard: DNS resolve + RFC1918 block + HTTPS-only
  await validateSsrfSafe(auditScoreEndpoint);

  const r = await fetch(auditScoreEndpoint, {
    redirect: 'error',          // no redirects
    signal: AbortSignal.timeout(2000),
    headers: { Accept: 'application/json' },
  });

  // Body size limit — 64 KB
  const text = await r.text();
  if (text.length > 65536) throw new Error('Score response too large');

  const data = JSON.parse(text);
  if (typeof data.score !== 'number') throw new Error('Invalid score response');
  return data.score;
}

router.get('/api/badges/:skillId', async (req, res) => {
  const skill = await db.skills.findOne({ id: req.params.skillId });
  if (!skill) return res.status(404).send('Not found');

  let score = 'N/A';
  if (skill.auditScoreEndpoint) {
    try {
      score = await fetchScore(skill.auditScoreEndpoint);
    } catch (e) {
      logger.warn({ skillId: skill.id, err: e.message }, 'badge score fetch failed');
    }
  }

  const svg = buildBadgeSvg(skill.name, score);
  res.set('Content-Type', 'image/svg+xml');
  res.set('Cache-Control', 'public, max-age=300');
  res.send(svg);
});

SSRF26-001 impact: The badge CDN cache amplifies the attack — the IMDS credential JSON is cached at every CDN edge that serves the badge, and GitHub's image proxy fetches badges eagerly when README pages load. The attacker harvests the credentials from any CDN-cached copy of the SVG source before the 5-minute TTL expires. SkillAudit detects this by registering a skill with auditScoreEndpoint set to a canary HTTP endpoint and verifying whether the badge server makes an outbound request.

SSRF26-002 — HIGH — Puppeteer loads user-supplied CSS theme URL in social preview

Puppeteer is used to generate 1200×630 social preview screenshots of each skill's landing page. The skill's CSS theme URL is stored in the registry and injected into the preview page's <head> as a <link rel="stylesheet"> tag before Puppeteer takes the screenshot. An attacker sets their skill's theme CSS URL to http://10.0.0.100:6379/ (a Redis instance on the internal Docker network) or http://localhost:9200/ (Elasticsearch). When Puppeteer loads the preview page it makes an HTTP request to the CSS URL. Redis responds with inline protocol bytes (-ERR unknown command followed by RESP data). Puppeteer completes the HTTP connection and the response body is processed as CSS. The Redis banner text appears in Puppeteer's network log and, on some configurations, in the page's computed style error output, which is returned to the caller in the screenshot error response body. Even without reading the response, the attacker learns that the port is open and responding — an internal port scan via the registry's screenshot worker.

The fix is to run Puppeteer with request interception enabled via page.setRequestInterception(true) and block all requests that are not HTTPS or that resolve to RFC1918 IP ranges. Never inject user-supplied CSS URLs into the preview page template; instead, resolve user CSS to a registry-hosted stylesheet from an approved CDN or the registry's own asset server.

Vulnerable
// VULNERABLE — SSRF26-002
// services/social-preview.js
const puppeteer = require('puppeteer');

async function generateSocialPreview(skill) {
  const browser = await puppeteer.launch({ args: ['--no-sandbox'] });
  const page = await browser.newPage();

  // BUG: skill.themeUrl is user-supplied — injected into preview page without SSRF guard
  // attacker sets themeUrl = "http://10.0.0.100:6379/"
  const previewHtml = `
    
      
    
      

${skill.name}

`; await page.setContent(previewHtml); await page.setViewport({ width: 1200, height: 630 }); const screenshot = await page.screenshot({ type: 'png' }); await browser.close(); return screenshot; }
Fixed
// FIXED — SSRF26-002
// services/social-preview.js
const puppeteer = require('puppeteer');
const ipRangeCheck = require('ip-range-check');
const { Resolver } = require('dns').promises;

const BLOCKED_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', '100.64.0.0/10',
];

// Approved CSS CDN hostnames — user theme URLs must come from these
const CSS_HOST_ALLOWLIST = new Set([
  'cdn.skillaudit.dev',
  'unpkg.com',
  'cdn.jsdelivr.net',
]);

async function generateSocialPreview(skill) {
  const browser = await puppeteer.launch({ args: ['--no-sandbox'] });
  const page = await browser.newPage();

  // Block non-approved URLs at the network level
  await page.setRequestInterception(true);
  const resolver = new Resolver();

  page.on('request', async (request) => {
    const url = new URL(request.url());

    // Block non-HTTPS
    if (url.protocol !== 'https:') {
      return request.abort('blockedbyclient');
    }

    // Block requests to RFC1918 ranges via DNS resolution
    try {
      const addrs = await resolver.resolve4(url.hostname).catch(() => []);
      for (const ip of addrs) {
        if (ipRangeCheck(ip, BLOCKED_RANGES)) {
          return request.abort('blockedbyclient');
        }
      }
    } catch {
      return request.abort('blockedbyclient');
    }

    request.continue();
  });

  // Only inject CSS from allowlisted hosts — never raw user URL
  let safeThemeUrl = '';
  if (skill.themeUrl) {
    try {
      const u = new URL(skill.themeUrl);
      if (u.protocol === 'https:' && CSS_HOST_ALLOWLIST.has(u.hostname)) {
        safeThemeUrl = skill.themeUrl;
      }
    } catch { /* ignore invalid URL */ }
  }

  const previewHtml = `
    
      ${safeThemeUrl ? `` : ''}
    
      

${escapeHtml(skill.name)}

`; await page.setContent(previewHtml); await page.setViewport({ width: 1200, height: 630 }); const screenshot = await page.screenshot({ type: 'png' }); await browser.close(); return screenshot; }

SSRF26-002 impact: The Puppeteer worker runs inside the registry's internal Docker network, giving it access to Redis, Elasticsearch, internal APIs, and the Kubernetes API server. Without request interception, Puppeteer follows all URLs including HTTP to RFC1918 addresses. Even a failed connection (timeout or protocol mismatch) confirms that a port is open, enabling internal network mapping. SkillAudit detects this by submitting a skill with a theme URL pointing to a canary endpoint and monitoring for outbound connections from the screenshot worker's IP range.

SSRF26-003 — HIGH — wkhtmltopdf fetches README image URLs including file:// and IMDS

wkhtmltopdf is used to generate PDF audit report exports. The skill's README is embedded in the PDF via its markdown-to-HTML render. Image tags in the rendered HTML — including those with file:// and http:// URLs — are fetched server-side by wkhtmltopdf during PDF generation. An attacker submits a skill with a README containing ![](file:///etc/passwd). wkhtmltopdf opens the local file, reads its contents, and embeds the text as a data URI in the PDF image element. The exported PDF, served to the downloader, contains the full /etc/passwd file. An alternative payload ![](http://169.254.169.254/latest/meta-data/) causes wkhtmltopdf to fetch the IMDS index page. Because wkhtmltopdf follows HTTP redirects by default, a chain like ![](http://evil.com/redirect-to-imds) also works if the registry allows HTTP image URLs from arbitrary hosts.

The fix has four parts: (1) strip or rewrite all src attributes before passing HTML to wkhtmltopdf, keeping only https:// image URLs from an approved CDN; (2) run wkhtmltopdf with --disable-local-file-access to block file:// URLs; (3) add --disable-javascript to prevent JS-triggered fetches; (4) pass --load-error-handling ignore --load-media-error-handling ignore so that blocked fetches produce blank images rather than halting generation.

Vulnerable
// VULNERABLE — SSRF26-003
// services/pdf-export.js
const { execFile } = require('child_process');
const marked = require('marked');

async function exportReportPdf(report, skill) {
  // BUG: README markdown rendered to HTML — img src values not stripped
  // attacker README: "![](file:///etc/passwd)" or "![](http://169.254.169.254/...)"
  const readmeHtml = marked.parse(skill.readme);

  const pageHtml = `
    

Audit Report: ${skill.name}

${readmeHtml}
`; // wkhtmltopdf fetches all img src values server-side including file:/// and IMDS URLs return new Promise((resolve, reject) => { const child = execFile('wkhtmltopdf', ['-', '-'], (err, stdout) => { if (err) return reject(err); resolve(Buffer.from(stdout, 'binary')); }); child.stdin.end(pageHtml); }); }
Fixed
// FIXED — SSRF26-003
// services/pdf-export.js
const { execFile } = require('child_process');
const marked = require('marked');
const { JSDOM } = require('jsdom');

const IMG_HOST_ALLOWLIST = new Set([
  'cdn.skillaudit.dev',
  'raw.githubusercontent.com',
  'avatars.githubusercontent.com',
]);

function sanitizeHtmlForPdf(html) {
  const dom = new JSDOM(html);
  const doc = dom.window.document;

  // Strip all img src values not from approved CDN hosts
  for (const img of doc.querySelectorAll('img')) {
    try {
      const src = new URL(img.getAttribute('src') || '');
      if (src.protocol !== 'https:' || !IMG_HOST_ALLOWLIST.has(src.hostname)) {
        img.removeAttribute('src');  // blank image — wkhtmltopdf skips it
      }
    } catch {
      img.removeAttribute('src');  // relative or invalid URL — remove
    }
  }

  // Also strip all anchor href values with non-https protocols
  for (const a of doc.querySelectorAll('a[href]')) {
    try {
      const href = new URL(a.getAttribute('href'));
      if (href.protocol !== 'https:') a.removeAttribute('href');
    } catch {
      a.removeAttribute('href');
    }
  }

  return dom.serialize();
}

async function exportReportPdf(report, skill) {
  const readmeHtml = marked.parse(skill.readme);
  const safeReadme = sanitizeHtmlForPdf(readmeHtml);

  const pageHtml = `
    

Audit Report: ${escapeHtml(skill.name)}

${safeReadme}
`; const args = [ '--disable-local-file-access', // block file:/// URLs '--disable-javascript', // block JS-triggered fetches '--load-error-handling', 'ignore', '--load-media-error-handling', 'ignore', '-', '-', ]; return new Promise((resolve, reject) => { const child = execFile('wkhtmltopdf', args, { encoding: 'binary' }, (err, stdout) => { if (err) return reject(err); resolve(Buffer.from(stdout, 'binary')); }); child.stdin.end(pageHtml); }); }

SSRF26-003 impact: wkhtmltopdf's local file access is not disabled by default. On Linux hosts, file:///etc/passwd, file:///proc/self/environ (which may contain AWS_ACCESS_KEY_ID), and file:///etc/kubernetes/serviceaccount/token are all readable by the wkhtmltopdf process. Any user who requests a PDF export of an attacker's skill receives a document containing the exfiltrated file contents. SkillAudit detects this pattern by scanning for wkhtmltopdf invocations where the HTML input is derived from user-supplied markdown without prior src attribute sanitization.

SSRF26-004 — MEDIUM — oEmbed discovery URL polled server-side without validation

The registry supports oEmbed embedding of skill previews via a standard oEmbed endpoint. Skill manifests include an oembedDiscovery field containing a provider URL that the registry will ping periodically to register the skill with oEmbed consumers. A scheduled job runs every 15 minutes and fetches each skill's oembedDiscovery URL to check registration status. The URL is taken directly from the database without re-validation. An attacker registers a skill with oembedDiscovery set to http://internal-ci.company.com/api/jobs or http://10.0.0.1:8080. Every 15 minutes the registry's scheduler worker makes an HTTP GET to the internal CI or router address. The response is not stored, but the persistent polling enables timing-based internal service discovery: if the response time drops or the error type changes, the attacker learns about internal service state changes.

The fix requires validating oembedDiscovery through the SSRF guard at write time (before storing) and re-validating at fetch time (since the guard state does not persist across URL updates). Additionally, restrict oembedDiscovery to a known allowlist of oEmbed consumer domains. Only skip the scheduled fetch if the URL fails validation — do not silently continue with the unvalidated URL.

Vulnerable
// VULNERABLE — SSRF26-004
// workers/oembed-ping.js

const { db } = require('../db');

async function pingOembedDiscoveryUrls() {
  const skills = await db.skills.findMany({
    where: { oembedDiscovery: { not: null } },
  });

  // BUG: oembedDiscovery URL taken from DB without SSRF validation
  // attacker registered with: { oembedDiscovery: "http://internal-ci.company.com/api/jobs" }
  for (const skill of skills) {
    try {
      await fetch(skill.oembedDiscovery, {
        method: 'GET',
        signal: AbortSignal.timeout(10000),
      });
      // response not checked — but internal CI endpoint is polled every 15 minutes
    } catch { /* silent */ }
  }
}

// runs every 15 minutes
setInterval(pingOembedDiscoveryUrls, 15 * 60 * 1000);
Fixed
// FIXED — SSRF26-004
// workers/oembed-ping.js
const { db } = require('../db');
const { validateSsrfSafe } = require('../utils/ssrf-guard');

// Allowlist: oEmbed consumers must be on approved provider platforms
const OEMBED_HOST_ALLOWLIST = new Set([
  'oembed.com',
  'publish.twitter.com',
  'www.youtube.com',
  'vimeo.com',
  'skillaudit.dev',
]);

async function validateOembedUrl(url) {
  // 1. SSRF guard: DNS resolution + RFC1918 block + HTTPS-only
  await validateSsrfSafe(url);

  // 2. Allowlist: only approved oEmbed consumer platforms
  const parsed = new URL(url);
  if (!OEMBED_HOST_ALLOWLIST.has(parsed.hostname)) {
    throw new Error(`oEmbed discovery host not in allowlist: ${parsed.hostname}`);
  }
}

async function pingOembedDiscoveryUrls() {
  const skills = await db.skills.findMany({
    where: { oembedDiscovery: { not: null } },
  });

  for (const skill of skills) {
    try {
      // Re-validate on each fetch — guard state does not persist across URL updates
      await validateOembedUrl(skill.oembedDiscovery);

      await fetch(skill.oembedDiscovery, {
        method: 'GET',
        redirect: 'error',
        signal: AbortSignal.timeout(5000),
      });
    } catch (e) {
      logger.warn(
        { skillId: skill.id, oembedDiscovery: skill.oembedDiscovery, err: e.message },
        'oEmbed discovery ping failed or blocked'
      );
      // Optionally: mark skill.oembedDiscoveryBlocked = true to skip future fetches
    }
  }
}

setInterval(pingOembedDiscoveryUrls, 15 * 60 * 1000);

SSRF26-004 impact: While SSRF26-004 does not directly exfiltrate data (the response is discarded), persistent polling of internal services leaks network topology via timing side-channels and error patterns. If the attacker rotates between multiple internal IP:port combinations across different skill registrations, they can build a map of live internal hosts. SkillAudit flags scheduled fetch jobs that iterate over DB-sourced URLs without per-URL SSRF validation, and checks whether the validation at write time is repeated at fetch time.

Detection with SkillAudit

SkillAudit's SA-SKL-SSRF26 scanner covers all four rendering pipeline entry points. For SSRF26-001, the scanner registers a skill with auditScoreEndpoint pointing to a canary endpoint and monitors for badge server requests. For SSRF26-002, the scanner checks Puppeteer worker configuration for the absence of page.setRequestInterception(true) and RFC1918 blocking. For SSRF26-003, the scanner traces data flow from README markdown through the markdown-to-HTML renderer to execFile('wkhtmltopdf', ...) and verifies that src attribute stripping and --disable-local-file-access are both present. For SSRF26-004, the scanner detects scheduled job loops that call fetch() with a URL sourced from the database without per-iteration SSRF guard invocation.

FindingSeverityAttack targetFix
SSRF26-001CRITICALIMDS IAM creds via badge auditScoreEndpointSSRF guard + host allowlist + 2s timeout + 64 KB body limit
SSRF26-002HIGHInternal Redis/Elasticsearch via Puppeteer CSS URLpage.setRequestInterception + DNS RFC1918 block + CSS host allowlist
SSRF26-003HIGHLocal file read + IMDS via wkhtmltopdf img srcStrip src attrs + --disable-local-file-access + --disable-javascript
SSRF26-004MEDIUMInternal service polling via oEmbed discovery URLSSRF guard + oEmbed host allowlist + per-fetch re-validation

Related findings: SA-SKL-SSRF25 (documentation fetch SSRF), SA-SKL-SSRF24 (CI audit SSRF), SA-SKL-INJECTION14 (template injection in report generation).

Run SkillAudit against your MCP skill registry to detect all SA-SKL-SSRF26 patterns before they reach production. SkillAudit submits canary payloads to badge, screenshot, PDF, and oEmbed endpoints and monitors for outbound SSRF requests from your server infrastructure. Get started free