Skip to content
SSRF Write-up Intermediate

Real-life OIDC Security (IV): Server-Side-Request-Forgery

Keycloak and Amazon Cognito did not restrict the request_uri parameter or OpenID Connect Discovery endpoints, allowing an attacker to make the server send requests to internal hosts. This could enable blind SSRF, port scanning of localhost, and access to internal services.

security.lauritz-holtmann.de

Published on security.lauritz-holtmann.de

This is the fourth post of a series on Single Sign-On and OpenID Connect 1.0 security. In this post, SSRF vulnerabilities that were discovered in popular OIDC implementations (Keycloak (CVE-2020-10770) and Amazon Cognito) are explained in detail.

The author, on security.lauritz-holtmann.de

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the lack of validation or restriction on user-supplied URLs used for fetching remote resources (request_uri in Keycloak, discovery endpoints in Cognito).

Impact

An attacker could perform blind SSRF to scan internal ports and send requests to internal services, potentially gathering information about the internal network.

What the attacker needed

Valid client_id and redirect_uri; attacker can send requests to the IdP; for Cognito: admin access or malicious IdP

The fix

Keycloak should disable request_uri by default and restrict localhost/private IPs; Amazon Cognito should restrict internal IPs and localhost as OIDC endpoints. Both were fixed (Cognito in August 2020, Keycloak planned for v12).

How it was found

  1. Obtain a valid Authentication Request to get a valid client_id and redirect_uri.
  2. Send an Authentication Request with a request_uri pointing to an internal address.
  3. Observe that Keycloak sends a GET request to that address (blind SSRF).
  4. Measure response time to perform a port scan of localhost or internal hosts.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Server-Side Request Forgery (SSRF) is when an attacker tricks a server into making requests to places it shouldn't, like internal systems. Here, the login servers (Keycloak and Cognito) fetched a URL supplied by the attacker, letting the attacker probe the internal network.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.