Ran into an interesting issue. We use flash uploader in our web ui for browsers that dont support html5 and flash has a problem that each request it makes to server has a new session because it wont send any cookies back to server. The only way to circumvent around this is to send original sessionId as a post parameter and on server cache all the sessions in tomcat memory and then join this new session to the original session using sessionid coming in post.
Anyways long story short we updated to tomcat7 and suddenly one of our feature that allows us to impersonate a user broke. Finally nailed it to a security fix in tomcat7 that will renew sessionId on basic authentication but the issue is that to do flash based file upload we relied on HttpSessionListener.sessionCreated to cache all sessions by sessionId. And when tomcat7 was renewing sessionId it was not calling the sessionCreated event for the new session. There were two ways to solve it:
1) Disable session fixation security fix by adding the below valve to context.xml . I did not chose to do this as it would make tomcat less secure.
<Valve className="org.apache.catalina.authenticator.BasicAuthenticator" changeSessionIdOnAuthentication="false"/>
2) Extract the code in HttpSessionListener.sessionCreated to a common method and call it manually during impersonation. I chose this way for now as its more secure. In future when tomcat fixes this bug I will remove this code.
Anyways long story short we updated to tomcat7 and suddenly one of our feature that allows us to impersonate a user broke. Finally nailed it to a security fix in tomcat7 that will renew sessionId on basic authentication but the issue is that to do flash based file upload we relied on HttpSessionListener.sessionCreated to cache all sessions by sessionId. And when tomcat7 was renewing sessionId it was not calling the sessionCreated event for the new session. There were two ways to solve it:
1) Disable session fixation security fix by adding the below valve to context.xml . I did not chose to do this as it would make tomcat less secure.
<Valve className="org.apache.catalina.authenticator.BasicAuthenticator" changeSessionIdOnAuthentication="false"/>
2) Extract the code in HttpSessionListener.sessionCreated to a common method and call it manually during impersonation. I chose this way for now as its more secure. In future when tomcat fixes this bug I will remove this code.
Comments
Post a Comment