security - How safe are PHP session variables? -


I have a login script that verifies the user name / password against the data in the 'Users' table. Also, I have a 'roles' table that specifies the access level of a given user. Assuming that I am using a secure login script, in order to find the user's authorization level and store it in the session's variable, simply execute an additional query on successful login against the 'roles' table. Is there a security hole? This idea would be that with a mixed authority on any page, I could query session variables to enter the session's user's authentication level.

Thank you.

It is quite safe compared to sessions, say cookies but it is still possible to steal a session And thus the hacker will have total access to whatever is in that session. Some ways to avoid this are checking IP (which works very well, but very little and thus is not reliable on your own) Generally, with a per page, you have " Token ", so that each page checks out that this page does not have this collection that matches.

In either the security check, there is a loss of applicability if you check the IP and the user is behind the intranet firewall (or any other condition due to this), which is stable for that user If they do not keep them, then they will have to re-certify to lose their IP every time. With one luck, you always get to enjoy "Clicking back will cause the breakdown of this page".

But with a cookie, a hacker can steal the session using simple XSS techniques. If you store a user's session ID as a cookie, they are also weak for it. So even if this session is only for someone who knows the server-level hacks (which requires more sophisticated methods and usually requires some additional privileges, if your server is secure) , You still need some extra level on each script request, you should not use cookies and AJAX together, because it completely It's easy to go into the city if it is stolen cookies, because you can not get security checks on every request your Ajax requests. For example, if the page uses a non-page, but the page is never reloaded, the script can only check that match. And if the cookie is getting the authentication method, then I can now go to my evil city using the theft cookie and AJX hole.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -