LAB 6: SQL injection UNION attack, retrieving multiple values in a single column

Problem Statement :

This lab contains an SQL injection vulnerability in the product category filter. The results from the query are returned in the application’s response so you can use a UNION attack to retrieve data from other tables.

The database contains a different table called users, with columns called username and password.

To solve the lab, perform an SQL injection UNION attack that retrieves all usernames and passwords, and use the information to log in as the administrator user.

Solution:

  1. In order to solve this lab, I have to first figure out how can I retrieve data from other tables into one single column (Heading says retrieving multiple values in a single column).

Administrator

3kg6bba8ibuwhhz0xc0m

The URL was crafted as

' UNION SELECT NULL, CONCAT (Username, password) FROM users--

This then restored all both the tables data into single column.

Here we can see the same example in MS SQL DB. Where in CONCAT also takes care of joining A String with Integer.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s