How to deploy DVWA with Termux and attack it with PentestSuite?

Have you ever thought of practicing your web security pentesting skills by directly attack your Android phone? In this article, I am going to show you how to do this. 

Basic concept

We are going to deploy DVWA(Damn Vulnerable Web Application) on Android phone by directly using Termux. After that, we will use PentestSuite to attack this DVWA.

Deploy DVWA

Step 1: Download and install Termux

Directly download it through https://termux.com/ and install it into your Android device.

Step 2: Install Apache2 and php

Open Termux and enter the following command to install apache2, php-apache, wget and vim:

pkg upgrade # Upgrade the software in Termux

pkg install apache2 php-apache vim wget

Step 3: Configure apache2 to parse php

First use vi to edit the apache2 configuration file:

vim /data/data/com.termux/files/usr/etc/apache2/httpd.conf

Next add the following text:

LoadModule php_module /data/data/com.termux/files/usr/libexec/apache2/libphp.so

<FilesMatch \.php$>

    SetHandler application/x-httpd-php

</FilesMatch>

<IfModule dir_module>

    DirectoryIndex index.php index.html

</IfModule>

KeepAlive On

KeepAliveTimeout 30

And comment the following text:

LoadModule mpm_worker_module libexec/apache2/mod_mpm_worker.so

Then uncomment the following text:

LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so

Step 4: Go to the apache2 doc directory and download the DVWA

Enter the following command:

cd /data/data/com.termux/files/usr/share/apache2/default-site/htdocs/

wget https://github.com/digininja/DVWA/archive/master.zip

unzip master.zip

Step 5: Configure DVWA and database

Edit the DVWA configuration file

vim DVWA-master/config/config.inc.php.dist

Knowing that we should, by default, provide a database server listening on 127.0.0.1:3306 and the database name and username is 'dvwa' with the password set to 'p@ssw0rd'

Now exit edit and rename this file to config.inc.php

mv DVWA-master/config/config.inc.php.dist DVWA-master/config/config.inc.php

Install, setup and start MariaDB

Install

pkg install mariadb

Start

mysqld

Create database

create database dvwa;

Create user

create user dvwa@localhost identified by 'p@ssw0rd';

Grant privileges

grant all privileges on dvwa.* to dvwa@localhost; 

Refresh privileges

flush privileges;

Step 6: Start apache2 server

The following single command will make your apache2 start.

apachectl

Step 7: Access DVWA and setup first

Use browser in your Android device to access this URL:

http://127.0.0.1:8080/DVWA-master/setup.php

And click Create/Reset Database

After that, follow the direction of DVWA and login with credentials: admin/password

Attack DVWA with PentestSuite

Detailed introduction about how to attack DVWA will be described in other articles. 

Attack DVWA weak session IDs

Attack DVWA XSS(reflected)

More attacks will be showed here in future<3

Version information

DVWA v1.10

Termux - V0.113

mysqld V10.5.8-MariaDB for Android on aarch64 (MariaDB server)

mysql Ver 15.1 Distrib  10.5.8-MariaDB, for Android(aarch 64)

PHP 8.0.6 (cli) (built: May 6 2021 13:27:53) (NTS)

Apache 2.4.46(Unix)

Comments