Docs / Detectors / SSRF

SSRF (Server-Side Request Forgery)

Your server fetches a URL that came from user input, and the URL points at internal infrastructure: cloud metadata, localhost, RFC 1918 ranges. validateUrl blocks the obvious cases plus encoding tricks; validateUrlAsync closes the DNS TOCTOU window.

What it catches

Sample payload

// Before
"http://169.254.169.254/latest/meta-data/iam/security-credentials/"

// validateUrl(url) returns false; in middleware, this raises
// vector=ssrf, rule=patterns.ssrf.cloud-metadata

Configuration

import { validateUrl, validateUrlAsync, safeFollowRedirect } from '@arcis/node';

// Sync, fast: pattern + IP-range checks
if (!validateUrl(user_url)) { res.status(400).send(); return; }

// Async, DNS-aware: closes the TOCTOU window
const ok = await validateUrlAsync(user_url);

// Manual redirect chain following with pinned DNS
const resp = await safeFollowRedirect(user_url);

Disable

The detector is opt-in. Call validateUrl wherever you fetch a URL provided by the user. There is no global disable.

References