OAuth redirect URI matcher
Test attacker-chosen redirect URIs against exact, prefix, host, and wildcard matching, and see which strategies leak an authorization code.
- Interactive lab
- Advanced
- 5 graded steps
- 0 of 5 solved
Your goal
Your goalFind the only matching strategy that never leaks the authorization code, and explain how each weaker one fails.
The client app registered https://app.contoso.example/callback as its redirect URI. An attacker sends victims authorization links with a different redirect_uri, hoping the authorization server will deliver the code somewhere they can read it.
Pick a matching strategy, test the six candidates or type your own, and see where the code would land. The client also has an open redirect at /go?url=, which matters more than it looks.
What’s on screen
- Matching strategy
- the four buttons on the left. Each is a different way the authorization server compares the redirect address.
- Registered
- the redirect address the client app signed up with, under the buttons.
- Server check
- the right side. It shows the comparison code, then one row per attacker address saying whether the code would leak.
- Try your own redirect_uri
- a box at the bottom where you can type any address and test it.
- Walkthrough
- the numbered path beside the workbench (below it on a phone). Each step says what to do and what you should see. Hints open one at a time.
Words to know
- URI
- uniform resource identifier, the path part of a web address
Matching strategy
Registered
https://app.contoso.example/callback
redirect_uri.startsWith("https://app.contoso.example/callback")- accepted
https://app.contoso.example/callbackThe code reaches the real callback. - leaks
https://app.contoso.example/callback/../go?url=https://evil.example/cThe browser resolves the path to /go, and the open redirect forwards the visitor, with the code still in the address, to evil.example. - rejected
https://app.contoso.example/go?url=https://evil.example/cThe authorization server refuses the request, so no code is issued. - rejected
https://evilcontoso.example/callbackThe authorization server refuses the request, so no code is issued. - rejected
https://evil.example/?.contoso.example/callbackThe authorization server refuses the request, so no code is issued. - rejected
http://app.contoso.example/callbackThe authorization server refuses the request, so no code is issued.
More in Web and API security
The whole walkthrough
Every step in order: 266 words, about 2 min. It gives away every answer, so try the steps first.