为了安全起见,将 GET 与 tokenID 结合使用是一个好主意吗?

发布于 2024-08-21 06:09:14 字数 952 浏览 6 评论 0原文

我正在考虑这个,看来只发布不太容易受到攻击,但有些困难(要求用户单击某些内容)。

我读到了有关令牌 id 和双重提交 cookie 的信息,但我不确定有什么区别

http://www.owasp.org/index.php/Cross-Site_Request_Forgery_%28CSRF%29_Prevention_Cheat_Sheet#Disclosure_of_Token_in_URL http://www.owasp.org/index.php/ Cross-Site_Request_Forgery_%28CSRF%29_Prevention_Cheat_Sheet#Double_Submit_Cookies

现在我有用户 ID(我表中的 PK)和会话 ID,因此您不能简单地更改您的 Cookie ID 并像其他人一样行事。现在看来我将会话 ID 作为令牌放入每个表单中并检查它们,因为攻击者无法猜测这些令牌。但是我不喜欢将会话 ID 放入页面中供人们查看的想法。但说实话,这有问题吗?如果用户没有复制/粘贴 html,是否会因为会话 id 在 html 中以普通视图的形式出现而发生任何攻击?

I was thinking about this and it appears POST only a little less vulnerable and somewhat harder (do to requiring the user to click something).

I read about token ids and double submitted cookies and i am not sure what the difference is

http://www.owasp.org/index.php/Cross-Site_Request_Forgery_%28CSRF%29_Prevention_Cheat_Sheet#Disclosure_of_Token_in_URL
http://www.owasp.org/index.php/Cross-Site_Request_Forgery_%28CSRF%29_Prevention_Cheat_Sheet#Double_Submit_Cookies

Right now i have the user id (PK in my table) and a session id so you cant simply change your cookie ID and act like someone else. Now it seems like i put the session id as a token in each of my forms and check them bc attackers cant guess these tokens. However i dislike the idea of putting the session id into the page for ppl to see. But really, is there a problem with that? short of having the user copy/pasting the html is there any attacks that can happen due to the session id being in plain view in html?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

寂寞花火° 2024-08-28 06:09:14

如果用户可以复制其中包含令牌的链接,这是非常不安全的。对于当前地址也是如此:如果您使用静态会话 ID,则引用外部站点或屏幕截图将使会话受到损害。即使您没有静态会话 ID,用户也可以将鼠标放在链接上,该链接将显示在浏览器底部,然后截取屏幕截图,再次导致其会话受到损害。

If the user can copy a link with a token in it, this is very insecure. Likewise for the current address: if you use a static session ID, a referral to an outside site or a screenshot will render the session compromised. Even if you don't have a static session ID, the user can put his mouse over a link and it will show in the bottom of his browser, and then take a screenshot, once again rendering his session compromised.

一片旧的回忆 2024-08-28 06:09:14

无论如何,会话 ID 在客户端是已知的。否则他们会如何将其与请求一起发送?

The session-ID is known on client side anyway. How else would they send it with the requests?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文