简体   繁体   English

登录后是否需要csrf令牌?

[英]Do I need csrf tokens after login?

I'm building a simple todo list where the user will login (with csrf-token) and then be able to add items to the todo list. 我正在构建一个简单的待办事项列表,用户可以在其中登录(使用csrf-token),然后将项目添加到待办事项列表中。 Would I need to add csrf_tokens to submissions using AJAX (todo list items) after the the user has already logged in? 用户已经登录后,是否需要在使用AJAX(待办事项列表项)的提交中添加csrf_tokens? I'm using session based authentication. 我正在使用基于会话的身份验证。

Well I'd say yes you have to do it, look at this excerpt taken from owasp ( Open Web Application Security Project ) documentation: 好吧,我想是的,您必须这样做,请看以下摘自owasp (开放式Web应用程序安全性项目)文档的摘录:

When targeting a normal user, a successful CSRF attack can compromise end-user data and their associated functions. 以普通用户为目标时,成功的CSRF攻击可能会破坏最终用户数据及其相关功能。 If the targeted end user is an administrator account, a CSRF attack can compromise the entire Web application. 如果目标最终用户是管理员帐户,则CSRF攻击可能会破坏整个Web应用程序。 The sites that are more likely to be attacked are community Websites (social networking, email) or sites that have high dollar value accounts associated with them (banks, stock brokerages, bill pay services). 更有可能受到攻击的站点是社区网站(社交网络,电子邮件)或具有与其关联的高美元值帐户的站点(银行,股票经纪,账单支付服务)。 This attack can happen even if the user is logged into a Web site using strong encryption (HTTPS) . 即使用户 使用强加密(HTTPS) 登录 到网站, 也会发生此攻击 Utilizing social engineering, an attacker will embed malicious HTML or JavaScript code into an email or Website to request a specific 'task url'. 利用社会工程学,攻击者会将恶意HTML或JavaScript代码嵌入到电子邮件或网站中,以请求特定的“任务网址”。 The task then executes with or without the user's knowledge, either directly or by utilizing a Cross-site Scripting flaw (ex: Samy MySpace Worm). 然后,可以在有或没有用户知道的情况下直接或通过利用跨站点脚本缺陷(例如:Samy MySpace Worm)执行任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM