What is SQL injection?


SQL injection is a code-injection method that exploits security vunerabilities in database applications.

How SQL injection works

An application or web site with a database back-end should implement filtering on any data entered by a user, such as a web site front-end. If the data entered is not properly escaped to eliminate any database programming language code, known as SQL, then it is possible that the data entered could be executed, performing an unauthorised action on the database.

For instance, a web site could ask a user to enter some data which it will use to perform a search on a database, and if it finds anything that matches the text entered it returns the results. However by entering SQL code into the data entry field it is possible to get the code 'injected' into the query that the application is running, which could retrieve information that the user should not have access to, or to do something malicious such as changing or deleting data in the database, or even deleting the database tables.

Last word

Code-injection is a popular method of getting computer software and services to perform actions that a user does not have access to. SQL injection is a form of code-injection that targets databases.

If you have any feedback regarding this article, or you have a suggestion for a new article, or just want to say thanks for the info then feel free to drop me an email at

Article date: 26th February 2011

Click here for more articles