x32x01

ADMINISTRATOR
Why we need a vulnerable web server?
Attacking on a website or server in internet without legal permission will considered as crime. Practice makes perfect, but where to practice our hacking skills ?
A simple answer is on our localhost. Localhost is a locally hosted web server it can be hosted on our PC and not connected to the internet.

There is a famous quote "There is no place like 127.0.0.1". This 127.0.0.1 is our home server or local server. This is an awesome place to learn and practice our skills. That's why it is the best place. No place can better then localhost.

How to set up ?
Setting up a vulnerable server is very easy. Now we set up DVWA in our Kali Linux machine.

DVWA stands for Damn Vulnerable Web Application. Oh yes, it is too vulnerable. In this web application security researchers, penetration testers or ethical hackers test their skills and run tools in a legal environment.

PicsArt_01-23-09.34.12.jpg

DVWA is designed for practice some most common web vulnerability. It is made with PHP and mySQL. Let's start without wasting time.

In Linux environment localhost files are stored in /var/www/html directory, so we open a terminal and change our directory to that directory using following command:
Code:
cd /var/www/html

Here we clone DVWA from it's Github repository. To clone it we run following command:
Code:
git clone https://github.com/digininja/DVWA

Screenshot_2020-01-22_19-26-33.png

After the cloning complete, we rename the DVWA to dvwa (it is not necessary but it will save our effort).
Code:
mv DVWA dvwa

Then we change the permission on dvwa directory by using following command:
Code:
chmod -R 777 dvwa/

Screenshot_2020-01-22_19-31-24.png

Now we have to setup this web application to run properly for that we have to go into /dvwa/config directory.
Code:
cd dvwa/config

Using ls command we can the list of files.
Code:
ls

Screenshot_2020-01-22_19-37-47.png

In the above screenshot we can see the config.inc.php.dist file. This file contains default configuration. We need to make a copy of this file with .php extension name, we are coping this file because in future if anything goes wrong then we have the default values. So we copy this file with .php extension name using following command:
Code:
cp config.inc.php.dist config.inc.php

Then we check the copied file using ls command:
Code:
ls

Screenshot_2020-01-22_19-38-35.png

Then we use nano editor to make changes on our newly created PHP file.
Code:
nano config.inc.php

The screenshot is following:

Screenshot_2020-01-22_19-40-41.png

We will make changes in this part the [email protected] to pass and the user from root. Watch the following screenshot:

Screenshot_2020-01-22_19-51-14.png

Then we save it using CTRL+X and press Y to save changes and Enter button to save and exit.

The next is configuring the database.

Here we have opened a new terminal window closing the previous one. We start the mysql at first using following command:
Code:
service mysql start

If there are no errors that means the service is started.

Now let's login to mysql using following command:
Code:
mysql -u root -p

Here in our Kali Linux root is our superuser name, if we have something else then we need to change that user.

In the password field we press Enter without typing password; because we didn't set any password for it, now mysql will open like following screenshot:

Screenshot_2020-01-22_22-04-23.png

Now to setup a database, we start with creating a new user by applying following command:-
Code:
create user 'user'@'127.0.0.1' identified by 'pass';

Here using this command we are creating a user called 'user' running server on 127.0.0.1(localhost) and the password is 'pass'. Remember that this username and password should exactly same as the password and username we have entered in the configuration file of dvwa web application.

Screenshot_2020-01-23_05-58-03.png

In the screenshot we can see the query is OK. That means the user is created.

Then we grant this user all the privileges over the database. For that we type following command:
Code:
grant all privileges on dvwa.* to 'user'@'127.0.0.1' identified by 'pass';


Screenshot_2020-01-23_06-04-44.png

Yes, we have finished the work of database, now we configure the server. For this we need to configure our apache2 server. Let's change our directory to /etc/php/7.3/apache2

Here we are using version 7.3, if we use another version then the path might be change.
Code:
cd /etc/php/7.3/apache2

Here we configure the php.ini file using leafpad of any good text editor. We have used mousepad editor.
Code:
mousepad php.ini

We need to change the allow_url_fopen and allow_url_include values. We set both of them 'On'. In some cases when we are first time configuring it, we might find that one of this or both of this configuration is set to 'Off'. We have turned both of these configuration to 'On', as the following screenshot:

Screenshot_2020-01-23_06-20-35.png

Then we save and close the file.

Then we start the apache2 server using following command:
Code:
service apache2 start

Let's open the browser and navigate to 127.0.0.1/dvwa/ first open will open the setup.php as shown in the screenshot.

Screenshot_2020-01-23_06-24-19.jpg

Here we scroll down and click on "Create/Reset Database".

Screenshot_2020-01-23_06-26-13.png

Then it will create and configure the database and we redirected to DVWA login page.

Screenshot_2020-01-23_06-28-01.jpg

The default login is
  • Username:- admin
  • Password:- password
After login we are in Damn Vulnerable Web Applications main page. Here is some general information and warnings.

Screenshot_2020-01-23_07-04-34.jpg

On the left side we can see lots of vulnerable pages are available we can practice here.

DVWA have different security levels to change those we navigate to DVWA security. There are some security levels low, medium, high, impossible. We can choose difficulty as we need.

Screenshot_2020-01-23_07-10-37.jpg

Now we can run penetration testing tools and techniques in our localhost.

This is how we can setup DVWA, Damn Vulnerable Web Application in our Kali Linux system. This is very helpful for beginners to advanced users, because of it multilayered security levels.

Tell us which kind of vulnerability you should try at first ?
For any problem feel free to comment below, follow us on Twitter for more updates and Kali Linux tutorials
 
Top