SQL injection

It is a way of hacking on a database driven application in which the hacker executes unauthorized SQL commands by taking advantage of insecure code on a system connected to the Internet, bypassing the firewall.

SQL injection hackers are used to steal information from a database from which the data would normally not be available and/or to gain access to an organization’s host computers through the computer that is hosting the database.

SQL injection attacks typically are easy to avoid by ensuring that a system has strong input validation.


This is your query when the user clicks on a Login button in your system

Select [UserName], [Password] From Users Where UserID = 1;

Here is what the hacker would type in the input fields like username textbox:

Select [UserName], [Password] From Users Where UserID = 1;
Drop Table Users;

Never use a direct query from your application to database.

Instead use stored procedures and implement layers such as data access layer and business logic layer, this would protected you against SQL injection.

Share this post

Leave a comment

Previous Post

Next Post