Blob Blame History Raw
Index: branches/mono-2-4-2/mcs/class/System.Web/System.Web.UI/PageParser.cs
===================================================================
--- branches/mono-2-4-2/mcs/class/System.Web/System.Web.UI/PageParser.cs	(revision 156449)
+++ branches/mono-2-4-2/mcs/class/System.Web/System.Web.UI/PageParser.cs	(revision 156450)
@@ -45,7 +45,8 @@
 	public sealed class PageParser : TemplateControlParser
 	{
 		PagesEnableSessionState enableSessionState = PagesEnableSessionState.True;
-		bool enableViewStateMac = true;
+		bool enableViewStateMac;
+		bool enableViewStateMacSet;
 		bool smartNavigation;
 		bool haveTrace;
 		bool trace;
@@ -378,8 +379,12 @@
 			enable_event_validation = GetBool (atts, "EnableEventValidation", enable_event_validation);
 			maintainScrollPositionOnPostBack = GetBool (atts, "MaintainScrollPositionOnPostBack", maintainScrollPositionOnPostBack);
 #endif
+			if (atts.ContainsKey ("EnableViewStateMac")) {
+				enableViewStateMac = GetBool (atts, "EnableViewStateMac", enableViewStateMac);
+				enableViewStateMacSet = true;
+			}
+			
 			// Ignored by now
-			GetString (atts, "EnableViewStateMac", null);
 			GetString (atts, "SmartNavigation", null);
 
 			base.ProcessMainAttributes (atts);
@@ -470,6 +475,10 @@
 		internal bool EnableViewStateMac {
 			get { return enableViewStateMac; }
 		}
+
+		internal bool EnableViewStateMacSet {
+			get { return enableViewStateMacSet; }
+		}
 		
 		internal bool SmartNavigation {
 			get { return smartNavigation; }
Index: branches/mono-2-4-2/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- branches/mono-2-4-2/mcs/class/System.Web/System.Web.UI/ChangeLog	(revision 156449)
+++ branches/mono-2-4-2/mcs/class/System.Web/System.Web.UI/ChangeLog	(revision 156450)
@@ -1,3 +1,11 @@
+2010-04-29  Marek Habersack  <mhabersack@novell.com>
+
+	* PageParser.cs, Page.cs: do not ignore the EnableViewStateMac
+	directive attribute. Fixes bug #592428
+	Fixes cross-site scripting vulnerability (CVE: CVE-2010-1459)
+	Credits: Web Security Research Group (WSRG) of Hewlett Packard
+	(HP)
+
 2009-09-15  Marek Habersack  <mhabersack@novell.com>
 
 	* TemplateParser.cs: FindNamespaceInAssembly must catch
Index: branches/mono-2-4-2/mcs/class/System.Web/System.Web.UI/Page.cs
===================================================================
--- branches/mono-2-4-2/mcs/class/System.Web/System.Web.UI/Page.cs	(revision 156449)
+++ branches/mono-2-4-2/mcs/class/System.Web/System.Web.UI/Page.cs	(revision 156450)
@@ -192,11 +192,16 @@
 			asyncTimeout = ps.AsyncTimeout;
 			viewStateEncryptionMode = ps.ViewStateEncryptionMode;
 			_viewState = ps.EnableViewState;
+			_viewStateMac = ps.EnableViewStateMac;
 		} else {
 			asyncTimeout = TimeSpan.FromSeconds (DefaultAsyncTimeout);
 			viewStateEncryptionMode = ViewStateEncryptionMode.Auto;
 			_viewState = true;
 		}
+#else
+		PagesConfiguration ps = PagesConfiguration.GetInstance (HttpContext.Current);
+		if (ps != null)
+			_viewStateMac = ps.EnableViewStateMac;
 #endif
 	}
 
Index: branches/mono-2-4-2/mcs/class/System.Web/System.Web.Configuration/PagesConfiguration.cs
===================================================================
--- branches/mono-2-4-2/mcs/class/System.Web/System.Web.Configuration/PagesConfiguration.cs	(revision 156449)
+++ branches/mono-2-4-2/mcs/class/System.Web/System.Web.Configuration/PagesConfiguration.cs	(revision 156450)
@@ -38,7 +38,7 @@
 		internal bool Buffer = true;
 		internal PagesEnableSessionState EnableSessionState = PagesEnableSessionState.True;
 		internal bool EnableViewState = true;
-		internal bool EnableViewStateMac = false;
+		internal bool EnableViewStateMac = true;
 		internal bool SmartNavigation = false;
 		internal bool AutoEventWireup = true;
 		internal bool ValidateRequest = true;
Index: branches/mono-2-4-2/mcs/class/System.Web/System.Web.Configuration/ChangeLog
===================================================================
--- branches/mono-2-4-2/mcs/class/System.Web/System.Web.Configuration/ChangeLog	(revision 156449)
+++ branches/mono-2-4-2/mcs/class/System.Web/System.Web.Configuration/ChangeLog	(revision 156450)
@@ -1,3 +1,11 @@
+2010-04-29  Marek Habersack  <mhabersack@novell.com>
+
+	* PagesConfiguration.cs: make EnableViewStateMac default to
+	true. Fixes bug #592428 
+	Fixes cross-site scripting vulnerability (CVE: CVE-2010-1459)
+	Credits: Web Security Research Group (WSRG) of Hewlett Packard
+	(HP)
+
 2009-05-14  Marek Habersack  <mhabersack@novell.com>
 
 	* HandlerFactoryConfiguration.cs: if we're matching a default
@@ -943,4 +951,3 @@
 2002-06-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
 	* System.Web.Configuration/HttpCapabilitiesBase.cs: New file.
-
Index: branches/mono-2-4-2/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs
===================================================================
--- branches/mono-2-4-2/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs	(revision 156449)
+++ branches/mono-2-4-2/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs	(revision 156450)
@@ -314,11 +314,13 @@
 		
 		protected override void AddStatementsToInitMethod (CodeMemberMethod method)
 		{
+			ILocation directiveLocation = pageParser.DirectiveLocation;
+			CodeArgumentReferenceExpression ctrlVar = new CodeArgumentReferenceExpression("__ctrl");
+			
+			if (pageParser.EnableViewStateMacSet)
+				method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "EnableViewStateMac", pageParser.EnableViewStateMac), directiveLocation));
 #if NET_2_0
 			AddStatementsFromDirective (method);
-			ILocation directiveLocation = pageParser.DirectiveLocation;
-
-			CodeArgumentReferenceExpression ctrlVar = new CodeArgumentReferenceExpression("__ctrl");
 			if (pageParser.Title != null)
 				method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "Title", pageParser.Title), directiveLocation));