Author Topic: Session_id()  (Read 553 times)

Offline AlanPHP

  • Level 1
  • *
  • Posts: 2
  • Reputation: +0/-0
    • View Profile
Session_id()
« on: February 15, 2010, 10:57:14 PM »
Recently learned about session hi-jacking.
with my game coming out in a week or two, this needs to be change fast!

What would i do to help this?
Code: [Select]
session_id();
session_regenerate_id();
should that work to help this?
I know there are many different ideas and ways to hack sessions.
Just need some general tips.

Thanks for my first thread,
-Alan

Offline Sagefire135

  • Level 14
  • *
  • Posts: 107
  • Reputation: +2/-0
    • View Profile
Re: Session_id()
« Reply #1 on: February 15, 2010, 11:41:31 PM »
it appears as though those are calling functions. it might be helpful to see what the functions are actually doing.

Offline Topazan

  • Level 13
  • *
  • Posts: 101
  • Reputation: +2/-0
    • View Profile
Re: Session_id()
« Reply #2 on: February 16, 2010, 12:12:54 AM »
it appears as though those are calling functions. it might be helpful to see what the functions are actually doing.
session_id() and session_regenerate_id()

AlanPHP

Sorry, I don't know anything about session hijacking, so I can't answer your question.  I will say, though, going by the manual page alone it doesn't look like calling session_id() actually changes anything, it just returns the current session id, so calling it without storing it is probably unnecessary.

Like I said, I don't really know anything about this, but after searching the web a bit, it does appear that regenerating the session id after login is a recommended tactic against some forms of session hijacking.

I hope you find a more satisfactory answer than that.

Offline Nox

  • Level 35
  • **
  • Posts: 738
  • Reputation: +12/-2
    • View Profile
Re: Session_id()
« Reply #3 on: February 16, 2010, 01:16:47 AM »
I don't know about session_id() here, but session_regenerate_id() is prevention against session fixation
Meet us at an IRC irc.freenode.net #bbg as well
Enjoy http://spiritbeacon.noxart.cz/ !

Offline dsheroh

  • Level 21
  • *
  • Posts: 235
  • Reputation: +6/-0
  • Perl Vicar
    • View Profile
    • Psi Rangers
Re: Session_id()
« Reply #4 on: February 16, 2010, 04:37:53 AM »
In the context of web apps, session hijacking is generally a matter of obtaining and using someone else's session id.  Assuming the target isn't going around posting the value of their session cookies on forums, this generally involves either compromising their computer or using one of the internet hosts that their traffic passes through to sniff the session ids from that traffic.

In the first case, there's not really anything you can do about it.  If the user's computer has been compromised, then the attacker can access any information available to the user's browser, including doing so in real time if he really wants to.  Game over; attacker wins.

The second can be defended against in various ways.  Using a cookie for the session id instead of putting it in the URL is the most basic defense and one that I recommend in all cases unless there's a specific reason to expect cookies to be unavailable.

The next level of defense is to record the IP address associated with each session and reject any requests that don't come from that address.  Personally, I don't do this because proxies and NAT routers (including any home "broadband router" or cable/DSL modem which supports connecting multiple computers) collapse multiple users into a single IP address and reverse proxies (such as AOL) can cause each request from the same user to come from a different IP address.  It's still fairly common, despite those issues.

The ultimate defense is to accept https connections only.  The SSL transport encryption will defeat attempts by intervening hosts to sniff the exchanged data and includes its own protection against hijacking of the SSL session.  If you're really concerned about attackers getting access to legitimate users' sessions, this is the way to prevent that, but it comes at a cost in CPU utilization, performance when establishing a connection, and money for buying a proper SSL cert from a recognized CA (unless you want your users to get scary "This cert may be forged! Run away!" warnings from their browsers).

Offline AlanPHP

  • Level 1
  • *
  • Posts: 2
  • Reputation: +0/-0
    • View Profile
Re: Session_id()
« Reply #5 on: February 16, 2010, 05:27:39 PM »
Nox...session_id() isn't a function i made.

I know that session_id() doesn't have a reason to call it.

But thanks everyone. :D

-Alan

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal