Skip to content

CSRF Vulnerability with :null_session or :reset_session #457

@nicolaracco

Description

@nicolaracco

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions