首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >消息:检测到CSRF攻击

消息:检测到CSRF攻击
EN

Stack Overflow用户
提问于 2017-02-16 16:45:48
回答 3查看 2.4K关注 0票数 0

我正在努力解决这个问题。

我有两个cdn url abc.com指向elb1,def.com指向elb2。

两个elb (elb1和elb2)都指向负载均衡的相同ec2实例(ec2-A和ec2-B)

我可以登录到从abc.com导航的服务器,但无法登录到从def.com导航的服务器

def.com登录显示以下错误。

因为两个dns指向相同EC2。Web.config文件是相同的。

代码语言:javascript
复制
Message: CSRF attack detected.

Exception type: CMS.Protection.Web.UI.CsrfException
Stack trace: 
at CMS.Protection.Web.UI.CsrfProtection.ThrowCsrfException(Exception innerException)
at CMS.Protection.Web.UI.CsrfProtection.OnPostMapRequestHandlerExecute(Object sender, EventArgs eventArgs)
at CMS.Base.AbstractHandler.CallEventHandler[TArgs](EventHandler`1 h, TArgs e)
at CMS.Base.AbstractHandler.Raise[TArgs](String partName, List`1 list, TArgs e, Boolean important)
at CMS.Base.SimpleHandler`2.RaiseExecute(TArgs e)
at CMS.Base.SimpleHandler`2.RaiseExecute(TArgs e)
at CMS.Base.SimpleHandler`2.StartEvent(TArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Message: Error occurred during a cryptographic operation.

Exception type: System.Security.Cryptography.CryptographicException
Stack trace: 
at System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.HomogenizeErrors(Func`2 func, Byte[] input)
at CMS.Protection.Web.UI.CsrfProtection.OnPostMapRequestHandlerExecute(Object sender, EventArgs eventArgs)
EN

回答 3

Stack Overflow用户

发布于 2017-02-16 19:22:57

Kentico中的CSRF保护使用MachineKey.Unprotect()方法验证令牌,因此所有服务器都必须使用相同的加密密钥。

有关如何实现此行为的更多详细信息,请参阅documentation

票数 2
EN

Stack Overflow用户

发布于 2017-02-16 19:17:42

它已修复,我生成了机器密钥,并将相同的机器密钥放入两个ec2实例中。因此,问题就解决了。

票数 0
EN

Stack Overflow用户

发布于 2017-02-16 17:12:22

Neshi是正确的,你需要确保页面上的post请求来自相同的来源,否则你几乎满足了跨站点脚本的定义。

总体设置相当复杂,但是您仍然需要确保CSRF cookie中的安全令牌与加载时由CMSPage生成的令牌相同,我不确定这些重定向和加载传输是否能够做到这一点,以及是否能够保持足够的会话粘性。

一般描述请访问:https://docs.kentico.com/k10/securing-websites/developing-secure-websites/cross-site-request-forgery-csrf-xsrf

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42268865

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档