What Is SSRF and Why Identity Providers Are a Prime Target. SSRF makes a server send requests for an attacker. See how it works, why IdP features like request_uri and JWKS fetching expose it, and how to harden Keycloak.
SSRF (server-side request forgery) is a flaw where an attacker makes a server send requests on their behalf, often to internal systems or cloud metadata endpoints that the attacker cannot reach directly (CWE-918). Identity providers are prime targets because standard features such as the OpenID Connect request_uri parameter, JWKS fetching and SAML metadata import fetch remote URLs, and they do it from servers that hold signing keys and client secrets.
This post explains SSRF in general first: what it is, the basic and blind kinds, the cloud metadata attack and why deny lists fail. Then it goes through the identity provider features that make outbound requests, the SSRF vulnerabilities that have been published against Keycloak, and a hardening checklist for Keycloak covering client policies, egress allowlists, cloud metadata and logs.
Key takeaways
- SSRF happens when a server fetches a URL that a user controls without checking where the request really goes (OWASP Top 10).
- In an identity provider, the URLs come from clients, administrators and federation partners:
request_uri,jwks_uri,sector_identifier_uri, SAML metadata descriptor URLs, OIDC discovery, backchannel endpoints and client metadata documents.- Keycloak has had several published SSRF advisories, including CVE-2020-10770 through
request_uri(GitHub advisory).- Use allowlists at two layers: client policies that restrict client URIs inside Keycloak, and network egress rules that decide where the Keycloak server can connect at all.
What is SSRF?
Server-side request forgery is a vulnerability where a server “receives a URL or similar request from an upstream component and retrieves the contents of this URL” without making sure the request goes where it should (CWE-918). OWASP puts it more simply: “SSRF flaws occur whenever a web application is fetching a remote resource without validating the user-supplied URL” (OWASP Top 10, A10:2021).
The attacker never connects to the target themselves. They hand the vulnerable server a URL, and the server makes the request from its own position in the network, with its own network access and sometimes its own credentials. A web server usually sits inside a trusted network zone, so it can reach databases, admin interfaces, internal APIs and cloud services that a firewall hides from the internet. SSRF turns that trust into a path for the attacker.
SSRF entered the OWASP Top 10 in 2021 as its own category, A10, and OWASP says the category “is added from the Top 10 community survey (#1)”. In OWASP’s data it maps to one weakness, CWE-918, with 9,503 total occurrences and 385 CVEs (OWASP Top 10, A10:2021). Its average incidence rate in that data is 2.72%, which is low, but the practitioners who answered the survey still ranked it first.
Basic and blind SSRF
In a basic SSRF, the server returns the response of the forged request to the attacker. A preview feature that fetches a URL and shows the result is the classic example: point it at an internal admin page and the page comes back to you.
In blind SSRF, the application can be made “to issue a back-end HTTP request to a supplied URL”, but “the response from the back-end request is not returned in the application’s front-end response” (PortSwigger). The attacker still learns things from timing, error messages or a callback to a server they control, and they can still trigger actions on internal services that accept unauthenticated requests. Many SSRF paths in an identity provider are blind, because the server fetches a key set or a metadata document and uses it internally instead of showing it to the user.
Why is the cloud metadata service the usual target?
Cloud virtual machines can query an instance metadata service at a link-local address. On AWS that is 169.254.169.254 (AWS), and the service returns details about the instance, including temporary credentials for the IAM role attached to it. Only code running on the instance can reach that address, which is why it is such an attractive SSRF target: if a server will fetch any URL you give it, you can ask it to fetch its own cloud credentials.
AWS answered this with IMDSv2, where a client first sends a PUT request to get a session token, and “the PUT request returns a token that must be included in subsequent GET requests” (AWS). A typical SSRF can only make the server send a GET to a chosen URL, so it cannot complete that handshake. The OWASP cheat sheet calls IMDSv2 “an additional defense-in-depth mechanism for AWS that mitigates some of the instances of SSRF” (OWASP cheat sheet). It helps, but it does not stop requests to your other internal services.
Why do deny lists fail?
The natural first fix is to block addresses such as localhost, 127.0.0.1 and 169.254.169.254. OWASP advises against relying on it: “Do not mitigate SSRF via the use of a deny list or regular expression” (OWASP Top 10, A10:2021), and the cheat sheet files deny lists under “Last Resort” because “Deny-lists are bypass-prone. Prefer allow-lists” (OWASP cheat sheet).
The bypasses are well known, and PortSwigger describes several of them (PortSwigger). An address can be written in decimal, octal or IPv6 form, a public hostname can resolve to an internal address, and an allowed URL can redirect to a forbidden one. DNS rebinding is the hardest of these: the hostname resolves to a public address when you validate it and to an internal address when the server connects. The cheat sheet says “Domain allowlisting alone does not prevent DNS rebinding” and recommends a client that “connects to the validated IP while preserving the original hostname” (OWASP cheat sheet). It also tells you to disable redirect following in the HTTP client.
The reliable pattern is an allowlist of known destinations, enforced both where the application accepts a URL and in the network that carries the request. The rest of this post applies that pattern to an identity provider.
Why are identity providers a prime target for SSRF?
An identity provider has to talk to other systems as part of the protocols it implements. OpenID Connect and SAML were designed for federation between organizations, so many of their features take a URL from a client or a partner and have the identity provider download something from it. Each of those features is an outbound request whose destination someone other than the server operator chooses.
The server making those requests is also one of the most sensitive machines you run. It holds the realm’s private signing keys, the client secrets of every application, credentials to external identity providers, and often a database connection with the user store. In a cloud deployment it may also carry an IAM role. If an attacker gets cloud credentials from that host’s metadata service, or reaches internal services from it, the damage is not limited to one application, because every application that trusts tokens from that identity provider trusts the same keys.
Finally, many of these URLs can be set by parties outside your operations team. Keycloak’s own documentation lists who can point them at internal addresses: “a malicious administrator, a compromised account or a Dynamic Client Registration” (Keycloak Server Administration Guide). With Dynamic Client Registration, a client registers itself through an API, so whoever can call that API controls the URL fields of the client it creates.
Which identity provider features fetch remote URLs?
These are the standard features that make an identity provider send requests to a URL that someone else supplied. Keycloak supports all of them, and the table names the setting you will find in Keycloak.
| Feature | Who supplies the URL | What the server fetches | Where it is in Keycloak |
|---|---|---|---|
request_uri |
The client, on each authorization request | A signed request object | Client, Advanced tab, Valid request URIs |
jwks_uri |
The client, at registration | The client’s public keys | Client, Keys tab, Use JWKS URL |
sector_identifier_uri |
The client, at registration | A JSON list of redirect URIs | Pairwise subject identifier mapper |
| SAML metadata descriptor URL | An administrator, for a SAML client or identity provider | SAML metadata with certificates | Metadata descriptor URL and Use metadata descriptor URL |
| OIDC brokering | An administrator, for an external identity provider | Discovery document and JWKS | Identity provider settings, Use JWKS URL |
| Backchannel and CIBA endpoints | The client | Logout tokens and notifications | Client settings, Backchannel logout URL |
| Client ID Metadata Documents | Any client, as its client_id |
The client’s metadata | Client policy with trusted domains (experimental) |
OIDC request_uri
OpenID Connect lets a client pass its authorization request as a signed JWT, called a request object, either inline or by reference. With request_uri, “the Request Object value is retrieved from the resource at the specified URL”, and the specification says the authorization server “MUST send an HTTP GET request to the request_uri to retrieve the referenced Request Object” (OpenID Connect Core 1.0, sections 6.2 and 6.2.3). This request comes from an unauthenticated browser redirect, so anyone who knows a client ID can send one.
This was the path for CVE-2020-10770, where Keycloak before 13.0.0 let an attacker “force the server to call out an unverified URL using the OIDC parameter request_uri” (GitHub advisory GHSA-jh7q-5mwf-qvhw). In current Keycloak, the authorization endpoint compares a request_uri with the client’s list of valid request URIs and rejects one that does not match with “Specified ‘request_uri’ not allowed for this client.” before it fetches anything (Keycloak source, AuthorizationEndpointRequestParserProcessor.java). A request_uri that comes from Pushed Authorization Requests (PAR), which starts with urn:ietf:params:oauth:request_uri:, refers to a request already stored on the server and causes no fetch.
jwks_uri
A client that authenticates with a signed JWT (private_key_jwt) can publish its public keys at a jwks_uri, a URL that “contains the signing key(s) the Server uses to validate signatures from the Client” (OpenID Connect Dynamic Client Registration 1.0, section 2). The server downloads it whenever it needs to check a signature, and that check is triggered by token requests from the client. Keycloak’s documentation names the JWKS URI as its main example of a client field “that trigger[s] requests from the server” (Keycloak Server Administration Guide).
The same pattern was behind CVE-2026-1180, where, according to its advisory, Dynamic Client Registration in Keycloak accepted an arbitrary jwks_uri for private_key_jwt clients and fetched it without validating the destination (GitHub advisory GHSA-7vw6-5q2f-7w5r). OpenAM before 16.1.3 had a separate SSRF through an unvalidated jwks_uri, CVE-2026-105122 (NVD, CVE-2026-105122), which we covered in OpenAM PKCE bypass and JWKS SSRF: lessons for Keycloak OIDC clients.
sector_identifier_uri
Pairwise subject identifiers give each client a different user ID for the same person, and a client can group its redirect hosts under one sector_identifier_uri. The specification says this file “MUST be validated at registration time” (OpenID Connect Dynamic Client Registration 1.0, section 5), which means the server downloads it. Keycloak’s pairwise mapper validator fetches it with the server’s HTTP client (Keycloak source, PairwiseSubMapperValidator.java).
SAML metadata import and OIDC brokering
When Keycloak brokers logins to an external identity provider, it often loads that provider’s keys from a URL. For a SAML identity provider, the metadata descriptor URL “is used to download the Identity Provider certificates”, and with Use metadata descriptor URL on, Keycloak refreshes them from that URL automatically, including when a signature arrives with a certificate it has not cached yet (Keycloak Server Administration Guide). SAML clients have the same option for the service provider’s metadata. Our post on Keycloak SAML vulnerabilities and hardening covers the other attacks on SAML federation. For an OIDC identity provider with Use JWKS URL on, “Keycloak downloads the IDP’s public keys from the JWKS URL” (Keycloak Server Administration Guide).
Only administrators set these URLs, so the risk is a compromised or careless admin account rather than an anonymous attacker. That is still a real risk, because a federation trust is configured once and then fetched from for years. Our identity providers recipe for OIDC and SAML and the post on attribute mapping during OIDC identity brokering walk through these settings.
Backchannel, CIBA and client metadata documents
Some requests are pushed from the identity provider to the client instead of fetched. Backchannel logout sends a logout token to the client’s Backchannel logout URL, and Client-Initiated Backchannel Authentication (CIBA) notifies a client endpoint when a user approves a login. Keycloak has published advisories for both: CVE-2026-4874 involved the backchannel logout URL with the application.session.host placeholder and is fixed in 26.6.3 and 26.4.13 (GitHub advisory GHSA-22rm-wp4x-v5cx), and CVE-2026-1518 describes CIBA notification endpoints that were “insufficiently validated”, allowing blind requests to internal services (GitHub advisory GHSA-fwhw-chw4-gh37).
The newest feature in this list is the Client ID Metadata Document, where a client’s client_id is itself an HTTPS URL that the server fetches at request time. Keycloak’s support for it sits behind the cimd feature flag (Keycloak, Enabling and disabling features), and our post on Keycloak CIMD for MCP explains the client policy that accepts such clients only from a list of trusted domains. Any client can present such a URL, so that trusted domains list is your SSRF control for it.
The attacker sends an authorization request with a request_uri pointing at the metadata service (1), the identity provider fetches it from inside the network (2) and gets cloud credentials back (3). With a valid request URI list on the client and an egress allowlist on the network, the URL is rejected and the connection is blocked (4).
How do you harden Keycloak against SSRF?
Work at two layers. Inside Keycloak, restrict which URLs clients and administrators can store. In the network, restrict where the Keycloak process can connect, so that a URL that slips past the first layer still cannot reach anything sensitive. This checklist assumes a current Keycloak 26.x release; check the Keycloak release notes for the version that introduced each setting you use.
1. Keep Keycloak patched
The advisories above were fixed in specific releases, so the first control is running a current release on your line. Two of the newer advisories list no patched version on GitHub at the time of writing (CVE-2026-1180 and CVE-2026-1518), so for those the configuration below is your mitigation. Our Keycloak security audit and hardening checklist covers the patching routine along with the rest of the realm settings.
2. Restrict client URIs with client policies
Keycloak’s answer to SSRF is client policies, which validate a client’s settings when it is created or updated through the admin console, the Admin REST API or Dynamic Client Registration. The Server Administration Guide describes three executors for client URIs (Keycloak, Securing Client URIs):
- Secure Client URIs enforces HTTPS and no wildcards on all client URIs.
- Secure Redirect URIs Enforcer validates redirect URIs, for example against loopback addresses or permitted domains.
- Secure Client URIs Pattern Executor validates the URI fields you choose against a list of regular expressions. If a URI matches none of them, Keycloak rejects the change, and “If this list is empty or invalid, the executor blocks all URIs” (Keycloak, Secure Client URIs Pattern Executor).
The pattern executor is the one that stops SSRF, because it lets you allow only the hosts you trust. Keycloak’s documentation gives this pattern as an example for restricting client URIs to your own domains, which rejects localhost, numeric IP addresses and cloud metadata endpoints (Keycloak, Anti-SSRF Pattern Examples):
^https://([a-zA-Z0-9-]+\.)?mycompany\.com(/.*)?$
Replace mycompany\.com with your own domain, and add one pattern per third-party provider whose JWKS your clients really use. The executor uses Java regular expressions, so escape every literal dot, and test the patterns on a staging realm first, because a wrong pattern also blocks legitimate client updates. Create a client policy with a condition that covers the clients you want (the Any Client condition covers all of them) and attach a profile containing the executor.
3. Set valid request URIs, or require PAR
If your clients do not use request_uri by reference, leave Valid request URIs empty on the client’s Advanced tab, so Keycloak has nothing to match a request_uri against. If a client does use it, list the exact URLs; the admin console help says this list does not support wildcards or relative paths as Valid redirect URIs does (Keycloak admin console messages). Where you can, move clients to Pushed Authorization Requests, which send the request object to Keycloak over the backchannel and use a urn: reference that Keycloak does not fetch.
4. Lock down Dynamic Client Registration
Anonymous Dynamic Client Registration lets anyone who can reach the registration endpoint choose a jwks_uri, a sector_identifier_uri and backchannel URLs. Require initial access tokens for registration (Keycloak, Client registration service), apply the client policies above with a condition for clients created through Dynamic Client Registration, which Keycloak provides (Keycloak, Client policies), and review who holds client management roles. The OpenAM JWKS SSRF post goes through these settings in more detail.
5. Disable redirects and route outgoing traffic through an allowlist
Keycloak makes its outgoing requests with an HTTP client that you configure through the spi-connections-http-client options. Its allow-redirects option defaults to false, and the documentation recommends keeping it that way “to avoid redirects that could lead for example to server-side request forgery (SSRF)” (Keycloak, Configuring outgoing HTTP requests). If someone turned it on to make a provider work, turn it off and point the configuration at the final URL instead.
The same client supports proxy-mappings, a list of hostname patterns and proxies where “The proxy-uri of the first matching pattern is used”, and where the special value NO_PROXY sends matching hosts directly (Keycloak, Proxy mappings using regular expressions). A catch-all pattern at the end sends every other outbound request through an egress proxy that enforces your allowlist and logs each destination:
bin/kc.sh start \
--spi-connections-http-client--default--proxy-mappings='.*\\.mycompany\\.com;NO_PROXY,.*;http://egress-proxy.internal:3128'
The double backslash is needed because the configuration parses the list again, as the documentation’s own example shows. The first entry sends every host under mycompany.com directly, so those requests skip the egress proxy and its allowlist; drop that entry if you want the proxy to check them too. Replace the host names with yours, and configure the proxy to allow only the identity providers, JWKS hosts and metadata URLs that your realms really use.
6. Block the metadata service and internal ranges at the network layer
Application settings can be changed by an administrator, so back them up with network rules that Keycloak cannot override. Block outbound traffic from Keycloak hosts and pods to 169.254.169.254 and to internal ranges they have no reason to reach, using your cloud firewall or security groups, or a Kubernetes NetworkPolicy egress rule. Keycloak still needs its database, its cluster peers and the external hosts on your allowlist, so write the rule as “allow these, deny the rest”.
On AWS, require IMDSv2 by setting HttpTokens to required on the instances that run Keycloak, so requests without a valid session token “receive a 401 - Unauthorized HTTP error code” (AWS). AWS warns that applications still using IMDSv1 will break when you do this (AWS, instance metadata options), so check other agents on the host first. The default hop limit of 1 limits how far the token response can travel, and AWS notes that containers sometimes need a higher value; if nothing in the Keycloak container needs instance metadata, leave it at 1.
7. Protect against DNS rebinding
A hostname allowlist checks the name, not the address it resolves to when Keycloak connects. Keycloak’s documentation says that to mitigate DNS rebinding you should “configure the DNS resolver used by Keycloak to reject resolutions of public domain names to non-public/internal IP address ranges”, and that this is “an infrastructure-level mitigation applied in the DNS resolver, not a setting within Keycloak itself” (Keycloak, DNS Rebinding). An egress proxy that checks the resolved address before connecting gives you the same protection.
Patched on the day, not on your next maintenance window
Keycloak 26.7.2 fixed CVE-2026-18963, an account takeover through password reset. Skycloak had it available for auto-upgrade and told customers the same day upstream shipped it. Self-hosted teams schedule that work themselves.
How do you detect SSRF attempts against your identity provider?
SSRF through an identity provider is often blind, so you may not see the attacker read a response. Instead, look for the two things an attacker has to do: store a malicious URL, and make the server send a request to it.
- Client changes. Turn on admin events with Include representation in Realm settings, Events, so each change records the JSON sent through the Admin REST API (Keycloak, Auditing admin events). Alert when a client’s
jwksUri, request URIs, backchannel logout URL or identity provider metadata URL changes, especially to an IP address or an unfamiliar host. - New clients from Dynamic Client Registration. Review clients created through registration and their URL fields, and remove ones nobody owns.
- Rejected requests. A burst of authorization requests that Keycloak refuses for a disallowed
request_uri, or client updates refused by your client policies, means someone is probing. - Egress logs. Your egress proxy or firewall is the most reliable signal: any connection attempt from Keycloak to
169.254.169.254, to internal ranges or to a host outside your allowlist deserves an alert. - Cloud audit logs. If the Keycloak host has a cloud role, alert on that role’s credentials being used from anywhere other than the host itself.
Our Keycloak auditing and event logging guide explains how to store these events and send them to your SIEM.
Who is responsible for SSRF in managed and self-hosted identity providers?
When you run Keycloak yourself, you own every layer in this post: patching, client policies, the HTTP client configuration, egress rules, metadata service settings and monitoring. Our Keycloak production-ready checklist puts these next to the other settings a production cluster needs.
With a managed identity provider, ask the provider who patches the servers and how they restrict outbound traffic and access to cloud metadata, because those controls depend on how they run their infrastructure. The realm configuration stays yours: which clients may register, which request_uri and JWKS URLs they may use, and which identity providers you federate with. A provider cannot know that a client’s new jwks_uri is wrong for your organization. Our comparison of fully managed open source identity providers covers what else to ask before you choose one.
Frequently asked questions
What is the difference between SSRF and CSRF?
Cross-site request forgery (CSRF) tricks a user’s browser into sending a request with the user’s cookies, so the attacker acts as the user. Server-side request forgery tricks a server into sending a request from its own network position, so the attacker acts as the server. In an identity provider, SSRF is the more dangerous of the two because the server can reach internal networks and cloud credentials that no browser can.
Is SSRF in the OWASP Top 10?
Yes. It was added as A10:2021, Server-Side Request Forgery, and OWASP says it came in through the Top 10 community survey, where it ranked first (OWASP Top 10, A10:2021).
Does IMDSv2 prevent SSRF?
No. IMDSv2 makes it much harder to steal AWS instance credentials through SSRF, because a basic SSRF cannot perform the PUT request that obtains a session token, but the vulnerable server can still reach your other internal services. OWASP describes it as defense in depth that “mitigates some of the instances of SSRF” (OWASP cheat sheet).
Is Keycloak vulnerable to SSRF?
Keycloak has published several SSRF advisories, including CVE-2020-10770 through request_uri, CVE-2026-1180 through jwks_uri in Dynamic Client Registration, CVE-2026-1518 through CIBA notification endpoints and CVE-2026-4874 through the backchannel logout URL, each linked above. Current releases give you the controls to restrict every client URL field, but they work only once you configure the client policies, valid request URIs and network egress rules described in this post.
Which Keycloak client policy executor prevents SSRF?
The Secure Client URIs Pattern Executor. It validates the client URI fields you select, such as jwksUri, against an allowlist of regular expressions, and rejects any client creation or update with a URI that matches none of them (Keycloak Server Administration Guide).
What to do next
Start by listing which identity provider features in your realms fetch remote URLs: clients with a JWKS URL, valid request URIs, a sector identifier, backchannel URLs or SAML metadata URLs, and every identity provider that loads its keys from a URL. Then work through the checklist above: patch, add a Secure Client URIs Pattern policy, lock down Dynamic Client Registration, send Keycloak’s outbound traffic through an egress allowlist, block the metadata service, and alert on client URL changes and unexpected outbound connections.
If you would rather leave the servers, network and patching to someone else and keep only the realm configuration, take a look at managed Keycloak hosting with Skycloak.
Sources
- MITRE, “CWE-918: Server-Side Request Forgery (SSRF)”, retrieved 2026-11-18, cwe.mitre.org
- OWASP, “A10:2021 Server-Side Request Forgery (SSRF)”, retrieved 2026-11-18, owasp.org
- OWASP, “Server-Side Request Forgery Prevention Cheat Sheet”, retrieved 2026-11-18, cheatsheetseries.owasp.org
- PortSwigger, “Blind SSRF vulnerabilities”, retrieved 2026-11-18, portswigger.net
- OpenID Foundation, “OpenID Connect Core 1.0”, retrieved 2026-11-18, openid.net
- OpenID Foundation, “OpenID Connect Dynamic Client Registration 1.0”, retrieved 2026-11-18, openid.net
- AWS, “Use the Instance Metadata Service to access instance metadata”, retrieved 2026-11-18, docs.aws.amazon.com
- AWS, “Configure the instance metadata options”, retrieved 2026-11-18, docs.aws.amazon.com
- Keycloak, “Server Administration Guide”, sections “Mitigating Server-Side Request Forgery (SSRF)” and “Securing Client URIs”, retrieved 2026-11-18, keycloak.org
- Keycloak, “Configuring outgoing HTTP requests”, retrieved 2026-11-18, keycloak.org
- Keycloak security advisories, retrieved 2026-11-18: GHSA-jh7q-5mwf-qvhw (CVE-2020-10770), GHSA-7vw6-5q2f-7w5r (CVE-2026-1180), GHSA-fwhw-chw4-gh37 (CVE-2026-1518), GHSA-22rm-wp4x-v5cx (CVE-2026-4874)




