-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
session hijack #5348
Comments
The solution is to not use cookies to store the session. Use an external database like mysql or redis. What you are describing is session replay and it is explained here. |
I am not sure to understand why you say that the solution is to not use cookies. The rails documentation says:
And also:
From my point of view, if you call |
|
Oh I understand now. The thing is that I thought that the session hash in the cookies could be invalidated somehow. But it can't as there's nothing to check it upon. Is that the problem? When we use a DB, we can check the session_id the cookies against the one in the DB. So when the user logs out, we can update session_id in DB which is invalidating anything else. |
You got it right. |
Please see my comment here. |
Environment
]
Current behavior
As a user after login session is generated, cookies also set as (_session id). I copy the session id and after logout I was trying to call with
copy
oldsession id
usingCURL
command I can able to access the logged in view content, though it should not be.In my application, inside config/environments/production.rb file
force_ssl :true
option already open. I was trying to follow the below "Railscasts video"( https://www.youtube.com/watch?v=FVo3d4GgdqU&t=200s)Expected behavior
It should restricted the user to access with older session id as the user already logout from server. But the issue still remain. Using old session id anyone can access the logged in view.
What will be the solution here?
The text was updated successfully, but these errors were encountered: