In fact, the most common session-fixing scenario is for an attacker to post a link, for example. to your homepage or login page by setting the session ID to the URL (as a GET variable) and wait for some users to log in. Since the attacker knows the session ID of these users, and since this session ID can be set in the URL, the attacker can reconsider the link to the registered user profile page / control panel, etc. And impersonating this user.
Thus, to prevent these types of attacks, regenerating the session identifier is sufficient since the attacker remains with an unauthenticated session. An additional step you can take is not to accept the session identifiers in the URL. To do this, you need to install (either in php.ini, if you have access to this file on the server or through ini_set):
- session.use_only_cookies should be set to TRUE (use only cookies for the php session id and not pass it to the url)
- session.use_trans_sid must be set to FALSE (session IDs should never be passed to the URL if cookies are disabled)
Thus, an attacker cannot even set a session identifier even for a session without verification.
m1lt0n
source share