Is EnableViewStateMAC=true compulsory for ViewStateEncryption in an ASP.Net Website?

Is EnableViewStateMAC=true compulsory for ViewStateEncryption in an ASP.Net Website?

问题

I'm currently fixing some Security issues in our ASP.net website application.

One of the issue was that the ViewState was not encrypted.

So I did check on StackOverFlow and elsewhere on how to encrypt the viewState, and I did it using the <pages viewStateEncryptionMode="Always" /> and adding a 3DES machinekey like this <machineKey validation="3DES" /> in Web.config .

I would like to know if the "EnableViewStateMAC=true" is also compulsorily necessary? since this was mentioned in some of the suggested solutions I had found online. But, on my checks I found the encryption is working even without this.

[NOTE: I had to do these changes at an application level (Web.config) since making individual page changes is not a practical solution for this application.]

 

回答1

Do not ever set EnableViewStateMac to false, even if encryption is enabled. The MAC guarantees that the client cannot maliciously tamper with the contents of ViewState. (Encryption by itself isn't sufficient to guarantee this; the MAC is necessary.)

The EnableViewStateMac property will be removed in a future version of the product since there is no valid reason to set it to 'false'.

 

回答2

Just in case:

Starting with ASP.NET 4.5.2, the runtime enforces EnableViewStateMac = true

more details here: ASP.NET 4.5.2 and EnableViewStateMac

 

回答3

You might want to note that as of September 2014

All versions of the ASP.NET runtime 1.1 - 4.5.2 now forbid setting

<%@ Page EnableViewStateMac="false" %>

and

<pages enableViewStateMac="false" />

http://blogs.msdn.com/b/webdev/archive/2014/09/09/farewell-enableviewstatemac.aspx

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(80)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2020-06-17 Passing Reference-Type Parameters (C# Programming Guide)
2020-06-17 What's the difference between the 'ref' and 'out' keywords?
2020-06-17 How To Verify TLS Options in Windows
2020-06-17 How to auto-generate a C# class file from a JSON string [closed]
2020-06-17 javascript-questions
点击右上角即可分享
微信分享提示