Hello everyone, with the joy of having new kali version somewhere few of us are having a hard time in setting Dhakkan (AUDI-1) sqli series lab in our kali machine.
So today we’ll be learning how to setup Dhakkan lab (one of the best labs I have seen for practicing and understanding SQL INJECTION) in our latest kali machine.
Download from here
Q – Why it is not as simple as it was in the older version of kali?
Ans- In the latest version of kali we are having PHP version 7.xxx which does not support MySQL functions because it supports MySQLi functions.
MySQLi Extension (or simply known as MySQL improved or MySQLi) is a relational database driver that is used mainly in the PHP programming language.
So we have 2 ways to set up
- Degrade your PHP version to 5.xx
- Change the code of original Dhakkan lab to make it work with latest kali.
We’ll change the code of labs.
Q- How I came to know that this is the issue?
Ans – When I set up my lab and browse it from my browser I saw I was unable to set up database required, See below screenshot
In the above screenshot see the URL.So now I know something is wrong in setup-db.php so I tried to run this specific file in my kali, see screenshot
So after googling the error, I came to know I have to replace mysql_connect() with mysqli_connect()
After making this change when I run setup.php again I came across a new error, see screenshot
So I replace mysql_query($sql) with mysqli_query($con, $sql)
($con is the connection link we made to our database) if you don’t know php don’t worry simply replace mysql_query($sql) with mysqli_query($con, $sql)
So this is how I debug the issue.
Now I am summarizing the changes that I made and you have to do to set up your lab.
Simply use Ctrl+F and replace all feature to make changes at a fast pace.
You have to make changes in index.php of ALL lessons, other php files in lessons and in all php files present in sql-connections Folder.
(Or you can contact me to get the edited lab)
|7||mysql_select_db($dbname, $con)||mysqli_select_db($con, $dbname)|
After making the above changes copy complete sqli-labs folder in /var/www/html folder of kali
Now open kali terminal and move to this folder using command “cd /var/www/html”
Now give permissions to the sqlilabs folder using the command “chmod 777 sqlilabs”
Now move to the sqlilabs folder using the command “cd sqlilabs” And give permissions to all files and folder in it using the command “chmod 777 *”
Now your lab is ready to use you can access your lab using your browser Ip of your kali machine/sqlilabs
Before accessing lab from your browser make sure to run these three commands
in your kali machine
1 – service apache2 start
2 – service mysql stop
3 – mysqld_safe –skip-grant-tables
Click on Setup/reset Database for labs
Database set now practice and enjoy and use your skill to help organizations in securing their apps and applications from hackers. Don’t test it on sites for which you don’t have written permission to do so. It is illegal you may end up going behind the bars and ruin your career.
We are very thankful to Audi-1(aka Dhakkan) for creating such an interesting and awesome environment for us to understand and practice SQL injection.
Author – Rinkish Khera is a Web Application security consultant who loves competitive coding, hacking and learning new things about technology. Contact Here