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

martini-contrib/oauth2 is unsafe and vulnerable to csrf #33

Open
jtolio opened this issue Sep 10, 2014 · 1 comment
Open

martini-contrib/oauth2 is unsafe and vulnerable to csrf #33

jtolio opened this issue Sep 10, 2014 · 1 comment

Comments

@jtolio
Copy link

jtolio commented Sep 10, 2014

the oauth2 "state" field, the first argument of AuthCodeURL, is supposed to be a CSRF token - a completely unguessable random string of bytes. further, on the callback, the oauth2 service will return the provided state and negroni-oauth2 should be checking it for equality

it's certainly clever that the next url is being passed in as the state field, but it's insecure. both the expected state and the next url should be kept in the session

http://tools.ietf.org/html/rfc6749#section-10.12

it may be safe to include additional information inside the state field besides a csrf token (e.g. the next url field), but any benefit from that is possibly negated by having to store the expected csrf token somewhere

check out https://github.com/jtolds/go-oauth2http

@rakyll
Copy link
Contributor

rakyll commented Sep 18, 2014

We should allow user to set a random token before generation. state could be a complex object including a next key but should indeed have a well generated random field.

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

2 participants