我是否需要使用`[ValidateAntiForgeryToken]和@ Html.AntiForgeryToken()`在我的所有网页? [英] Do I need to use `[ValidateAntiForgeryToken] and @Html.AntiForgeryToken()` on all my pages?

查看:1230
本文介绍了我是否需要使用`[ValidateAntiForgeryToken]和@ Html.AntiForgeryToken()`在我的所有网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的所有项目的页面需要身份验证。而通常情况下我不使用 [ValidateAntiForgeryToken]和@ Html.AntiForgeryToken()在我的控制器和视图。只有登录页面有它..

All my project's page need authentication.. And Normally I dont use [ValidateAntiForgeryToken] and @Html.AntiForgeryToken() on my Controller and View.. Only login page has it..


  1. 它们是什么 [ValidateAntiForgeryToken]和@ Html.AntiForgeryToken() ??

  2. 请我需要使用它们??

  3. 哪些cookie的我要使用??

我的web.config中的一部分这样的;

My web.config's part like this;

<authorization>
  <deny users="?" />
</authorization>
<authentication mode="Forms">
  <forms loginUrl="~/User/Login" timeout="30" cookieless="UseDeviceProfile" name="AbosSMSP" />
</authentication>

我的错误是这样;

My error like this;

推荐答案

在antiforgerytoken想象是确保了即将后采取行动的请求实际上是一个源自你的输出视图的方式。它停止跨站点脚本攻击,我认为它处理后重放攻击了。

Think of the antiforgerytoken is a way of ensuring that the request that is coming to a post action is actually one that originated from your outputted view. It stops cross site scripting attacks and i think it handles post replay attacks too.

保护前门你的应用是一个良好的开端,它将停止有蛮力窃取他们的数据的人,但是,它不会停止所有形式的攻击。之类的东西社会工程学和钓鱼可以让别人在你的网站没有他们打破了登录页面。

Securing the front door to your application is a good start, it stops people having their data stolen by brute force, however, it doesn't stop all forms of attacks. things like social engineering and phishing can let someone in to your site without them breaking the login page.

一旦有污秽的种种,他们最多可以得到,所以看OSWAP建议,并看看是否有您可能会受到其他攻击。 <一href=\"http://www.ergon.ch/fileadmin/doc/Airlock_Factsheet_OWASP_en.pdf\">http://www.ergon.ch/fileadmin/doc/Airlock_Factsheet_OWASP_en.pdf

Once in, there are all sorts of nastiness that they can get up to, so look at the OSWAP recommendations and see if there are any other attacks that you might be vulnerable to. http://www.ergon.ch/fileadmin/doc/Airlock_Factsheet_OWASP_en.pdf

如果有疑问,你可以有你的网站笔由道德黑客几百斯特林测试,如果你是敏感数据的照顾,那么我会建议,因为他们将拉起的事情,你甚至可能没有想到的

If in doubt, you can have your site pen tested by ethical hackers for a few hundred stirling, if you are looking after sensitive data, then i would recommend that, as they will pull up things that you might not even think of.

我对安全的关键技巧


  1. Antiforgerytoken在登录页面

  2. 慢的所有验证试图减少至少第二(使蛮力不切实际)

  3. 实施帐户锁定程序无效登录N个数量

  4. 请务必使用一个通用的错误消息,在你登录失败,以prevent黑客知道哪一个登录的一部分是错误的

  5. 始终加密与盐的数据库密码,盐应该是每个用户prevent被盗数据库的彩虹攻击

  6. 务必确保显示或检索的任何数据是有效的用户

  7. 始终使用参数化的SQL

  8. 尝试和混淆在URL传来传去的ID和意见,以prevent修改或直接引用攻击企图

在此之后,我想你会盖掉大部分东西渗透测试将提高,并设置你在一个非常有利的安全站点

Following that, I think you will cover off most of what a pen test would raise and set you on a good stead for a secure site

这篇关于我是否需要使用`[ValidateAntiForgeryToken]和@ Html.AntiForgeryToken()`在我的所有网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