<p>I need to prevent <a href="http://www.owasp.org/index.php/Session_Fixation" rel="noreferrer">Session Fixation</a>, a particular type of session hijacking, in a Java web application running in JBoss. However, it appears that the standard idiom <a href="http://www.owasp.org/index.php/Session_Fixation_in_Java" rel="noreferrer">doesn't work in JBoss</a>. Can this be worked around?</p>

[{'answer_id': 8322, 'author': 'Warren Blanchet', 'author_id': 1054, 'author_profile': 'https://Stackoverflow.com/users/1054', 'pm_score': 4, 'selected': True, 'text': '<p><a href="https://jira.jboss.org/jira/browse/JBAS-4436" rel="nofollow noreferrer">This defect</a> (found <a href="http://forum.springframework.org/showthread.php?t=54688" rel="nofollow noreferrer">here</a>) points the way to the solution. The Tomcat instance that runs in JBoss is configured with emptySessionPath="true", rather than "false", which is the default. This can be modified in <code>.../deploy/jboss-web.deployer/server.xml</code>; both the HTTP and AJP connectors have this option.</p>\n\n<p>The feature itself is used to eliminate the context path (eg. "foo" in <a href="http://example.com/foo" rel="nofollow noreferrer">http://example.com/foo</a>) from being included in the JSESSIONID cookie. Setting it to false will break applications that rely on cross-application authentication, which includes stuff built using some portal frameworks. It didn\'t negatively affect the application in question, however.</p>\n'}, {'answer_id': 2919307, 'author': 'Chris Mountford', 'author_id': 216756, 'author_profile': 'https://Stackoverflow.com/users/216756', 'pm_score': 0, 'selected': False, 'text': '<p>This problem and the specific case in which it occurs is a problem in Tomcat as well as JBoss. Tomcat shares the emptySessionPath="true" effect (and actually JBoss inherits it from Tomcat).</p>\n\n<p>This really seems like a bug in Tomcat and JBoss when you are trying to prevent session fixation attacks but the servlet spec (at least version 2.3) does not actually require the JSESSIONID to be defined or redefined according to any specific logic. Perhaps this has been cleaned up in later versions.</p>\n'}, {'answer_id': 6096537, 'author': 'Ramesh PVK', 'author_id': 760656, 'author_profile': 'https://Stackoverflow.com/users/760656', 'pm_score': 0, 'selected': False, 'text': '<p>One workaround is to store the client address in the session. A response wrapper should validate the client address set in the session is same as the one accessing the session.</p>\n'}, {'answer_id': 16666753, 'author': 'user2365956', 'author_id': 2365956, 'author_profile': 'https://Stackoverflow.com/users/2365956', 'pm_score': 0, 'selected': False, 'text': '<p>I came to know below code setting snippet from one of the forum. And I added below lines. But when I print the session ID after and before log in into the application it is same. How would I test session Fixation.</p>\n\n<ol>\n<li><p>D:\\jboss-5.1.0.GA\\bin\\run.cof file and add the below line.\nset "JAVA_OPTS=%JAVA_OPTS% -Dorg.apache.catalina.connector.Request.SESSION_ID_CHECK=false"</p></li>\n<li><p> in each context.xml of the jboss applications.\nD:\\jboss-5.1.0.GA\\server\\default\\deploy\\jbossweb.sar\\context.xml \n            </p></li>\n</ol>\n'}]
['https://Stackoverflow.com/questions/8318', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1054/']