I was trying to break my ASP.NET website by entering HTML into the URL to check for XSS vulnerabilities, but it turns out it's worse than that:
I already went through allowing URLs with other symbols (such as +
) by setting allowDoubleEscaping=true
in my Web.config, but it seems this doesn't work for URLs containing <
, >
, and possibly more. I expect my custom 500 error page to show up using this implementation, but the site doesn't even get that far.
How can I allow these types of URLs through, and handle them with a generic error page?
Edit:
The closest I get to a stacktrace is this:
at vReport2.User.get_Current() in z:\Scott\Projects\Visual Studio\C#\vReport2.1\vReport2.1\Models\User.cs:line 18
at ASP._Page_Views_Shared__Layout_cshtml.Execute() in z:\Scott\Projects\Visual Studio\C#\vReport2.1\vReport2.1\Views\Shared\_Layout.cshtml:line 35
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer)
at System.Web.WebPages.WebPageBase.<>c__DisplayClass3.<RenderPageCore>b__2(TextWriter writer)
at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer)
at System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer, HelperResult content)
at System.Web.WebPages.WebPageBase.Write(HelperResult result)
at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body)
at System.Web.WebPages.WebPageBase.PopContext()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
with the exception being thrown when I try to access HttpContext.Current.Session
in a class.