A successful
SQL injection attack enables a malicious user to execute commands in your application's database by using the privileges granted to your application's login. The problem is more severe if your application uses an over-privileged account to connect to the database. For example, if your application's login has privileges to eliminate a database, then without adequate safeguards, an attacker might be able to perform this operation.
SQL injection attacks take advantage of code that does not filter input that is being entered directly into a form. Susceptible applications are applications that take direct user input and then generate dynamic SQL that is executed via back-end code. For example say you have a logon form that accepts a user name and password. Once authenticated against the database, the application then sets a session value, or some other token for allowing the user to access the protected data.
How to avoid SQL Injection Attack
Common vulnerabilities that make your data access code susceptible to SQL injection attacks include
| » |
Weak input validation. |
| » |
Dynamic construction of SQL statements without the use of type-safe parameters. |
| » |
Use of over-privileged database logins. |
| » |
Use stored procedures for database access. |
| » |
Isolate the web server. |
| » |
Configure error reporting. |