cookie 的安全性
如果我注册一个网站,并且该网站向我发送了一个 cookie,其中包含可以识别我身份的 ID,那么其他人如果掌握了该 cookie,是否可以冒充我?
如果其他人知道 cookie 的格式并猜出 ID,他们可以通过这种方式冒充我吗?
此外,任何讨论这些事情的材料都会受到赞赏。
If I sign-up to a website and the website sends me a cookie with and ID with which it can identify me, can somebody else impersonate me if they get hold of this cookie?
If somebody else knows the format of the cookie and guesses the ID can they impersonate me this way?
Also, any material where these things are discussed is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这两个问题的答案都是合格的“是”。但是,这两种模仿都可能变得非常困难。使得从 cookie 中窃取会话 ID 变得困难的事情:
使用 https。您和服务器之间的所有通信都经过加密,并且非常难以破解。
如果服务器使用 PHP 会话,则 cookie 中的 ID 很长且难以猜测。
即使没有这些,拦截 cookie 也很困难,因为犯罪者必须让他/她的计算机监听您的 IP 地址或服务器 IP 的传输。
最好的安全性是长 ID(类似于 PHP 会话)与 https 的使用相结合。
如果您正在开发,这里有一些很好的信息:http://thinkvitamin .com/code/how-to-create-totally-secure-cookies/
The answer to both questions is a qualified "yes". But, both impersonations can be made very difficult. Things that make it difficult to steal a session Id from a cookie:
Using https. All communications between you and the server are encrypted and very difficult to hack.
If the server is using PHP sessions, the ID in the cookie is lengthy and difficult to guess.
Even without these, to intercept a cookie is difficult since the perpetrator must make his/her computer listen for transmissions to/from your IP address or the server IP.
Best security is long IDs (a la PHP sessions) combined with usage of https.
If you're developing, here's some good info: http://thinkvitamin.com/code/how-to-create-totally-secure-cookies/