Session ID's can be faked, there is no doubt about it. All one has to do is change the value in the cookie (if using cookies) or the parameter value. It really is a no brainer to fake.

Now the good news. What is not so easy to do is to determine how the session id is created. Depending on the level of security you want, you may have the session id changed every time a user views a page, or change it for every session.

To do my session stuff, i use MD5 and a combination of various things including an arbitrary string, with the session id lasting as long as a session (a user is logged in). I dont really need the security to change the session id each time a page is viewed.

Each time a logs in you give them a session key, either in a cookie, or html parameter somewhere, then and save it server side in a database against the user_[id|name].

You have the overhead of making a call to the database each time, however there are many things that can be done to tune this access, depending on the level of performance you require, ie caching the db in memory, using placeholders in you DBI (if you're using DBI), using mod_perl to create persistant connections (again, if you're using DBI) etc etc.


In reply to Re: Session handling security by Ryszard
in thread Session handling security by Fingo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.