Slide 15 of 28
Part 3 · Attack ScenariosSlide 15
Slide 15 · Scenario 2
An OAuth provider redirects to an internal URL. The consuming API follows it without validation.
The SSRF protection applied to user-supplied URLs doesn’t apply to redirects from a trusted OAuth provider.
📄 OWASP API Security Top 10 2023 · API10:2023 Example Attack Scenarios
SCENARIO 2
SSRF via trusted OAuth redirect chain

An API implements OAuth 2.0 social login via a third-party identity provider. During the OAuth flow, the API makes server-side requests to the identity provider’s endpoints to exchange authorization codes for tokens and to fetch the user’s profile data.

The API’s SSRF protection blocks user-supplied URLs that resolve to private IP ranges. But requests to the identity provider’s well-known endpoints — https://identity.provider.example.com/userinfo — are exempt from this validation because they are trusted third-party calls.

An attacker gains control of a subdomain of the identity provider (through a misconfigured DNS record or subdomain takeover). They set up a server at oauth.identity.provider.example.com that returns an HTTP 302 redirect pointing to http://169.254.169.254/latest/meta-data/iam/security-credentials/app-role. The consuming API follows the redirect — trusting that anything returned by the identity provider domain is safe — and receives IAM credentials from the AWS metadata service. The SSRF validation that would have blocked a user-supplied URL never fires for a redirect from a trusted source.

The API10 failure: SSRF protection was applied asymmetrically: user-supplied URLs were checked, third-party redirect destinations were not. The fix: apply redirect destination validation regardless of where the redirect came from. Validate the resolved IP of the redirect target, not just the source of the redirect.
← Back Scenario 3 →