Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accidental Session Hijacking CFMX7

Status
Not open for further replies.

samwscott

Programmer
Apr 2, 2002
3
US
Hi all,

I'm stumped and need some help. I have a CFMX7 application using J2EE session vars. A couple thousand members log into the application each day. Every few months over the last year and a half or so, we run into a problem where one user will suddenly be logged into another user's account. This has always been accidental. We've haven't experienced the problem in probably 6 months and all of the sudden we got 5 separate calls about it yesterday.

We've been investigating this for a while. From what we can tell, the sessions get swapped between members that happen to be accessing the site from the same network (we save IP addresses on the transactions). Sometimes the person recognizes the other user as a coworker or a neighbor in the same building. These problems usually occur from networks that would typically have proxy servers installed.

My guess is that the proxy servers are incorrectly caching cookies (we never pass the session token in the URL). From what I understand about proxy servers, we could correct this problem by using SSL (proxies can't or won't cache encrypted pages). We tried this and it seemed to be working, however, we had to abandon the solution because it was causing problems for users accessing the site from cell phones and PDAs (many of the pages on the site are very large and when encrypted cause huge delays for these users).

Cookies are set in the http response header. If my guess is right and the proxy servers are caching the cookies, my next plan of action is to append a large random number to every URL query string in the application. My thought is that even if the proxy caches the page, every request will have a different URL so the client will never be given a cached page.

What do you think? Anyone experience a similar problem? Am I on the right track? Is there a better way to solve this problem?

Thanks for your input.
--Sam

(Coincidently, our ISP was having problems yesterday and access to our site was up and down a few times. I can't reconcile this with the hijacked sessions but I figure I should mention it anyway.)
 
Have you tried putting code like this at the beginning of your pages:

Code:
<CFHEADER NAME="Expires" VALUE="Sun, 07 Jul 1977 07:07:07 GMT"> 
<CFHEADER NAME="Pragma" VALUE="no-cache"> 
<CFHEADER NAME="cache-control" VALUE="no-cache, no-store, must-revalidate">

<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" Expires: Fri30 Oct 1998 14:19:41 GMT>
<META HTTP-EQUIV="Expires" CONTENT="Sun, 07 Jul 1977 07:07:07 GMT">

That should keep things from caching....

Paul.
 
Thanks Paul,
I didn't think I had to do that because I had enabled content expiration in IIS 6 to expire pages immediately. After using cfhttp to look at the headers I realized that IIS only appends the cache-control headers to static files (html, css, js, gif, jpeg, etc.). I've since added the following to my Application.cfm files...

Code:
<cfheader name="Cache-Control" value="private">
<cfheader name="Cache-Control" value="no-cache">
<cfheader name="Expires" value="#GetHttpTimeString(DateAdd('d', -1, Now()))#">
<cfheader name="Pragma" value="no-cache">
 
Hello Sam,

I hope you are well.
We too are having the very same problem.

Did this solution fix the problem?
I really need to know as Im desperate for a solution.

G
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top