Union Based SQLi

For UNION SQLi attacks to work, we first need to satisfy two conditions:

  1. The injected UNION query has to include the same number of columns as the original query.

  2. The data types need to be compatible with each column.

Determining the Number of Columns

Ways to detect the number of columns can be found in the below link.

Ways to detect number of columns

One of the payloads:

increase the value until you receive an error.

Displaying value

If you get an error, you can cast a value in the supported column type value.

We can get the table-related information of the database using the below way:

Now we can create a specific SQLi command to see the database's data.

Suppose you get MD5 Hashes then you can crack it.

Using hashcat
Online resource

Last updated