Skip to main content

SQL Injection Attack Using SQLMAP Tool In Kali Linux

In current context of digitized world where everything is done over internet, lot of information can be found online. The data can either be private to people or can be public to everyone with no privacy. Everyday lots of data are getting stored in different databases of different websites throughout the world and it is becoming harder to store and protect the data from evasion at the same time. Unauthorized access to such databases can lead to leak of large amount of confidential information related to a person or even an organization. Hackers tend to steal a lot of information through such database by getting either getting authorized or unauthorized access. One of the most common method to get an access to the information's available in a websites database is SQL injection based attacks. 

SQL Injection is a type of an injection attack that makes it possible to execute malicious SQL Statements. With the right set of queries, a user can gain access, update and even modify information stored in databases. It generally allows an attacker to view data that they are not normally able to retrieve. This might include data belonging to other users, or any other data that the application itself is able to access. In many cases, an attacker can modify or delete this data, causing persistent changes to the application's content or behavior. Sql injection is a step by step attack in the database of the website. Steps include:-

Step1:- Deciding the website that you want to attack/perform sql injection on

 In my case i am using a famous vulnerability testing site testphp.vulnweb.com to demonstrate an attack cause demonstrating on other website without their permission is illegal. 

The first thing we should know is the link of the website that we can copy from the url of the website that is testphp.vulnweb.com in my case or can be anything added to this link. The more number of menu options we choose in this website the more number letters and characters will be added to the url address. For example if we go to guestbook menu option in the website the url will change to http://testphp.vulnweb.com/guestbook.php.  We can clearly see that guestbook.php is added at the last of the original url indicating the path of the data.
Our main objective in this demo is to obtain the signup/login information of one of the registered user. As you can see that there is a signup option in the main homepage of the website. 

Step2:- Opening SQLMAP in Kali Linux

Step3:- Find the Databases present in the website

Finding databases and their names is important part of sql injection as all information will be stored in the database. This time we will go to the artists tab and click in one of the artists that is mentioned there and take that url as a sample url. Once SQLMAP opens we can then can write the following command:-

sqlmap -u http://testphp.vulnweb.com/artists.php?artist=1 --dbs


--dbs is used to find the databases present in the website.

In this websites case i found two databases, one by the name of acuart and other by the name of information_schema. We can choose any database in my case i will choose acuart database.

Step4:- Finding Number Of Tables Present In The Database

Once Database is selected there can be multiple tables present inside it so we will have to find the number of tables and their names.




Table Names are displayed as a result. Inside Acuart Database there are 8 tables present. Since our motive in this case is to extract registered user login credentials we can go guess and check each tables inorder to obtain that information. In this case we have a table called users and we can guess that based on the name there might be information regarding registered users. We have to then get an access and look for informations available in users table.

Step5:- Finding Number Of Columns Present In The Table

Every table will have set of rows and columns and it is necessary to find the number of columns and information in those columns. Columns might contain information's such as username, passwords of the registered users.

Once the command is sucessfully run we will obtain the number and names of columns available in the table.


I obtained 8 columns as a result and we can clearly see two columns uname and pass which might contain information regarding user and their password. Along with that there are several other columns such as email, address etc. that might contain email id and address of the users. 

Step6:- View/Extract Information From the Column

Once column names are extracted we can view them individually. I will show the result of uname and pass cause i got information regarding username and password from them. 


once the username and password is retrieved you can either remember it or write it somewhere and login using the valid username and password that we extracted.

In this case for the username test we got result like this:-
As you can see in the picture we were able to retrieve information of that registered user and apart from that we can also remove or modify information's that we can see. Different people use sql injection for different purposes, so it literally depends upon the attackers perspective. If SQL injection attack is done by a hacker then it can be for a harmful purpose of either stealing or damaging the data, if performed by an ethical hacker or penetration testers can be used for vulnerability assessment , penetration testing or even finding loopholes in the website.

Comments

Popular posts from this blog

Wireless /Wifi(WEP/WPA/WPA2) Password Cracking Using Dictionary Attack With Aircrack-ng (Kali Linux)

Tools Used:-Aircrack-ng In the present context of networking, WEP is not used cause it is the weakest and easy to crack through the network. WEP/WPA2 are the most used encryption tools to secure the wireless connection.   The most common way of getting past or cracking through WEP and WPA secured wireless connection is through the use of captured handshake. When you want to hack wifi, you need to capture “handshake”. The handshake is the connection of personal computer and wireless network, it is when network packet and personal computer packets meet each other. If you capture handshake then with a handshake you do not need to be in wifi range anymore, you can hack password with handshake and wifi name. Now you need to capture all the packets that are sent through the wifi router and all personal computers in the network . Step1: airmon-ng  This step is done before anything else is done in order to know your wifi interface name. Check the running process and  ...

Making Own Dictionary Using Crunch Commands For Dictionary Attack (Kali linux Tool)

Making own dictionary from words not listed in the normal English dictionary can be helpful specially for people who want to crack passwords based on some person's name, surname or native language words( Example Nepali word, Hindi Word etc). Since most of the word list that are used to hack into a system or crack passwords contain words from English dictionary, passwords such as name of person, surname of person, pet-name and specially words of native language aren't included in that word list as they aren't defined in the English dictionary. This is one the most crucial drawback of dictionary attack. Apart from selective words problem, dictionary attacks usually take lot of time cause they attempt all the words present in the word-list as passwords to crack the authentication system. If we make our own dictionary then it will also help in saving time. But making our own dictionary can only be helpful to only those people who have a hint to what the password might be an...