Spiegato, Home

Technology and Gadgets

What is an SQL Injection?

  • Published by Spiegato
  • 2 min read

A Structured Query Language (SQL) injection is a type of attack that is almost always attempted against a website that is database driven. It is an endeavor to insert malicious code into the SQL queries of the site in order to interfere with data management by destroying, altering or revealing data that is stored in the tables of the database that drives the site. SQL is a standard programming language employed to create, update and retrieve data that is stored in databases.

The dangers of SQL injection attacks are numerous and often very devastating when they are successfully carried out. Sensitive information such as credit card numbers, a person’s medical records, usernames and passwords for accounts such as online banking and email as well as various types of identification numbers can be exposed to cybercriminals. Although the theft of data probably is the principal goal of anyone who attempts to use SQL injection, it is not the only motivation for the use of this or any other type of code injection technique, such as cross-site scripting. Visitors to a website displaying information that they don’t like might attempt SQL injection attacks to disable the site, steal data or alter the data to destroy the mission of the people behind the site.

Sometimes an SQL injection attack is attempted against a website by a disgruntled visitor who might have had his or her account banned by the site owners, who envies the popularity of the site or who seeks to destroy the online business of someone he or she considers to be an enemy. Knowledge of SQL obviously is required to launch an SQL injection attack, but it is not generally considered a very difficult language to learn, compared with other programming languages, and much can be accomplished with only a basic, but solid, understanding of how to use it. This means that there are a good number of people who surf the Internet who have the necessary skill to attempt SQL injection against a website.

Web developers, particularly those who specialize in back-end web development, are responsible for ensuring that the sites they program are secure against SQL injection. There almost always is more than one way to achieve such important security, and most of those methods are considered simple but very effective solutions. For example, a developer can use the mysql_real_escape_string() function or prepared statements when scripting in the hypertext preprocessor (PHP) language. The methods chosen to guard against attack must be carefully considered, because the performance of the site as a whole cannot be disregarded even when setting up security.

Key terms in this article

Related articles

  • What Is SQL Database Training?

    A structured query language (SQL) database is a file system created by Microsoft® Corporation to manage information. SQL database training teaches a…

  • What Are SQL Databases?

    Structured Query Language (SQL) is often thought of as a database, though SQL databases actually do not exist. Rather, SQL speaks with and manages…

  • What is an SQL Client Connection?

    Computers require special software to connect to external data sources. A structured query language (SQL) client connection is software that provides this…

  • What are the Different Types of SQL Software?

    Different types of Structured Query Language (SQL) software have developed for various reasons. SQL is open source software, meaning its development and…

  • What is SQL (Structured Query Language)?

    One of the prime uses of computers, since their inception, has been the manipulation of data. Databases by the millions have been created and manipulated…