-
Notifications
You must be signed in to change notification settings - Fork 32
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 issues with Spring #47
Comments
Thanks for the detailed explanation, especially for the patch with tests. I have created a PR for solving the issue. It will probably be released next week. Meanwhile you can bring the changes in to your local copy and try them. You can update the issue if the fix does not work for you. |
Hi, Thanks for addressing this so quickly. I'm testing with your fix but I seem to get a null pointer when I'm unauthenticated. Here's a snippet of the stack trace:
|
@michael-kalpana I have updated the PR. That should solve the problem. |
Hi @emre-aydin , I seem to have another issue:
Please let me know if you have any trouble re-creating this. |
Hey @michael-kalpana A reproducer would be really helpful. |
Hi, Please see patch attached for re-creation. Thanks. |
Hi @emre-aydin , How are things going with last issue I reported? Do you need any further info? Thanks. |
I didn't have time to look at the issue again. |
No worries, but can you give a possible estimate for delivery? Without this fix we won't be able to upgrade our Hazelcast version. |
Following lines in
|
I see what's happened. I was pointing to JDK 7 when I wrote it - I just ran it using JDK 8 and got the same issue as you. If you run using JDK 7 for now you should be able to see the scenario. EDIT: Just did some reading, seems that Spring 3.X which you are using does not support JDK 8. |
I had another look into your issue. Here's what happens:
I don't think there's an easy solution. I have tried with different Tomcat versions but they all implement |
Two problems solved: - Fix session fixation vulnerability - Fix stale Hazelcast session issue Session fixation vulnerability occurred with Spring Security MVC as it used isRequestedSessionIdValid method on HttpServletRequest interface which was not implemented before this commit. Stale Hazelcast session issue occurs when a request comes in with a valid JSESSIONID and a hazelcast.sessionId that corresponds to another Hazelcast session. In this case, we just used the existing session and used the incoming JSESSIONID to find the corresponding hazelcast.sessionId and Hazelcast session. Now we let the incoming hazelcast.sessionId to override the hazelcast.sessionId that corresponds to the request's JSESSIONID. Fix #47
Hazelcast WM 3.7.1
We have discovered two issues when using Hazelcast wm with Spring.
1. Session fixation vulnerability
Say you visit the login page of a server. After this initial request two cookies are provided: the JSession ID (or 'Tomcat Session ID' as it is referred to in my patch) and the Hazelcast session ID. If the JSession ID is then modified (to be made incorrect) or removed from the client and then you authenticate with the server when the original Hazelcast session will not be destroyed.
2. Stale cached hazelcast session issue
Say you have two server nodes behind a load balancer. Prior to authentication you have a request handled by both nodes so that each one has the initial hazelcast session ID cached locally against a JSession ID. Say node '1' performs the authentication of a login request. When a request is next sent to node '2' it will attempt to use the locally cached hazelcast session ID which was mapped to the JSession ID to the initial request to node '2'. The observed effect of this is that the request to node '2' will fail as it is not authenticated.
I have provided a patch to the SpringAwareWebFilterTest for the two scenarios above.
SpringAwareWebFilterTest.java.patch.zip
The text was updated successfully, but these errors were encountered: