The Structured Query Language (SQL) is a type of computer language designed for the specific purpose of manipulating and managing data in a database.  Since it was first devised, SQL has steadily increased in popularity among both commercial and open source database protocols for internal security systems and various devices.

Knowing this, let’s take a look at Structured Query Language injection (SQLi) is a specific type of vulnerabilities attack that targets SQL databases (of course), to introduce specifically crafted SQL statements that will manipulate the system into doing unexpected and, more importantly, undesired results.

WHAT CONSTITUTES A STRUCTURED QUERY LANGUAGE INJECTION ATTACK

A successful SQLi attack issued by a threat actor should include the following things:

  • Authentication bypass
  • Stealing or exfiltering of data
  • Modifying or corrupting of data
  • Deleting data
  • Running arbitrary (random) code
  • Getting root access to the system

TYPES OF STRUCTURED QUERY LANGUAGE INJECTION ATTACKS

There many ways a threat actor can carry out a SQLi attack.

  • Unsanitized Input—in this type of attack, the threat actor provides user input that has not been properly sanitized for characters that would normally be escaped. The input could also or instead be validated as the type that would be expected or corrected.
  • Blind SQL Injection—also called “Inferential SQL Injection” this type of attack does not reveal data directly taken from the database that is being targeted. Instead, the attacker will look for indirect clues in behavior. This could include HTTP response details, blank web pages, user input database response, and others.
  • Out-Of-Band Injection—this type of attack is more complex than others, as it can be used by a threat actor when they cannot otherwise achieve their goal in one, direct query-response attack. Generally, an attacker crafts specific SQL statements that are then presented to a database and will trigger this database system to connect with an external server to supply control to the attacker

PREVENTING STRUCTURED QUERY LANGAGE INJECTION ATTACKS

You can prevent SQLi attacks by following these guidelines:

  • Use SQL that is not dynamic
  • Sanitize your user-provided inputs
  • Secure and keep hidden your sensitive data like popular brands like Hikvision do.(avoid plain text)
  • Limit your database permissions and other privileges
  • Avoid keeping database errors open and directly available to users
  • Use a Web Application Firewall (WAF) for all web applications that have access to databases
  • Use web application security testing solutions to test web apps that have interactions with databases, on a regular basis
  • Keep your databases updated, always, with the most recent patches available

About The Author