Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth PKCE Use Case #12

Open
sldab opened this issue Dec 22, 2017 · 0 comments
Open

OAuth PKCE Use Case #12

sldab opened this issue Dec 22, 2017 · 0 comments

Comments

@sldab
Copy link

sldab commented Dec 22, 2017

OAuth 2.0 works by issuing a redirect to an identity provider (IdP) and getting back an access token (implicit flow) or an authorization code (authorization code flow) appended to the application URL when being redirected back.

Now, both Android and iOS allow to register regular URLs as deep links that will open in your app instead of the browser. An attack vector on OAuth is to register the OAuth authorization endpoint as a deep link in order to intercept authorization requests and grab the access token or authorization code.

RFC 7636 allows to mitigate this attack but makes the authorization stateful on client side. In short, this is how it works: The OAuth client application generates a random string (code verifier), computes its SHA 256 hash and requests an authorization code together with this hash (code challenge). When requesting the access token in a backchannel request, it sends the authorization code together with the plain code verifier string, so the IdP can verify the hash value received before. Attackers can't easily guess the code verifier even if they intercepted the authorization request.

However, the plain code verifier string needs to be stored in the application and survive a redirect. Using local storage is one option, but local storage write access does not work in Safari private mode. Yet cookies are kept for the duration of the private browsing session in all browsers.

IdPs in areas with high security standards like ours only accept public OAuth clients that support PKCE. I'd like to provide an Elm OAuth library with PKCE support, but I don't see how to do this without resorting to native code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant