Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.Net Validaterequest False

I'm creating an Asp.Net program UI where users can browse and change information in a database. For this reason, they need to be able to use all forms of chars, but I still need to keep the program HTML and SQL itself secure. For that reason, I'm using a self-built method that replaces dangerous chars such as '<' etc with their html-codes while they're being handled outside of a textbox (issued on page-load so they have no functionality in there).

Now my dilemma: To be able to do this, I have to disable the Validaterequest parameter as per the topic, the program will issue a complaint. What are the possible consequences of setting it to False?

The SQL query is parametirized already, and I filter out the following marks only:

& # < > " ’ % @ =

Question: am I leaving the program open for threats even if I handle the chars above? Basically this is an intranet application where only a few people will be able to access the program. Nevertheless, the information it accesses is fairly important so even unintentional mishaps should be prevented. I literally have no idea what the Validaterequest thing even does.

Edit: Alright, thx for the answers. I'll just go with this then as initially planned.

like image 987
Zan Avatar asked Nov 20 '25 00:11

Zan


2 Answers

The main things Validate Request is looking for are < and > characters, to stop you opening your site up to malicious users posting script and or HTML to your site.

If you're happy with the code you've got stripping out HTML mark-up, or you are not displaying the saved data back to the website without processing, then you should be ok.

like image 139
Zhaph - Ben Duguid Avatar answered Nov 22 '25 14:11

Zhaph - Ben Duguid


Basically validating user input by replacing special characters usually cause more trouble and doesn't really solve the problem. It all depends what the user will input, sometimes they need the special characters like

& # < > " ’ % @ =

think about savvy users could still use xp_ command or even use CONVERT() function to do a ASCII/binary automated attack. As long as you parametrized all input, it should be ok.

like image 31
Liwen Avatar answered Nov 22 '25 14:11

Liwen