Skip to main content
HighCodeOWASP A10:2021CWE-918

How to fix: Server-Side Request Forgery (SSRF) indicators

Code fetches URLs that may be derived from user-controlled input, potentially enabling SSRF attacks.

Why it matters

SSRF allows an attacker to make your server fetch internal URLs: cloud metadata endpoints (169.254.169.254), internal databases, or admin interfaces not exposed to the internet, potentially leaking credentials or enabling further privilege escalation.

When user-supplied URLs are passed directly to server-side HTTP clients, attackers can redirect requests to internal infrastructure.

How to fix it

  1. 1Allowlist permitted hosts and validate the URL before fetching
  2. 2Block RFC 1918 and RFC 5735 private IP ranges
  3. 3Use a dedicated egress proxy that enforces an allowlist

Code examples

Allowlist outbound hosts + block private IPs

TypeScript
const ALLOWED = new Set(["api.github.com", "api.stripe.com"]);

async function safeFetch(url: string) {
  const { hostname, protocol } = new URL(url);
  if (protocol !== "https:") throw new Error("HTTPS only");
  if (!ALLOWED.has(hostname)) throw new Error("Host blocked");
  return fetch(url, { signal: AbortSignal.timeout(5_000) });
}

References

Detected automatically by VulnRadar. The check id is ssrf-vulnerability, stable across every scan so you can filter or diff on it.

See every code check

Questions

How severe is Server-Side Request Forgery (SSRF) indicators?
VulnRadar rates this high severity in the code category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id ssrf-vulnerability, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Server-Side Request Forgery (SSRF) indicators map to?
It maps to CWE-918. In the OWASP Top 10 it falls under A10:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for server-side request forgery (ssrf) indicators

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

Server-Side Request Forgery (SSRF) indicators | VulnRadar