How to encrypt session id in cookie?

后端 未结 8 1551
春和景丽
春和景丽 2021-02-06 05:43

While I was reading about session hijacking articles, i learned that it would be nice to encrypt session id value that is stored in a cookie.

As far as I know, when I s

8条回答
  •  旧时难觅i
    2021-02-06 06:20

    The session ID is relatively unguessable, so that's not really the issue.

    There are a things you can do related to this to counteract attacks:

    • create a new session when a user signs in
    • limit the length of a session

    There are quite a few other things as well. I always recommend studying the Rails Guide on these issues-- it offers a very accessible explanation of known problems and countermeasures-- all equally applicable to PHP code.

提交回复
热议问题