
Yes , there is indeed a solution.
We also perform security testing in our project and the top 10 security vulnerabilities are listed by Open Web Application Security Project(OWASP) are (
http://www.troyhunt.com/2010/05/owasp-top-10-for-net-developers-part-1.html ) :
1. Injection
2. Cross-Site Scripting (XSS)
3. Broken Authentication and Session Management
4. Insecure Direct Object References
5. Cross-Site Request Forgery (CSRF)
6. Security Misconfiguration
7. Insecure Cryptographic Storage
8. Failure to Restrict URL Access
9. Insufficient Transport Layer Protection
10. Unvalidated Redirects and Forwards
This is the industry practice that we must follow to secure our website.
Specific to the question being asked, the security issue occurred most likely because of the violation of (1) and (2).
For (1), the probable solution will be
- Use parameterized query
- Use ORM tools like EF
- Use regular expression to discard input string e.g. Regex(@"^0*[1-9][0-9]*$") For (2), the probable solution will be
- Use DataAnnotations to preform white-list validation using regular expression e.g. [RegularExpression(@"^[a-zA-Z''-'\s]{1,400}$", ErrorMessage = "Characters are not allowed.")]
public string Message { get; set; } - Perform Output Encoding by using Server.HtmlEncode
- Open Nuget and install AntiXSS package and then use the sanitizer for this. Hope that helps.
Let us know if any concern.
Thanks
--
Thanks & Regards,
RNA Team
Modit, if this helps please login to Mark As Answer. | Alert Moderator