Invalid Session ?

Thu Mar 20, 2008 9:29 am

Is anyone else having this problem? Sometimes when I try to post I get this...

Image

Other times it just boots me out and I have to log back in. Repeatedly.

I've tried clearing my catch and cookies.


Travis

PS I can't post this because of above problem... Fucking thing.
A very silly place... http://yarnzombie.net/Travis/

Without question, the greatest invention in the history of mankind is beer. Oh, I grant you that the wheel was also a fine invention, but the wheel does not go nearly as well with pizza.
-Dave Barry
User avatar
Lufah
 
Posts: 1945
Joined: Sat Jun 04, 2005 5:58 pm
Location: Mt. Vernon, OH

Thu Mar 20, 2008 9:33 am

I have not seen this yet. How long has it been happening? Have you tried another machine?
User avatar
BadRock
Global Moderator
 
Posts: 4893
Joined: Mon Apr 23, 2007 8:28 am
Location: Thornton, Colorado

Thu Mar 20, 2008 9:38 am

It happens from time to time. Might be the railroad spying on you, though.
code
User avatar
codewritinfool
 
Posts: 2261
Joined: Thu Sep 01, 2005 7:54 pm
Location: The Rat Pad

Thu Mar 20, 2008 2:51 pm

I admin a bunch of phpbb boards. Here's the scoop:

