我试图打开viewstate加密始终作为IIS6中托管的ASP.NET 3.5网站的安全措施.我们关闭了viewstate,但仍然在此字符串中看到一些"controlstate".在测试环境中,我只需在web.config中设置以下内容,我就不能再将basest解码为viewstate为半明文:
<pages enableViewState="false" enableViewStateMac="true" viewStateEncryptionMode="Always">
我甚至将以下内容(由机器密钥生成器生成)添加到machine.config并仍然在我的测试服务器上加密viewstate:
<machineKey validationKey="002..." decryptionKey="D90E..." validation="SHA1" decryption="AES" />
我的非测试环境似乎没有获得上述更改,因为我始终可以使用上述设置将viewstate解码为纯文本.在做出任何改变之后,我总是感到不安.
有关我的非测试网络服务器的一些信息:
任何人都可以建议在哪里寻找可能会干扰asp.net viewstate加密的其他设置?
编辑:现在在我的iis测试服务器上我无法撤消viewStateEncryptionMode设置,因为它正在加密视图状态,即使我将其设置为"从不"并且我的其他网站似乎都没有抓住此设置.我在哪里可以看到这个属性被覆盖的地方?是否存在需要清除此设置的缓存,除了iisreset/stop www service/touch machine.config时要执行的操作?
编辑决赛:经过几天研究配置文件后,我放弃并通过代码实现了这一点.我已经有一个附加到页面事件的安全模块,所以在Page_Load中我添加了:Page.RegisterRequiresViewStateEncryption();
我真的很想知道是什么阻止了这个设置被IIS6 immediatley选中.当我在本地运行cassini时,如果我通过pages节点将viewStateEncryptionMode设置为"Always",我会立即看到它对viewstate进行编码并使用id ="__ VIEWSTATEENCRYPTED"渲染其他隐藏字段.当我将其设置为"从不"时,我会立即看到加密关闭.如果我对我的IIS6托管网站上的网站进行了相同的更改,它将立即生效,但如果我允许设置保留在那里,它最终会占用.我会停止/启动www服务,重置iis,清除ASPNET临时缓存,但我不知道还有什么可以尝试?希望这篇文章可以ROT一段时间,将来有人会看到我所经历的相同行为,我们可以进一步弄清楚这一点!
我有一个内部NuGet包,其中包含一个dll,没有外部NuGet包依赖项,也没有web.config转换.
然而,当我在我的项目(类lib和网站)上为这个特定的NuGet运行Update-Package时,它会自动更新我的网站web.config程序集绑定重定向到旧版本的System.Web.Mvc和Newtonsoft.Json.web.config网站目前已将它们绑定到正在使用的最新版本.
使用GUI,利用管理NuGet包进行解决方案...我选择为具有旧版本引用的适用项目更新此NuGet.然后选择更新
以下是Package Manager的输出:http://pastebin.com/3ySwTRFR
我的web.config来自:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)
至:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)
我正在更新的NuGet包有一个引用Newtonsoft.Json的dll(但是没有明确地使用NuGet包依赖)
当不知情的开发人员更新这个NuGet包时,它会破坏运行时寻找旧版本的MVC或JSON.NET dll.
在过去,我尝试使用-IgnoreDependencies powershell命令开关,但这似乎对该问题没有影响.
在update-package期间有什么可以改变我的web.configs(没有显式转换)的想法?
编辑:VS2015与NuGet 3.3.0似乎表现得更好...在随机软件包更新期间,它发现了一个旧的BAD绑定重定向并更正了它! 
asp.net-mvc json.net nuget assembly-binding-redirect visual-studio-2013
不推荐使用允许覆盖它的以前的HtmlHelper.AntiForgeryToken方法string path.
[ObsoleteAttribute("This method is deprecated. Use the AntiForgeryToken() method instead. To specify a custom domain for the generated cookie, use the <httpCookies> configuration element. To specify custom data to be embedded within the token, use the static AntiForgeryConfig.AdditionalDataProvider property.",
true)]
public MvcHtmlString AntiForgeryToken(
string salt,
string domain,
string path
)
Run Code Online (Sandbox Code Playgroud)
告诉你使用<httpCookies>.但httpCookies元素没有PATH的设置.
这是对这种方法的弃用的疏忽吗?覆盖此cookie路径的最佳方法是什么?(手动?)在虚拟应用程序中运行网站不会隐式地将应用程序路径添加到__RequestVeririfcation cookie.
asp.net-mvc csrf antiforgerytoken cookie-path asp.net-mvc-5.2
由于某些安全问题,我需要启用View State Encryption.我关闭了viewstate&viewstateMAC但我需要加密__VIEWSTATE表单参数中包含的" 控件状态 "字符串.
目前我的web.config看起来像:
<pages enableViewState="false" enableViewStateMac="false">
Run Code Online (Sandbox Code Playgroud)
当我在cassini中设置以下内容时,我的viewstate被加密:
<pages enableViewState="false" enableViewStateMac="false" viewStateEncryptionMode="Always">
Run Code Online (Sandbox Code Playgroud)
当我在IIS 6服务器上进行相同的更改时,没有任何反应.
我看到应用程序域回收(事件:应用程序'/ LM/W3SVC/...'位于'C:...'初始化为域'...').当我触摸web.config但我没有像cassini那样获得加密的viewstate.我试过Site Stop/Start,IIS重置停止/启动,清除ASP.NET临时文件缓存.任何人都有什么建议来配置这个需要做什么?
我没有找到任何类型的屏蔽输入支持KendoUI是否有任何计划用于未来的版本?我可以访问预览版吗?
asp.net ×2
asp.net-mvc ×2
encryption ×2
viewstate ×2
base64 ×1
cassini ×1
cookie-path ×1
csrf ×1
iis-6 ×1
json.net ×1
kendo-ui ×1
machinekey ×1
nuget ×1