Current location: Hot Scripts Forums » Programming Languages » PHP » Sessions: Insecurity or Mass Confusion


Sessions: Insecurity or Mass Confusion

Reply
  #1 (permalink)  
Old 12-26-06, 07:11 AM
Kobra Kobra is offline
Banned
 
Join Date: Dec 2005
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Sessions: Insecurity or Mass Confusion

ok, this is my problem.
I see some sites being hacked all over and i think its hopeless because sessions are **** insecure!

Then thinking about solution for it leaves a thousand of access problems:

- Verification of ips : Doesnt work for ppl which ip change between hits (They would get an error per second)
- Cookie variable store: Can be hacked easily and user can have it off.
- Verification of user agent: Some users have same user agent.

Is there any way i can know if the person who's trying to access the session is the original user or an hacker? I think its nearly impossible, and if it can work in some situations wont work in others.

Any ideas? Because i dont like the idea that a php site with sessions will end up being hacked sooner or later, is php that insecure? Better change language then.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 12-26-06, 07:21 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
Have a look at this. It's about session security.

http://www.programmingtalk.com/showthread.php?t=32335
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 12-26-06, 10:11 AM
Kobra Kobra is offline
Banned
 
Join Date: Dec 2005
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Would a simple php flag "session use only cookies" solve it?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 12-26-06, 10:20 AM
streety streety is offline
Newbie Coder
 
Join Date: Nov 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Kobra
ok, this is my problem.
I see some sites being hacked all over and i think its hopeless because sessions are **** insecure!

Then thinking about solution for it leaves a thousand of access problems:

- Verification of ips : Doesnt work for ppl which ip change between hits (They would get an error per second)
- Cookie variable store: Can be hacked easily and user can have it off.
- Verification of user agent: Some users have same user agent.

Is there any way i can know if the person who's trying to access the session is the original user or an hacker? I think its nearly impossible, and if it can work in some situations wont work in others.

Any ideas? Because i dont like the idea that a php site with sessions will end up being hacked sooner or later, is php that insecure? Better change language then.
This is definitely mass confusion.

I'll get to the main meat of your post in a moment but first let me address you final paragraph. Here you suggest that sessions are a vulnerability and that other languages are some how more secure. How do you think sessions are handled in other languages which makes it more secure? Sessions are a vital
part of any web application no matter which language they are created in. No matter which language they are created in sessions are used. The only difference is that php provides a really easy interface to work from while in other languages you need to mess around with cookies and url get variables directly.

The insecurity is caused by http being stateless - no language which is serving web pages can overcome this vulnerability.

Sessions, like so many of the capabilities in php is easy to use which enables a lot of inexperienced users to write code. This code is insecure because they don't understand the potential problems.

Wow, that went on longer than expected.

Now some useful tips:-
- Sessions are based on identifying a visitor in one of two ways; cookies and a variable in a link. The variable in a link can create problems, it can be sent to a friend in an email, posted on a website and anyone clicking on that link could potentially hijack the original users session. This is clearly a problem and I would recommend you not to use this feature - stick to cookies.
- The user agent should not change between requests so you can check - this adds a *little* extra security
- The ip address may change due to a user connecting to your site through a proxy pool. If however their ip address remains the same for several requests you can be fairly sure that they are connecting directly - if their ip address then suddenly changes this should arouse your suspicions
- If sensitive user data is being displayed or modified don't trust sessions and re-verify the password of the user.
__________________
Web Development Blog - Useful bits & pieces
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sessions not working, please help! tallpaul858 PHP 2 04-29-05 07:23 AM
Help with Mass Email program 1jetsam PHP 6 02-19-05 03:23 PM
Windows XP Home & PHP Sessions jpthomas82 PHP 2 12-10-04 01:22 AM
Weird behaviour with sessions Skeleton Man PHP 1 10-27-04 10:42 PM
Multiple sessions Kaanha PHP 2 01-16-04 11:39 AM


All times are GMT -5. The time now is 01:56 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.