PHP 会话创建者 ID
使用 PHP 中内置的会话创建器安全吗?我担心的是,有人可能会劫持另一个人机器上的令牌 cookie,并将他们的设置为完全相同,从而欺骗服务器认为他们是同一个人。
是否有保护措施(例如 IP 检查)来阻止这种情况,或者我应该使用更安全的东西?
It it safe to use the built in session creator in PHP? My worry is that someone could hijack the token cookie on another persons machine, and set theirs to exactly the same, therefore tricking the server into thinking that they're the same person.
Is there protection (e.g. IP checks) to stop this or should I be using something more secure?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,理论上可以在另一个人的机器上劫持令牌 cookie,但事实上,世界上每个网站都在使用它。包括 Stackoverflow。如果你劫持了我的cookie,你就可以登录我的帐户。所以呢?
Yes, it is theoretically possible to hijack the token cookie on another persons machine, but in fact, every site in the world using it. including Stackoverflow. If you hijack my cookie, you can login into my account. So what?
PHP 不执行任何 IP 检查,原因很简单,它不能 100% 地工作。
所以是的,你可以劫持会话。如果你想提高安全性,就需要在此基础上建立机制。看看http://phpsec.org/projects/guide/4.html 一些指导。
PHP does not perform any IP checking, for the simple reason it won't work 100% of the time.
So yes, you can hijack a session. If you want to increase the security, you need to build mechanisms on top of that. Take a look at http://phpsec.org/projects/guide/4.html for some pointers.