Topic: Vulnerability in session_handler.php? (Read 973 times)
Metal slug addict
Posts: 19
126 credits Members referred : 0
« on: Apr 29, 2007, 08:27:22 PM »
Hi Olaf,
You fixed a problem which someone reported as a possible SQL injection attack. i.e. an attacker could enter "administrator' or 'a'='a" for the username and get in without a password.
It looks like there is a similar although more difficult to exploit problem in session_handler.php function _read and others
function _read($ses_id) {
$session_sql = "SELECT * FROM " . $this->ses_table
. " WHERE ses_id = '$ses_id'";
$ses_id is used without being checked. I believe $ses_id is the session id provided from the users browser. A hacker could set this to any value, causing undesirable effects e.g. DROP sessions
Metal slug addict
Posts: 19
126 credits Members referred : 0
« Reply #2 on: Apr 29, 2007, 09:03:50 PM »
Not sure what you are saying.
All I will say is I am not an expert in this area but I have come across snippets of code that perform the same function as yours. Where they don't use mysql_real_escape_string people have criticised them e.g. bottom of page here http://www.hardened-php.net/php_security_guide_considered_harmful.51.html
only if the user can create the session id than its dangerous because of a SQL injection (via this ID).
sure you can protect this code but if you need this to do you have maybe more security issues because of a unsafe server configuration.
sure it's always important to protect you queries for sql injections but first of all if there is some user input and that not the case here...
Just wanted to say that I have found a hacking tool that allows modification of session id. I don't want to post a link as its not a good idea. I understand it is unlikely anyone would be vulnerable to this attack but my application has quite high security requirements so I am going to make the suggested modifications on my own.
Mike
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6440
39464 credits Members referred : 374
only if the user can create the session id than its dangerous because of a SQL injection (via this ID).
sure you can protect this code but if you need this to do you have maybe more security issues because of a unsafe server configuration.
sure it's always important to protect you queries for sql injections but first of all if there is some user input and that not the case here...
Just wanted to say that I have found a hacking tool that allows modification of session id. I don't want to post a link as its not a good idea. I understand it is unlikely anyone would be vulnerable to this attack but my application has quite high security requirements so I am going to make the suggested modifications on my own.