.net - ScriptResource 错误 : am I being hacked?

标签 .net scriptresource.axd

我在我的一个网站上不断收到这样的错误。它往往会在一天中随机发生,在我不希望网站上有用户的夜晚期间。

它总是来自不同的 IP 地址

System.Web.HttpException: Invalid viewstate. at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType) at System.Web.UI.Page.DecryptString(String s)



或者

System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed. at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast) at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) at System.Security.Cryptography.CryptoStream.FlushFinalBlock() at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo) at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType) at System.Web.UI.Page.DecryptString(String s)



它们发生在此页面中:
 ScriptResource.axd?d=VVe1O4rzLSI9hB5nRzBXZxUYTQz6ylDTL9djGR

该站点使用 Ajax 并在 .NET 3 上运行。

这是有人试图入侵该网站吗?网站上的html有错误吗?

有任何想法吗?

最佳答案

我相信此错误是由您的 ViewState 使用过时的 ViewStateUserKey 解密引起的。

消除这些错误是一个两步过程:

  • 确保您拥有特定于站点的验证 key 。您可以使用多个在线资源为您生成一个,例如this one .
  • 确保页面的 ViewStateUserKey 始终一致。来自 MSDN 文档:

  • Setting the ViewStateUserKey property can help you prevent attacks on your application from malicious users. It does this by allowing you to assign an identifier to the view-state variable for individual users so that they cannot use the variable to generate an attack. You can set this property to any string value, such as the user's session ID or the user's authenticated name.



    你可以通过自己设置来做到这一点(可能在你的页面或基本页面的 Init 事件中):
    if (Session["ViewStateUserKey"] == null)
    {
        Session["ViewStateUserKey"] = new Guid().ToString();
    }    
    this.Page.ViewStateUserKey = Session["ViewStateUserKey"].ToString();
    

    不,我不认为你被黑了。

    关于.net - ScriptResource 错误 : am I being hacked?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/934462/

    相关文章:

    c# - 如何在电子邮件正文部分发送外部图像?

    .net - 匹配 YYYYMM 值的正则表达式

    c# - 在另一个事件处理程序中调用事件处理程序?

    iis-7 - 反向代理 (ARR) 和 ScriptResource.axd 问题

    javascript - 如何强制 ASP.NET Ajax 使用 FS 中的脚本而不是 WebResource.axd,或者减少其 HTTP 请求?

    .net - 如何在 Viewbox 中拉伸(stretch) Grid

    c# - 伙计,我的目标在哪里?或者,为什么 Linq 不返回我的对象​​?

    ScriptResource.axd d 查询字符串参数

    ASP.NET Web 应用程序 - WebResource.axd 和 ScriptResource.axd 文件 - 加载时间问题

    internet-explorer - SSRS 报告 IE8 ScriptResource.axd 压缩/解压错误