phpBB uses sessions to "track" users as they move between pages, forums, topics, etc. A session is made up of a unique 32 character session_id which identifies the current users. This value is stored in the sessions table and either a temporary (i.e. it's deleted when the browser window is closed) cookie on the users machine or if that doesn't seem to be working it's appended to all URLs.

The problem with using just a session_id is that it becomes very easy to hijack (takeover) a session. All a user need do is obtain the session_id and add it to the url as they browse the board. If the id they grab happens to be a logged in admin or moderator ... well you get the picture.

What we do to help complicate the situation is also tie the session to the users IP. Using this method someone would need to spoof an IP and obtain the session_id in order to hijack a session, not incredibly difficult but certainly harder ... and with this sort of software it's really a case of making everything harder to do, thus disuading all but the most ardent "hackers" from bothering to attempt anything.

How do we obtain this IP? We check the availability of two variables, REMOTE_ADDR and HTTP_X_FORWARDED_FOR. Firstly we check for HTTP_X_ ..., this is typically set by "nice" proxies, caches, etc. and contains "an" IP which may be the users "real" IP or some other IP. If that does not exist or it contains a private or restricted IP range (several blocks of IPs are reserved by the international bodies responsible for IP allocation) we instead use the value contained in REMOTE_ADDR. This variable typically contains the users real IP.

However, problems arise with how some ISPs operate their systems. Instead of forwarding the users real IP or indeed a different but static IP they simply make available only the IP of the proxy being browsed. The larger ISPs do not use a single proxy or cache, the load upon it and data passing through it would be far too great. Instead they use several systems in a "proxy farm" (I tend to refer to it as something containing most of those letters ... :D). A user browsing the web may be switched between these machines from one page to another (to help distribute load), with the IP changing as they go.

Obviously a problem then exists in that phpBB's ability to tie a users session to a unique id and an IP fails ... because the IP is constantly changing. There are some "nice" ISPs out there that run these farms within a single "class" or block of IPs, e.g. 1.2.3.4, 1.2.3.5, 1.2.3.6, etc.

This is why in a previous release of phpBB we introduced a slightly reduced IP checking system which now checks only the first three "quads" of an IP, i.e. 1.2.3.4 is checked only for 1.2.3 the 4 is discarded. Remember, that an IPv4 address is 32bits wide, this is generally presented in the form of four 8 bit numbers. By checking just the first three numbers (24bits) we neglect 8 bits or 255 (253 in practice) possible IPs ... that's 253 seperate potential proxies ... IOW enough machines for practically any ISP on the planet. However we can go further and reduce that checking to just the first "two quads", that ignores 255 * 253 IPs!

The problem is some ISPs don't arrange their IP allocation particularly well, either for historical or other reasons ... AOL is one significant culprit. So what happens is that users can jump between completely different Class A (this is a full 32bit block of IPs) networks, e.g. 100.100.100.100 to 200.100.40.40, etc. This renders IP validation completely useless for such situations :(

So you ask, "Okay, but why did 2.0.3 not cause all these Invalid_session errors?!". The answer is fairly simple. When you first visit phpBB (assuming you have autologin enabled) it looks to see if you have a session_id (either in a cookie or the URL). On a new visit you won't have such a session_id and so phpBB creates a new one. If you have autologin set it checks the relevant data and if that matches you are logged in with the appropriate user_id. You can then immediately browse the board, post messages, do admin tasks (if applicable), etc.

Now let's take a situation where a naughty person creates a bogus form on their site. You are (for some reason) browsing this form. However, unknown to you this form contains all the necessary data to delete a pile of topics in a given forum (you having moderator rights on a certain board). When you submit that form it will be transmitted to the appropriate website. No session exists so phpBB, as noted above creates a new one and immediately processes the form data ... all the relevant topics are deleted from the database and you only find out when the boards "The selected topics have been deleted" message appears ...

To help negate the effectiveness of this we backported some code from phpBB 2.2 and introduced additional code. The admin control panel now appends your session_id to every url. When you browse within that panel it checks the session_id in the url with that stored in the sessions table. If they match, great, if they don't it redirects you back to the ACP index. This will help prevent users accidently, without their knowledge suffering issues as noted above.

Similarly the Moderator control panel has the session_id appended to urls and carries out a check. The difference here is that it throws up an Invalid session if the ids do not match, note that redirection like the admin panel wouldn't alter the result here ... if you tried submitting data via the MCP with an invalid session you'd just be returned to MCP front page ... losing any data entered previously. Other issues with voting and posting were also addressed thanks to a concerned user notifying us. Thus similar checks were put in place there.

The problem is that for users whose session is forever being renewed due to their IP changing this extra level of checking can cause issues. For many ISPs the noted changing of 6 to 4 in the IP validation check will be sufficient ... however AOL crops up (as per usual in nearly all similar situations with all software ...) as the sore thumb.

"What can you do about it?" you may ask, very little is the response.

Sorry.

Push E.
Asshat of the Year ('06)
Proud Drunk of the Year Nominee ('08)
Beevo, "I burned my tongue."
Doc, "Slow down."
Gadgets
CoVBS
User avatar
Push Eject
Butcher
 
Posts: 2056
Joined: Fri Apr 28, 2006 12:52 pm
Location: Lancaster, CA

Thu Mar 20, 2008 3:07 pm

So your saying that if I stop using a proxy server that could solve my problem?
A very silly place... http://yarnzombie.net/Travis/

Without question, the greatest invention in the history of mankind is beer. Oh, I grant you that the wheel was also a fine invention, but the wheel does not go nearly as well with pizza.
-Dave Barry
User avatar
Lufah
 
Posts: 1945
Joined: Sat Jun 04, 2005 5:58 pm
Location: Mt. Vernon, OH

Thu Mar 20, 2008 4:14 pm

not really.... the "proxy" they are talking about is actually at the ISP level and you probably have no control over using it or not. But you could check your internet connection settings just to be sure.
BUB
Lunch Meet "Limpian" Gold Medalist (x2) 2006
Winner of <b>NO PANTS</b> award 2006 and 2007
Make your own beer website... starting at $10 per YEAR.
www.bubweb.com & www.momenttoponder.com
User avatar
bub
Global Moderator
 
Posts: 3396
Joined: Sat Dec 31, 2005 2:06 pm
Location: Greater Nashvegas

Thu Mar 20, 2008 4:21 pm

I'd slam my weiner in the door and then wrap bacon around it!
User avatar
BadRock
Global Moderator
 
Posts: 4893
Joined: Mon Apr 23, 2007 8:28 am
Location: Thornton, Colorado

Fri Mar 21, 2008 5:22 am

I thought every Sunday Session was invalid?

I think my turtle died? :cry:
Nate
http://www.nebraskabeerblog.com
Beers on tap-Schwarzbier, RyeIPA
User avatar
BrewBum
 
Posts: 1775
Joined: Tue Oct 18, 2005 9:01 am
Location: Central Nebraska

Next

Return to Support

Who is online

Users browsing this forum: No registered users

A BIT ABOUT US

The Brewing Network is a multimedia resource for brewers and beer lovers. Since 2005, we have been the leader in craft beer entertainment and information with live beer radio, podcasts, video, events and more.