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

CSRF Vulnerability with :null_session or :reset_session #457

Closed
nicolaracco opened this issue Apr 10, 2014 · 2 comments
Closed

CSRF Vulnerability with :null_session or :reset_session #457

nicolaracco opened this issue Apr 10, 2014 · 2 comments

Comments

@nicolaracco
Copy link

During some penetration tests we found that the gem seems to be vulnerable to CSRF attacks when the forgery protection strategy is set to :null_session or :reset_session.

The problem seems to be related to Devise::InvitationsController

def current_inviter
  @current_inviter ||= authenticate_inviter!
end

The value is memoized before the session is checked, so the session is cleaned but the current inviter remains memoized.

In our application we overridden this method with

def current_inviter
  @current_inviter = authenticate_inviter!
end

and the problems seems to be solved.

@scambra
Copy link
Owner

scambra commented Apr 14, 2014

@current_inviter was there to avoid calling authenticate_inviter! serveral times, do you think this change can have some undesired consequences?

@nicolaracco
Copy link
Author

At the moment we had no issues removing the memoization. Indeed devise
itself does not memoize current_#{resource_name}

In any case, it's better a bug than a CSRF vulnerability in a gem like this
;)
Il 14/apr/2014 09:20 "Sergio Cambra" notifications@github.com ha scritto:

@current_inviter was there to avoid calling authenticate_inviter! serveral
times, do you think this change can have some undesired consequences?


Reply to this email directly or view it on GitHubhttps://github.com//issues/457#issuecomment-40338969
.

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