DVWA PENTESTING LAB Part 1
DVWA PENTESTING LAB Part 1
OBJECTIVES:
Understanding how some top 10 OWASP's Web attacks work and can be used on a
vulnerable Web application.
3- To be serious ;)
===========================================================
1. Run the Kali Linux VM. Ensure that the VM is connected using NAT network
2. Log into Kali Linux with the user account you created during install process
3. Check network connectivity (ex. ping www.google.com). The host OS must be connected
to a physical network (ex. WiFi)
4. On the Terminal, note the IP address assigned to your Kali Linux's OS (ifconfig command)
1
(you'll see that the service is in "running" state)
6. On your host OS (Windows), open the Terminal (cmd, Windows Terminal, or any SSH
client), then connect to your Kali Linux using the "ssh" command (you'll need the IP address
and the username of you Kali of course)
(if a long boring message appears that ends with YES|NO, type "yes", then type your Kali
username's password)
7. From now on, you'll use the SSH session from your Windows (Say thanks!)
8. On the SSH terminal, ensure that the Apache Server is installed and running (and please,
don't copy the $ symbol):
$ sudo -s
10. On the SSH terminal, move to the directory /var/www/html (please don't copy the #
symbol)
# cd /var/www/html
# wget https://github.com/digininja/DVWA/archive/master.zip
# uzip master.zip
# mv master.zip /root
14. The extracted archive will contain a Directory named "DVWA-master". Move into it:
# cd DVWA-master
# mv config.inc.php.dist config.inc.php
16. Using your favorite text editor (my favorite is vim, but not recommanded for you... sorry
not sorry! use nano instead), open the "config.inc.php" file:
# nano config.inc.php
17. Edit the “db_user” and “db_password” variables as shown in the following image:
2
Then save the file with CTRL+O, then ENTER, then CTRL+X to exit the file. Finally, exit the
“root” account with CTRL+D or with “exit” command.
$ netstat -tulpn (you should see a listening service on the 80 port number)
$ netstat -tulpn (you should see a listening service on the 3306 port number)
19. We need to connect to the “Mariadb” server in order to create the database needed by
the DVWA application. However, the Mariadb root’s password isn’t known. So we need to
reset it (it’s a bit tricky, so we won’t reset it. Instead, we will reinstall mariadb):
Check if there’s still any processes of mariadb running or listening on 3306 port
number:
$ ps ax | grep mariadb
If found, KILL’EM ALL
$ kill -9 pid (pid is the process id returned by the previous ps ax command)
THIS IS SPARTA! WAHOU!
$ netstat -tulpn | grep 3306
(at this level, you should find nothing. Otherwise, do what any newbie does: reboot)
3
Then, we will run the mysql_secure_installation script (check Y or N for every
question like in the following images):
At this step, you need to set mariadb’s root’s password (use root123* as a password):
4
Now, we’re all set! Let’s try to connect to our mariadb server:
$ sudo systemctl status mariadb (check if it’s running, else start it)
$ mysql -u root -p (press ENTER then type the password and pray)
20. Now, we will start our application. Open the WEB browser and type in the address bar:
http://127.0.0.1/DVWA-master
21. Log into the application. The default username is “admin” and password is “password”
5
22. The next page will show some problem to fix regarding the application and the database.
23. Next, we will set some permissions on the paths (you might have different paths from
the image) as shown in the previous image. As root:
# chmod 777
/var/www/html/DVWA-master/external/phpids/0.6/lib/IDS/tmp/phpids_log.txt
24. Next, we will edit the php.ini file located in /etc/php/[VERSION]/apache2 directory (in
my case, I have the 8.1 version of PHP)
# nano /etc/php/8.1/apache2/php.ini
allow_url_fopen = On
allow_url_include = On
25. Refresh the WEB page and notice that the paths we changed their permissions that
showed “No” in red are now “Yes” in Green
26. Restart the Apache Web service then refresh the Web page again:
27. Finally, click on create/reset database button. And we’re all set