OAuth 2.0

Basics

https://oauth.net/2/

  • Client application - The website or web application that wants to access the user's data.

  • Resource owner - The user whose data the client application wants to access.

  • OAuth service provider - The website or application that controls the user's data and access to it. They support OAuth by providing an API for interacting with both an authorization server and a resource server.

  • Scope - The range of data for which access is requested.

Identification and Recon
  • If you see an option to log in using your account from a different website, this is a strong indication that OAuth is being used.

  • Proxy your traffic through something like Burp or ZAP and check the corresponding HTTP messages when you attempt to login. Regardless of which OAuth grant type is being used, the first request of the flow will always be to /authorization with a number of query parameters used specifically for OAuth. Make sure you look out for the client_id, redirect_uri, and response_type parameters.GET /authorization?client_id=12345&redirect_uri=https://client-app.com/callback&response_type=token&scope=openid%20profile&state=ae13d489bd00e3c24 HTTP/1.1 Host: oauth-authorization-server.com

  • Once you know the hostname of the auth server, you should test it with a GET request to these standard endpoints:

    • /.well-known/oauth-authorization-server

    • /.well-known/openid-configuration

  • If there is a response from the auth server, often times it will reply with a JSON file ripe with information that we can use, such as leads to a larger attack surface and config information.

OAuth Attacks

  • Improper implementation of the Implicit Grant type.

    • The client application will often submit a UserID and Access token to the server in a POST request, in order to be assigned a session cookie, essentially logging them in.

    • If the client application doesn't properly check that the access token matches the other data in the request, an attacker can manipulate the contents of the post request to impersonate any other user they choose.

    • Change the UserID value in the POST request to see if you can impersonate other users.

  • Flawed CSRF Protection

OpenID

https://portswigger.net/web-security/oauth/openid

  • OpenID Connect extends the OAuth protocol to provide a dedicated identity and authentication layer that sits on top of the basic OAuth implementation.

  • OpenID Connect slots neatly into the normal OAuth flows. From the client application's perspective, the key difference is that there is an additional, standardized set of scopes that are the same for all providers, and an extra response type: id_token.

  • Relying party - The application that is requesting authentication of a user. This is synonymous with the OAuth client application.

  • End user - The user who is being authenticated. This is synonymous with the OAuth resource owner.

  • OpenID provider - An OAuth service that is configured to support OpenID Connect.

Last updated