What it is
Server-side request forgery, or SSRF, is a security flaw in which an application fetches a web address that an attacker controls or influences. Because the request comes from the server and not from the attacker's own computer, it can reach places the attacker normally cannot: internal admin pages, databases on a private network, or the cloud provider's metadata service.
Think of a receptionist who will phone any number you hand over. You cannot dial the CEO's private line. The receptionist can, and will, if you simply ask.
How it works
Many features make a server fetch a URL on a user's behalf: previewing a link, importing an image from an address, calling a webhook, or loading a document. If the app does not check where that URL points, an attacker can swap in an internal address. The server makes the call, and the response may come back to the attacker (basic SSRF) or only change something behind the scenes (blind SSRF).
The most serious targets are usually cloud credentials. Many cloud platforms expose an internal address that hands out temporary access keys to the machine running your code. An SSRF flaw can turn a harmless-looking image importer into a way to read those keys.
Why it matters if you use AI
AI features make SSRF easier to create. Tools that browse the web, fetch documents for retrieval-augmented generation, or let an AI agent call arbitrary URLs all ask a server to fetch something a user or a model chose. If a prompt injection convinces an agent to request an internal address, the effect is the same as classic SSRF.
SSRF is also on the OWASP lists of the most common web and API weaknesses, and attackers and automated tools probe for it routinely. It is one of several well-known flaws, alongside SQL injection, that penetration testing checks for.
How to reduce the risk
- Allow only a short list of domains the server may fetch, instead of trying to block bad ones.
- Give servers the least network access they need, so a forged request has little to reach. See least privilege.
- Run fetching features in an isolated environment with no access to internal services or cloud credentials.
- Do not return raw responses from fetched URLs to the user.
- Keep secrets out of places a server process can casually read.
SSRF is a cousin of remote code execution and privilege escalation: it often serves as the first step toward them. The fix is rarely one patch. It is a habit of treating every address a user supplies as untrusted.