- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
如果您使用 ASP.NET 表单例份验证,您可能熟悉像这样的 URL:
https://Example.com/Banking/login.aspx?ReturnUrl=%2fBanking%2fBalances.aspx
只要您在没有表单例份验证 cookie 的情况下访问“Balances.aspx”,您就会得到这个。 ASP.NET 会将您跳转到登录页面,但会在查询字符串中提供 ReturnUrl,以便它可以将您重定向回来。
不幸的是,这引入了一个未经验证的转发,这是对 OWASP A10 的违规行为.
想象一下,如果我制作了一封电子邮件并将其发送出去......该电子邮件看起来就像来自您银行的电子邮件,并且具有如下 URL:
https://Example.com/Banking/login.aspx?ReturnUrl=https://Example.org/Banking/login.aspx
请注意,我巧妙地将 Example.com
切换为 Example.org
,您可能不会注意到。如果我很聪明,我什至可以使用十六进制代码对整个 ReturnUrl 进行 URL 编码,这样您就看不到它的到来。顺便说一句,我有一个 Example.org
的 EV 证书,这意味着您不会收到网络钓鱼错误,甚至会得到一个漂亮的绿色地址栏。不幸的是,您不会进入您认为自己所在的网站!在我的登录页面版本(看起来就像真实的一样)上,我会告诉你密码错误,你可以重新输入,瞧,我刚刚得到你的密码。
同样的情况...我发送了一封看起来像是来自您的银行的电子邮件。但是您的银行不允许跨域重定向。不过,我可以使用此 URL 发起攻击:
https://Example.com/Banking/login.aspx?ReturnUrl=https://Example.com/Banking/Transfer.aspx?FromAcct=Checking&ToAcct=6273826&ToCountry=Nigeria&Amount=5000.00
上面看起来很糟糕,但请记住我可以使用 URL 编码来屏蔽整个内容,所以它看起来就像十六进制垃圾。
当您单击该链接时,系统会提示您登录您的网站,然后它会立即向我的尼日利亚帐户发出转账。
在我看来,ASP.NET 表单例份验证非常普遍。开发人员如何缓解此漏洞?
最佳答案
如何使用它来将用户重定向到登录页面:
FormsAuthentication.RedirectFromLoginPage
框架中似乎已经内置了保护措施:
By default, the ReturnUrl variable must refer to a page within the current application. If ReturnUrl refers to a page in a different application or on a different server, the RedirectFromLoginPage methods redirects to the URL in the DefaultUrl property. If you want to allow redirects to a page outside the current application, you must set the EnableCrossAppRedirects property to true using the enableCrossAppRedirects attribute of the configuration element.
示例代码:
FormsAuthentication.SetAuthCookie(user.UserName, false);
FormsAuthentication.RedirectFromLoginPage(user.UserName, false);
关于c# - 如何保护内置于表单例份验证中的 OWASP A10?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41817260/
我一直听到关于这个话题的相互矛盾的事实。什么是正确的? 最佳答案 你一直听到相互矛盾的观点,因为这是一个非常困惑的话题,即使在高级工程师中也是如此。简而言之,简单地将程序集放置在 GAC 中确实会隐含
我想看看 shlex对于我正在尝试构建的东西来说是一个不错的选择,所以我想我会把它放在 debug mode 中玩弄它。只有 shlex 的构造函数有这个 weird thing it does :
我想在订阅上设置拒绝规则,以便可以使用自定义角色覆盖贡献者访问权限(但有一些异常(exception)情况)。 我在 MS 门户 ( https://learn.microsoft.com/en-us
我在我的 centos 上手动安装了 Artifactory(V 2.6),并将它与自己的独立码头容器一起使用。我使用 artifactoryctl start 启动它,现在我可以使用 http://
我试图将 TextView 置于表格行内,该 TextView 本身位于表格布局内,但我想我错过了一些东西,因为 TextView 没有居中:s 这是我的方法: private void insert
如果问题已经问过,请随意将此帖子作为重复,我还没有找到与此相同的帖子 据我所知,没有必要return在 void 功能 ,例如: void ex () {printf ("Hi\n");} 但是,如果
我想要做的是将 JMenuItem 元素置于 JPopupMenu 的中心。这就是它们目前的样子 我希望它们位于中间而不是左侧。 这是我的代码的一些部分 JButton lvlBtn = ne
我想创建一个包含许多 JComboBox 的调色板。像这样: for(int x=0; x(new String[] { "First Option", "Second Option", "Third
我有一个 TabBar,我想在上面添加 UIButton,但它位于 tabBar 的后面: 图片( http://i.stack.imgur.com/RxGXb.png ) 如何将其置于前面并覆盖 T
如何以编程方式将 UIActivityViewIndicator 置于 UITableViewCell 中? 最佳答案 在 UITableViewController 的自定义子类中尝试类似的操作:
我似乎无法让 PHP 在 Javascript 标记内回显: places.push(new google.maps.LatLng("")); 我做错了什么? 最佳答案 你试过不加引号吗? place
我正在尝试将 X 和 Y 轴中心的 imageView 显示到 scrollView 上,当我运行应用程序时,它很好地适合设备的宽度。我还想平移和缩放imageView。我已经尝试了几乎所有已发布在
非常感谢您对我的问题提供帮助。 我正在使用 JavaFX 和 NetBeans IDE。我正在为桌面客户端制作一个非常简单的启动窗口。该窗口当前看起来像这个图像。 当前外观: 想要的外观(用油漆编辑)
在下面的屏幕截图中,复选框没有在上面的编辑文本下方居中。我怎样才能使复选框居中,使其在编辑文本的正下方居中? 我用来生成上述 UI 的布局是: 布局 XML 事情,我已经尝试过 Check
一直在尝试创建一个基本上具有背景的程序(使用 Paint() 绘制),然后在其上方放置一个带有图像的标签。 继续获取 Paint 下面的 JLabel... 有什么想法吗? 提前非常感谢。 publi
我在 ScrollView 布局内部的 React Native 项目中使用 FAB。正如预期的那样,FAB 位于 ScrollView 的末尾。 如何将它始终放在 ScrollView 的顶部? 下
尽管文本长度大小不同,但我试图将文本直接对齐在每个图标下方。在这张截图中,我希望一切都以这一行为中心: 我曾尝试使用线性和相对布局来获得我想要的内容,但没有成功。这段代码是我现在拥有的,也是最接近我想
我的应用程序运行良好,但我需要通过 SaveFormController 获取 SaveForm。我需要更改 ApplicationMainFormController 中的 ButtonFuncti
我试图将 UIImageView 置于 ScrollView 的中心。这是我尝试过的代码,但没有结果。 UIImageView *iv = [[UIImageView alloc] initWithI
我有一个包含 MKMapView 和 UIImageView 的 View 。 MKMapView 通过在其自动对齐上设置的约束来定位。对于 ImageView ,我想以编程方式将图像的中心定位在 I
我是一名优秀的程序员,十分优秀!