Is it possible for a malicious user to edit $_SESSION?

后端 未结 7 787
抹茶落季
抹茶落季 2020-12-16 00:02

I save some important info in $_SESSION, not in $_COOKIE. So, my question, is it dangerous? Or is it protected from malicious users trying to edit

7条回答
  •  情歌与酒
    2020-12-16 00:28

    $_SESSION is stored on your webserver, so it's not possible to directly alter it via the web. Of course, your PHP application can update $_SESSION, so it still might be possible for an attacker to trick your application into doing something to $_SESSION that it shouldn't - it all depends on the specifics of your application.

    $_COOKIE is stored on the user's browser, which means that the user has the power to change their own cookies.

    One of the main uses for cookies is authentication. A user logs in and information is stored in $_SESSION. A cookie (stored in $_COOKIE) records the session id of the user so that your application knows which session belongs to the logged-in user.

提交回复
热议问题