SQL Injection

Things to consider to avoid SQL Injection:

1. Have a function which vets the inputs from your forms :

 ex: "select", "drop", ";" , "--", "insert", "delete", "xp_" 

2. Escape single quotes with two single quotes

ex: d'souza should be d''souza.

3. Set  size for number of characters text box can accept. Thus limiting the amount of untoward values that can be input

4. Do not use sa account for application related queries. Create a separate account with limited privleges. ex: if you need user to only view reports, create user account which has only 'SELECT' permissions.

Comments

Popular posts from this blog

Drupal - How to display webform node in a block?

Error when Installing SQL Server 2008 R2 Management Studio

Technical Team Lead Interview Questions