calabiyau Posted February 4, 2007 Share Posted February 4, 2007 There was a good topic about this a few pages ago and I wanted to continue it, regarding session security. I came across what seemed like a good method of securing sessions and was wondering what others thought of it. Basically it goes something like this on the log in page: $query = "SELECT * FROM users WHERE first_name='$u' AND password='$p'"; $results_id = mysql_query($query, $connect); $row = mysql_fetch_row ($results_id); if ($row) { ini_set("session.gc_maxlifetime","300"); ini_set("session.gc_probability","100"); include('sessions_db.php'); session_start(); $string = "someword"; $string .= $_SERVER['HTTP_USER_AGENT']; $string = md5($string); header("Location:http://www.mysite.com/admin.php?fingerprint=".$string); exit(); } else { echo "<h2>I'm sorry either your password or username is incorrect.</h2><br/>"; } So passing this variable via the url and in addition also setting some session variables which I haven't included here. So even if someone can somehow trick someone into clicking there link and get a valid session id to work with, if they go to the admin page without having been properly validated fromt the database, they will not have the url parameter set and be directed back to the log in page. I'm just curious, this seems pretty solid to me, but what are the holes in the logic. ie. how could someone get into the secure area, aside from some pretty time consuming efforts to forge the salted hashed user agent in the address bar? Anybody? Quote Link to comment https://forums.phpfreaks.com/topic/36973-session-security-by-passing-salted-hashed-user-agent-string-via-url/ Share on other sites More sharing options...
Hypnos Posted February 7, 2007 Share Posted February 7, 2007 If the malicous link/script is on your site (as in, if you have user content), this won't help, because they will have the refering URL in the request. If the attacker got the session cookie from filesystem access, they can still look in the history. But it does add another layer of work. Quote Link to comment https://forums.phpfreaks.com/topic/36973-session-security-by-passing-salted-hashed-user-agent-string-via-url/#findComment-178871 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.