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

后端 未结 7 788
抹茶落季
抹茶落季 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:22

    By default, the $_SESSION is already backed by a cookie with the name phpsessionid (so that the server is able to identify the client and associate it with one of the sessions in server's memory). If a hacker knows the cookie value of someone else and copies it in its own cookie with the same name on the same domain/path, then the hacker has access to the same $_SESSION. The cookie value is however long and random enough to minimize the risks the session being hijacked within half a hour (the default session timeout).

提交回复
热议问题