SQL Injection Vulnerability -Web Application Penetration Testing

Gokul
3 min readJan 29, 2023

--

SQL injection

What is SQLi

Using SQL injection Vulnerability, attackers can insert a string of malicious code into a database query Statement, giving them access to an online application’s database without any authorization.

The most common targets of SQL injection attacks, which can affect any software that uses a SQL database, are websites. It’s common to utilise SQL databases like MySQL, Oracle, and SQL Server.

The fact that SQL injections are included among the top 10 dangers to the security of online applications indicates that they are among the most often used security attacks. The likelihood of SQLi exploits has grown, as has the potential damage they may do, thanks to the availability of automated tools for conducting SQL injections.

Impact of SQLi

A SQL injection (SQLi) modifies SQL code to allow access to restricted resources, such as confidential data, or to run malicious SQL commands. An effective SQL injection can make confidential information, client information, or a private company’s login credentials public.

How does a SQL injection attack work?

A SQL query is a query instructing an application database to carry out a certain function. Furthermore, inquiries may be used to carry out operating system commands.

A collection of parameters guarantees that just the desired records are delivered when a user runs a query.Attackers make use of this by inserting malicious code into the query’s input form during a SQL injection.

Approach To Attack

Learning how the targeted database works is the first step in a SQL injection attack. In order to do this, several random values are inserted into the query to see how the server responds.

Using what they have learned about the database, attackers next construct a query that the server will interpret and execute as a SQL command.

For example,

a database may have details on customers who have made purchases and have customer ID numbers. Instead of searching for a specific customer ID, an attacker may write “Customer-ID = 1000 OR 1=1” in the input box.

As 1=1 is a constant, the SQL query would return all customer IDs that were accessible together with any associated data.Because of this, the attacker to gain administrative privileges by avoiding authentication.

In addition to providing unlawful information, SQL attacks may be developed to delete an entire database, get around password requirements, remove entries, or add unwanted data.

How many different kinds of SQL injection attacks exist?

A few distinct kinds of SQL injection attacks exist.

  1. In-band SQLi
  2. Inferential SQLi
  3. Out-of-band SQLi

In-band SQLi

Error-based and Union-based attacks are the most frequent ways to do an in-band SQLi.

  1. The database is forced to generate error messages through error-based injection techniques, which disclose details about the database’s structure.
  2. Prepared statements that take use of the SQL Union function, which aggregates the output of several searches into a single result, are used in union-based attacks.

Inferential SQLi

Inferential SQL injections, sometimes referred to as blind SQL injections, occur when hackers transmit data payloads to a database server in order to monitor its reaction and behavior without being able to see what is actually happening inside the database. The attacker can modify their attack plan using the server’s response, which offers hints.

An inferential SQLi may be time-based or Boolean.

  1. A time-based SQLi specifies a response period
  2. Boolean SQLi employs true or false statements to elicit a response.

Out-of-band SQLi

An out-of-band SQLi occurs when hackers access data through the domain name system or HTTP queries.

Normally, an out-of-band SQLi is only executed when a web server is too sluggish or when it is impossible to run an in-band SQLi.

Thank you for Reading This content.I hope you got some Knowledge from this post.Grow your Knowledge with medium.

--

--

Gokul
Gokul

Written by Gokul

Cybersecurity Enthusiast | Smart India Hackathon |TN Police Hackathon Finalist | Linux | WebApp Penetration Tester | CCNA |Intern At Coimbatore CyberCrime Dept

No responses yet