Applied Exploit and Hacking 2
Applied Exploit and Hacking 2
Name:
Aftab Hussain
Roll no:
Fa-21/Bs DFCS/033
Submitted by:
Aftab Hussain
Submitted to:
Saud Bin Farooq
Assignment:
Applied Exploits and Hacking
First, I installed XAMPP and turned on Apache and MySQL. The image below shows this.
In the image above, the services are running. Now, we check if the localhost is working. If it is,
we open phpMyAdmin and create a database for our login page.
This image shows that phpMyAdmin is working fine, so the next step is to create a database in it.
The image above shows the code to create a database called vulnerable_sqli with 2 users in it.
Now, run these queries to see what happens.
There were no errors after running the queries. In the left panel, we can see that our database
named vulnerable_sqli has been created. Now, I will show you its table.
The image above shows a users table with usernames and passwords.
Now we need to make a folder for our website in C:\xampp\htdocs*. I created a folder named
sqli_site inside it. The next step is to create a connection file. Here it is:
Now it's time to make a login page for our website. Here is the code:
Our code is running on localhost without any errors. Now, we will try some common SQL
injection attacks on it.
First, I used the payload shown in the image below:
When I used 'order by 3', it showed login failed. Now, I will test using 'order by 4.
It gave an error, which means there are three valid columns. Now, let's try more injections.
' UNION SELECT 1, 2, @@version –
To find the database version, we put @@version in the third column and got: 10.4.32-MariaDB.
Now, let's try other SQL injections to find the database name.
' UNION SELECT 1, 2, database () –
It showed this message, but the file was created in the folder as expected.