Considering that the Injection and XSS attacks contain the first two places in OWASP top 10 , you have to be very careful, then you will disable request checking in asp.net.
First, do not disable request validation if it is really necessary. You have a reason to do this. Request validation is a proprietary mechanism against attacks such as XSS.
The second always does a white list check for all input fields, which allows only acceptable charters to be passed.
There will be cases, then you will need to skip characters like '<' or '>', which is potentially dangerous.
Thus, you should always code the output if you display it on the page. Always. This will prevent JavaScript from executing (if it was inserted into the input).
Parameterized queries should be used in conjunction with the aforementioned validation and whitelisting encoding to prevent attacks on SQL injection.
Also, do not create a dynamic query construct (dynamic sql) inside the sql stored procedure.
And make sure that all database users and sql stored procedures have an appropriate level of access to database resources (minimal approach to access rights).
Georgii Gonchar
source share