-
Notifications
You must be signed in to change notification settings - Fork 42
Description
A reviewer reminded me of The Most Common OAuth2 Vulnerability
How to detect, is certain OAuth implementation vulnerable?
If site doesn't send 'state' param and redirect_uri param is static and doesn't contain any random hashes - it's vulnerable.
Reviewing the implementation, there is no "state" parameter on the OAuth redirect or callback.
Digging into the Passport code, it looks like state isn’t enforced. It’s ok if it isn’t provided and also ignored if there isn’t a session store configured. I don’t have a session store configured, since that's more of an Express.js thing.
https://github.com/jaredhanson/passport-oauth2/blob/master/lib/strategy.js#L204
Here’s the some Google guides that talks about state.
https://developers.google.com/identity/protocols/OAuth2WebServer
https://developers.google.com/identity/protocols/OpenIDConnect#state-param
https://developers.google.com/identity/protocols/OpenIDConnect#createxsrftoken
So I think we need to come up with a Lambda@Edge friendly way to set “state” and verify it….