Occurs when a hacker intercepts or otherwise obtains a session cookie from another user.
Hijack a session on this site yourself...
A cookie is a small piece of data sent by a website and stored on your computer by your browser - yes, any website is allowed to store data on your computer if you have cookies enabled!
Whenever you make a request to the website, your browser sends the cookies back so the website can "remember" who you are.
A session is a technique used by a website to maintain state information about a specific user.
Sites need sessions because HTTP is stateless. Session information is usually stored on the server and identified by a unique "key" sent in a cookie.
So, when you log in to this site, for example, it starts a "session" with a unique key stored in a "session cookie" that identifies you every time you subsequently request a page.
For more info, see About Sessions on Wikipedia
You can manipulate the cookies on your computer using a variety of simple tools.
A very easy approach is to use the Firefox Addon Cookies Manager
This addon allows you to view an edit your cookies. Why? Well, to take over someone else's account, of course!
To create a simple demonstration of session hijacking, this site exposes a vulnerability that allows a hacker to "masquerade" as any user!
Here's how it works:
You can masquerade as any user on the site by enabling its "userid" session handling logic.
Try it - can you guess some of the other user ID's, edit your userid cookie, and become an imposter?
Better session handling uses a complex, random "key" to identify your session - one that would be very hard to guess. Nonetheless, if a hacker gets ahold of your session "key", they can masquerade as you just as you did above!
Here's how it works:
Can you can hijack a session using the method above?
First - you will need disable the simplistic userid session handling
so the site goes back to using standard, "secure" session handling.
Try it - acquire a session key, edit your PHPSESSID cookie, and hijack a session!