{"id":4882,"date":"2020-01-04T22:38:32","date_gmt":"2020-01-04T19:38:32","guid":{"rendered":"https:\/\/kifarunix.com\/?p=4882"},"modified":"2024-03-13T07:48:08","modified_gmt":"2024-03-13T04:48:08","slug":"install-and-setup-dvwa-on-centos-8","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-and-setup-dvwa-on-centos-8\/","title":{"rendered":"Install and Setup DVWA on CentOS 8"},"content":{"rendered":"\n
In this guide, we are going to learn how to install and Setup DVWA on CentOS 8. As you already know, DVWA, an acronym for Damn Vulnerable Web Application<\/a> is a very vulnerable PHP\/MySQL web application designed to help security professionals, students, web application developers to test their security skills, learn web application security and understand web application security processes respectively.<\/p>\n\n\n\n To begin with, ensure that your system packages are up-to-date<\/p>\n\n\n\n Since DVWA is web application, you basically need to have a LAMP stack installed before setting DVWA. Follow the link below to learn how to install LAMP stack on CentOS 8.<\/p>\n\n\n\n How to Install LAMP Stack on CentOS 8<\/a><\/p>\n\n\n\n After you have installed LAMP stack, proceed to create DVWA database and database user.<\/p>\n\n\n\n Create DVWA database. You can use any database name.<\/p>\n\n\n\n Create DVWA database user with all the privileges assigned on the DVWA db. Again replace the user and the password accordingly.<\/p>\n\n\n\n Reload the privileges table and exit the database.<\/p>\n\n\n\n Install other required PHP-GD module.<\/p>\n\n\n\n PHP 7.2 is used in this demo.<\/p>\n\n\n\n Proceed to edit Save and quit the PHP configuration file<\/p>\n\n\n\n In this demo, we will install DVWA on the default Apache web root directory, the Therefore, clone the DVWA github repository to the web root directory.<\/p>\n\n\n\n To begin the configuration with, rename the sample configuration file Edit the configuration file, Generate recapture values from Google service<\/a>.<\/p>\n\n\n\n Once generated, simply copy and paste the site key<\/strong> and site secret key<\/strong> to Save and exit the configuration file.<\/p>\n\n\n\n Assign the ownership of the DVWA web configuration files to Apache.<\/p>\n\n\n\n Restart the database and Apache<\/p>\n\n\n\n If SELinux is running, apache user will be denied write access to the file, Allow HTTPD scripts and modules to connect to the network<\/p>\n\n\n\n Allow HTTPD scripts and modules to network connect to databases.<\/p>\n\n\n\n You can now access DVWA from your preferred browser to finalize the configuration setup. Use the address, On the setup page, ensure that no setting with status red. If any, ensure you fix the issue before proceeding.<\/p>\n\n\n\n Click Reset\/Database<\/strong> to configure DVWA database connection settings.<\/p>\n\n\n\n Since we already done this above, you will be redirected to the DVWA login interface if the DB connection details are correct.<\/p>\n\n\n\n Login using the default credentials; Username<\/strong>: DVWA default dashboard.<\/p>\n\n\n\n Damn Vulnerable Web Application<\/a><\/p>\n\n\n\n How to Install and Configure DVWA Lab on Ubuntu 18.04 server<\/a><\/p>\n\n\n\n Install and Setup DVWA on Debian 10<\/a><\/p>\n\n\n\n How to Install and Use Nikto Web Scanner on Ubuntu 18.04<\/a><\/p>\n\n\n\nInstalling DVWA on CentOS 8<\/h2>\n\n\n\n
Update system packages<\/h3>\n\n\n\n
dnf update<\/code><\/pre>\n\n\n\n
Install LAMP Stack on CentOS 8<\/h3>\n\n\n\n
Create DVWA Database and Database User<\/h3>\n\n\n\n
mysql -u root -p<\/code><\/pre>\n\n\n\n
create database dvwadb;<\/code><\/pre>\n\n\n\n
grant all on dvwadb.* to dvwamgr<\/strong>@localhost identified by 'mypassword<\/strong>';<\/code><\/pre>\n\n\n\n
flush privileges;<\/code><\/pre>\n\n\n\n
quit<\/code><\/pre>\n\n\n\n
Configure PHP for DVWA<\/h3>\n\n\n\n
dnf install php-gd<\/code><\/pre>\n\n\n\n
php -v<\/code><\/pre>\n\n\n\n
PHP 7.2.11 (cli) (built: Oct 9 2018 15:09:36) ( NTS )\nCopyright (c) 1997-2018 The PHP Group\nZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies<\/code><\/pre>\n\n\n\n
php.ini<\/strong><\/code><\/strong> and make the following changes.<\/p>\n\n\n\n
vim \/etc\/php.ini<\/code><\/pre>\n\n\n\n
\n
allow_url_fopen = On<\/code> \u2013 Allows for Remote File Inclusions (RFI)<\/li>\n\n\n\n
allow_url_include = On<\/code> \u2013 Allows for Remote File Inclusions (RFI)<\/li>\n\n\n\n
display_errors = Off<\/code> \u2013 (Optional) Hides PHP warning messages to make it less verbose<\/li>\n<\/ul>\n\n\n\n
Install DVWA on Debian 10<\/h3>\n\n\n\n
\/var\/www\/html<\/code><\/strong>.<\/p>\n\n\n\n
dnf install git<\/code><\/pre>\n\n\n\n
git clone https:\/\/github.com\/ethicalhack3r\/DVWA \/var\/www\/html\/<\/code><\/pre>\n\n\n\n
Configuring DVWA on CentOS 8<\/h3>\n\n\n\n
\/var\/www\/html\/config\/config.inc.php.dist<\/code><\/strong> to
\/var\/www\/html\/config\/config.inc.php<\/code><\/strong><\/p>\n\n\n\n
cp
\/var\/www\/html\/config\/config.inc.php{.dist<\/code>,}<\/code><\/pre>\n\n\n\n
\/var\/www\/html\/config\/config.inc.php<\/code><\/strong> and configure the database connection details.<\/p>\n\n\n\n
vim \/var\/www\/html\/config\/config.inc.php<\/code><\/pre>\n\n\n\n
...\n# Database variables\n# WARNING: The database specified under db_database WILL BE ENTIRELY DELETED during setup.\n# Please use a database dedicated to DVWA.\n#\n# If you are using MariaDB then you cannot use root, you must use create a dedicated DVWA user.\n# See README.md for more information on this.\n$_DVWA = array();\n$_DVWA[ 'db_server' ] = '127.0.0.1';\n$_DVWA[ 'db_database' ] = 'dvwadb';\n$_DVWA[ 'db_user' ] = 'dvwamgr';\n$_DVWA[ 'db_password' ] = 'mypassword';<\/strong>\n...<\/code><\/pre>\n\n\n\n
Install reCAPTCHA keys<\/h3>\n\n\n\n
$_DVWA[ 'recaptcha_public_key' ]<\/code><\/strong> and
$_DVWA[ 'recaptcha_private_key' ]<\/strong><\/code> respectively.<\/p>\n\n\n\n
...\n# ReCAPTCHA settings\n# Used for the 'Insecure CAPTCHA' module\n# You'll need to generate your own keys at: https:\/\/www.google.com\/recaptcha\/admin\n$_DVWA[ 'recaptcha_public_key' ] = '6LcWVswUAAAAAHPp-TlOuNcLcrw7iAWVhtOrDYFm<\/strong>';\n$_DVWA[ 'recaptcha_private_key' ] = '6LcWVswUAAAAABssYEu10VtWinRub6b_D8zn_sSL<\/strong>';\n...<\/code><\/pre>\n\n\n\n
chown -R apache:apache \/var\/www\/html<\/code><\/pre>\n\n\n\n
systemctl restart mariadb httpd<\/code><\/pre>\n\n\n\n
Configure SELinux<\/h3>\n\n\n\n
\/var\/www\/html\/external\/phpids\/0.6\/lib\/IDS\/tmp\/phpids_log.txt<\/code> as well as on the directory,
\/var\/www\/html\/config<\/code>. To fix this, simply execute the command below;<\/p>\n\n\n\n
setsebool -P httpd_unified 1<\/code><\/pre>\n\n\n\n
setsebool -P httpd_can_network_connect 1<\/code><\/pre>\n\n\n\n
setsebool -P httpd_can_network_connect_db 1<\/code><\/pre>\n\n\n\n
Finalize DVWA Setup on Browser<\/h3>\n\n\n\n
http:\/\/server-IP\/setup.php<\/code><\/strong><\/p>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
admin<\/code>, Password<\/strong>:
password<\/code>.<\/p>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
Reference<\/h4>\n\n\n\n
Related Tutorials<\/h4>\n\n\n\n