security - 基本 cookie 和 CSRF 问题

标签 security cookies csrf

我目前正在了解有关 CSRF 的更多信息,并且我有一个关于 cookie 的基本问题。来自 Jeff Atwood's article on CSRF :

"When a POST request is sent to the site, the request should only be considered valid if the form value and the cookie value are the same. When an attacker submits a form on behalf of a user, he can only modify the values of the form. An attacker cannot read any data sent from the server or modify cookie values, per the same-origin policy. This means that while an attacker can send any value he wants with the form, he will be unable to modify or read the value stored in the cookie."

如果 cookies 是 a piece of text stored on a users computer他们怎么能不修改/读取 cookie 的值

如果他们知道 cookie 的值并且可以看到隐藏在表单中的伪随机值,那么他们是否就拥有了执行攻击所需的一切?

谢谢

最佳答案

同源策略意味着攻击网站无法读取其他域的 Cookie。请参阅http://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_cookies

我们不是在谈论在用户计算机上拥有 rootkit 或类似内容的攻击者,CSRF 所保护的是恶意服务器,让用户通过 POST 请求向恶意服务器的域提交表单想要攻击。由于恶意服务器无法从目标域读取 cookie,因此它们无法正确填写其发出的 POST 请求的 CSRF 字段。

关于security - 基本 cookie 和 CSRF 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5750657/

相关文章:

javascript - 不使用模板引擎的 CSRF 保护 - Javascript 和 Flask

android - 如何在 Android 和 iOS 中关闭 SSL 3.0?

c++ - 如何简单地创建一个 ASN.1 DER 编码的 blob

ios - iOS8中如何删除WKWebview的缓存?

javascript - 将 cookie 设置为 iframe src

spring - Redis Spring session 中的 CSRF token

javascript - CSRF 基础知识与 SSL 和 CSRF 关系

Java - 端口监听程序的漏洞是什么?

web-services - Tomcat 是否支持 TLS v1.2?

java - 无法从浏览器读取 Cookie