I am developing a web application that will handle often sensitive information, many users will have the ability to manipulate other user profiles from lower level. etc.
And the point of security has me a little stuck and worried. I read a lot about hajacking session, men in the middle, session fixation, read many owasp tips and obviously I read many posts on stackoverflow from this topic.
I saw many tutorials showing how to steal a session cookie, such as copy and manipulate cookies in Firefox for example. but I saw in all cases, the attacker has to perform one step and is always the same. Go to the Web app URL domain...
When the attacker is in the URL domain (https://www.myawesomwebapp.com/) and Inject de stolen Authentication COOKIE its the end. but, what happens if the URL it's always different, for example, https://www.myawesomwebapp.com/?time=microtime()
From .htacces, we can put de GET['time'] invisible right? and every time you try to access the web page, obviously it will be in a different time, and the attacker could not know when you SignIn exactly. or maybe encrypt with a special salt that variable GET microtime()...
Finally, one the web app compare somehow the session COOKIE and especially microtime generated login GET['time']. If their match proceed with the script and if not a new login is redirected and the expiry time of the session COOKIE is disabled.
My only doubt with this is, where and how store this microtime data, so that if the legal user opens another browser tab or just F5 in the main, don't regenerate a new microtime value.
- If I save this data into a COOKIE apart, its the same thing.
- IF I save this into a PHP SESSION, and the attacker copy my PHPSESSID, its the same.
- If I save this into my DB, how I get this value without using an COOKIE o SESSION authentication?