Skip to main content
MediumHost validationOWASP A10:2021CWE-918

How to fix: URL-Import Field From Request Passed to Outbound Call Unvalidated

Source text in the response shows a URL-import field (avatar/image/logo-by-URL, link-preview/unfurl, or PDF/export-from-URL) assigned directly from request input (req.body, req.query, req.params, or similar) and passed to an outbound HTTP client (fetch, axios, got, superagent, request) shortly after, with no private-IP or allowlist validation keyword found anywhere between the two.

Why it matters

If this shape reflects the server's real code path, an attacker who controls the field (an avatar-from-URL upload, a link-preview/unfurl request, or a PDF/export-from-URL job) can point it at internal services, cloud metadata endpoints, or other infrastructure the public internet cannot otherwise reach, and have your own server make the request on their behalf. These 'server fetches a URL you gave it' features are among the most common real-world SSRF vectors: image-import endpoints, chat-style link unfurling, and headless-browser/PDF export tools have all had SSRF advisories built on exactly this shape.

The check requires both halves of the pattern: an avatar/image/logo/preview/unfurl/embed/pdf/export-named variable ending in url/uri/link/src and sourced from req./request./body./params./query., and an outbound HTTP call syntactically nearby, with no mention of private/internal/loopback/localhost/isPrivateIP/isPrivateHostname/blocklist/denylist/allowlist/whitelist/allowed_hosts/ssrf in between. Unlike a bare topic-word match, the field name must end in a URL-shaped suffix (url/uri/link/src) so the check doesn't fire on unrelated fields that merely share a topic word, like an uploaded avatar file with no URL involved at all. A doc/tutorial page rendering the same snippet as literal example text inside <pre>/<code> is excluded. Because this reads response text rather than executing the code, it cannot confirm the validation genuinely runs before the fetch, only that no such check is visible in the surrounding text: treat it as a prompt to review the real request-handling code.

How to fix it

  1. 1Resolve the hostname of any user-supplied import/preview/export URL and reject private, loopback, and link-local ranges before making the outbound request.
  2. 2Re-check on every use, since the destination can be changed after initial validation and DNS can change between checks.
  3. 3Route these fetches through an egress proxy or allowlist rather than calling fetch/axios/got directly on user-supplied URLs.
  4. 4Disable HTTP redirects on the outbound client or re-validate the destination after each redirect hop.

Code examples

Validate before fetching a user-supplied import URL

TypeScript
// Bad: no validation between the request value and the outbound call
const avatarUrl = req.body.avatarUrl;
await fetch(avatarUrl);

// Good: validate the destination first
const avatarUrl = req.body.avatarUrl;
const { hostname, protocol } = new URL(avatarUrl);
if (protocol !== 'https:' || isPrivateHostname(hostname)) {
  throw new Error('Import source not allowed');
}
await fetch(avatarUrl, { signal: AbortSignal.timeout(5_000) });

References

Detected automatically by VulnRadar. The check id is url-import-ssrf-request-input-no-validation, stable across every scan so you can filter or diff on it.

See every host validation check

Questions

How severe is URL-Import Field From Request Passed to Outbound Call Unvalidated?
VulnRadar rates this medium severity in the host validation 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 url-import-ssrf-request-input-no-validation, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does URL-Import Field From Request Passed to Outbound Call Unvalidated 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 url-import field from request passed to outbound call unvalidated

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

URL-Import Field From Request Passed to Outbound Call Unvalidated | VulnRadar