比较会话值和隐藏表单是否足以防止 CSRF?
因此,“典型”CSRF 保护方法是将随机数存储在会话和隐藏表单元素中。攻击网站是否可以首先使用受害者的会话抓取目标表单,获取隐藏的表单令牌,然后在自己的表单元素中发送令牌?自己测试了一下,确实如此。我只是好奇机器人是否有可能抓取页面并获取随机数。
如果这是可能的,那么如何防范此类攻击?
So the "typical" CSRF protection method is storing a nonce in a session and in a hidden form element. Is it possible for an attacking website to first scrape the target form using the victim's session, getting the hidden form token, and then send the token in their own form element? Testing this myself, it validates. I am just curious if it is possible for a bot to scrape the page and obtain the nonce.
If this is possible, then how can you protect against this type of attack?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果攻击者可以抓取受害者的页面,他就不需要使用 CSRF,因为他基本上可以对用户的数据执行任何操作。这实际上称为会话劫持,并且有保护用户免受其侵害的其他方法。
If the attacker could scrape a victim's page, he wouldn't need to use CSRF, because he could basically do anything with the user's data. This is actually called session hijacking and there are other ways of defending the user from it.