In this article we are going to discus some of the Security Related Checklist for ASP.Net Developers. I have four main areas to discus about the security related issues
- Input Validation and Authentication Checklist
- Web Services Security Checklist
- Data Access Security Checklist
- Client Script Maintainability Checklist
Scope : Input Validation and Authentication Checklist for ASP.Net Applications
- Use client side validation.
- Every input must be validated before it is processed by the application.
- User inputs must be encoded using HTMLEncode and URLEncode to prevent Cross Site Scripting (XSS)
- If an array is used to pass input to an unmanaged API, check that the managed wrapper verifies that the array capacity is not exceeded to avoid Buffer overflow attack.
- Values passed as the parameters of unmanaged API must be validated to avoid Buffer overflow attack.
- Regular expressions must be used for validating the input.
- Classes must not directly expose fields. Use properties instead.
- Use only “get accessor” while defining a property, if the property is read only.
- Authentication information must not be stored on the client.
- If using cookies, expiry values must be set for all cookies.
- Hidden fields must not be used for passing security credentials.
- Avoid hard coding.
- Only use Secure Sockets Layer (SSL) for pages that require it.
- Cryptography. If your application only needs to ensure that information is not tampered with during transit, you can use keyed hashing. Although larger key sizes provide greater encryption strength, performance is slower relative to smaller key sizes.
- Whenever a critical function is being called or a database operation is being performed, user must be re-authenticated.
- All the database user id and password inside the application parameter is required to be encoded.
Scope : Web Services Security Checklist
- Check whether web service does not expose restricted operations or data.
- Check whether callers are authorized.
- Check that all publicly exposed web methods validate their input parameters before using or passing them to database or component.
- Use the OneWay attribute on Web methods or remote object methods if you do not need a response.
Scope : Data Access Security Checklist
- Use Stored Procedures for data access over inline query.
- Use DataReader for fast and efficient data binding
- Use ExecuteNonQuery for commands that do not return data
- Use ExecuteScalar to return single values.
- Prefer basic types to reduce serialization costs.
Scope : Client Script Maintainability Checklist
- Adding JavaScript in the body tag of the document should be avoided. The scripts don’t get cached and adds to the page weight. Moreover it is not good for maintainability if we mix HTML and scripting
- Inline JavaScript should be avoided
- Use Namespace to avoid functions and variables to be overwritten by the one written by other developers
- Give unique Ids to DOM elements
- Always access the DOM elements with there Id
- If you require a certain version of JavaScript then specify the version as part of the language attribute in the script tag.
- To avoid confusion always end single JavaScript statements with a semi-colon
- Use double quotes (") for HTML attributes and single quotes (’) for JavaScript string literals
Conclusion
By following the above mentioned checklist we can make sure that the ASP.Net application created is robust, maintainable and secure. Apart from these items you can also check the ASP.Net Performance Improvement Tips that i will be posting as next article. Happy Programming
Related Posts
- Checklist/Guidelines for ASP.Net Developers
- ASP.Net Performance Improvement Tips
- Handling ASP.Net Controls in JavaScript
- Search Engine Friendly URL (URL Mapping) in ASP.Net 2.0
- ASP.Net Tutorial: Wizard Control
Tags: asp.net, asp.net developer checklist, asp.net security checklist, Developer Checklist





thanks, your site is very nice source of knowledge. Btw: your RSS feed http://technotes.towardsjob.com/feed/ is broken. Can you fix it? I would like to subscribe.
Hi
Thanks for the catch, It problem in feed is fixed now you can subscribe to http://feeds.feedburner.com/towardsjob/tech
Thanks