Server-side URL fetching that can reach internal services (SSRF)
Last updated November 9, 2026
Steps
- Find every server-side fetch, axios or similar call, and every AI tool or agent action, where the URL comes from user input: forms, chat messages, webhook settings, document or image imports.
- Where you can, use an allow-list of the hosts you expect (for example only your storage bucket or Google Drive), and build the request yourself instead of accepting a full URL.
- If you must accept any public URL: allow only http and https, resolve the hostname, reject private, loopback, link-local and metadata addresses (127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.169.254, ::1, fc00::/7, fe80::/10), and connect to the exact IP you checked so DNS rebinding can't swap it.
- Turn off automatic redirect following in your HTTP client, or re-check every hop.
- Never send the raw response back to the user. Return only what the feature needs (a title and image for a preview, say), with a timeout and a size limit.
- On cloud servers, use the provider's hardened metadata service (for example AWS IMDSv2) and limit outbound network access where your host allows it.
Why it matters
OWASP's API Security Top 10 (2023) lists Server Side Request Forgery as API7. It says webhooks, fetching files from URLs, custom SSO and URL previews make SSRF more common, and that cloud and container management endpoints on well-known paths make it more dangerous. OWASP's SSRF Prevention Cheat Sheet advises against accepting complete URLs from users, recommends allow-lists, says to disable redirect following, and warns that checking a domain once doesn't stop DNS rebinding.
The same rules apply to any AI feature that fetches a URL on a user's behalf. Text in a chat or document can steer the AI to request an internal address, so put these checks in the fetch tool itself, not in the prompt.
Sources
OWASP API Security Top 10 2023, API7: Server Side Request Forgery — https://owasp.org/API-Security/editions/2023/en/0xa7-server-side-request-forgery/
OWASP Server Side Request Forgery Prevention Cheat Sheet — https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
Related patterns
Found a problem you'd rather not fix yourself?
Tell us what's wrong. A StorenTech engineer reviews your app and replies with a fixed quote, so you know the cost before any work starts.
Get it fixed by StorenTechVibe Security Weekly
One email a week with new failure patterns and how to fix them.
By joining you agree we may email you this newsletter. See our privacy policy. Free. Unsubscribe anytime. We'll never sell your email.