Is it possible for an malicious user to set the $_SESSION (in php) variable to any value he wants?
相关问题
- Views base64 encoded blob in HTML with PHP
- Angular RxJS mergeMap types
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
No, not if your code is correct and doesn't allow to set values based on unverified userinput.
Unless you have done something wrong in your code he cant set it on your server, what he can do is steal some other users session cookie and get in that way... in other words; he can change his own session cookie that your $_SESSION use to identify him
Yes. If you use something from a cookie or another similar request method that a user can edit to interact with the session then there is a change. For example say you make an online store and store the item id's in the cookie and on page refresh pushes it into the session. While on the page a user can edit the cookies so when it goes into the session it have been modified.
It depends on how you set the sessions variable. An user can exploit the way you set them.
The most common attacks with sessions is session fixation : http://en.wikipedia.org/wiki/Session_fixation
Highly depends on your code. Something very obvious:
$_SESSION['username'] = $_REQUEST['username']
.If you provide a means for him to do so (bad/insecure code), it is possible. However, this is generally unlikely.