My ASP.NET 3.5 website is logging a lot of errors. It is built using a Master Page, and the Master Page has a text box control named txtSearch that allows customers to search the website. Below is a sample error message. They are all similar to this.
It looks to me like some automated process is trying to hack the site. Can anyone confirm this is what’s happening? Is there something I can do to prevent this?
A potentially dangerous Request.Form value was detected from the client (ctl00$txtSearch="...hozdusjq, <a href="http://st-t...").
at System.Web.HttpRequest.ValidateString(String s, String valueName, String collectionName)
at System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection nvc, String collectionName)
at System.Web.HttpRequest.get_Form()
at System.Web.HttpRequest.get_HasForm()
at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
at System.Web.UI.Page.DeterminePostBackMode()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
If this would be an attempt to hack your site it's a poor attempt. A searchbox could be used for sql-injection, but that doesn't seem to be the case. Some idiot is just trying enter html element in the searchbox, but that's throwing an error because formvalidation
is enabled on your site.
My advice, keep formvalidation enabled as it is. If you don't want these kind of error you could do a validation on the clientside to ensure that special chars like < and > are refused before any postback is made.
Brian_Burgit
Member
264 Points
84 Posts
Is someone trying to hack my site?
Dec 13, 2012 02:17 PM|LINK
My ASP.NET 3.5 website is logging a lot of errors. It is built using a Master Page, and the Master Page has a text box control named txtSearch that allows customers to search the website. Below is a sample error message. They are all similar to this. It looks to me like some automated process is trying to hack the site. Can anyone confirm this is what’s happening? Is there something I can do to prevent this?
A potentially dangerous Request.Form value was detected from the client (ctl00$txtSearch="...hozdusjq, <a href="http://st-t...").
at System.Web.HttpRequest.ValidateString(String s, String valueName, String collectionName)
at System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection nvc, String collectionName)
at System.Web.HttpRequest.get_Form()
at System.Web.HttpRequest.get_HasForm()
at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
at System.Web.UI.Page.DeterminePostBackMode()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Thanks,
Brian
johnyM456
Contributor
2177 Points
347 Posts
Re: Is someone trying to hack my site?
Dec 13, 2012 02:50 PM|LINK
If this would be an attempt to hack your site it's a poor attempt. A searchbox could be used for sql-injection, but that doesn't seem to be the case. Some idiot is just trying enter html element in the searchbox, but that's throwing an error because formvalidation is enabled on your site.
My advice, keep formvalidation enabled as it is. If you don't want these kind of error you could do a validation on the clientside to ensure that special chars like < and > are refused before any postback is made.