{"id":9653,"date":"2021-07-12T22:03:26","date_gmt":"2021-07-12T19:03:26","guid":{"rendered":"https:\/\/kifarunix.com\/?p=9653"},"modified":"2024-03-18T19:38:59","modified_gmt":"2024-03-18T16:38:59","slug":"install-and-setup-dvwa-on-rocky-linux-8","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-and-setup-dvwa-on-rocky-linux-8\/","title":{"rendered":"Install and Setup DVWA on Rocky Linux 8"},"content":{"rendered":"\n<p>If you want to play around with&nbsp;<a href=\"http:\/\/www.dvwa.co.uk\/\" target=\"_blank\" rel=\"noreferrer noopener\">Damn Vulnerable Web Application<\/a>, then follow through this guide to learn how to install and setup DVWA on Rocky Linux 8 as a legal environment to run your web application security tests.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing DVWA on Rocky Linux 8<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Install LAMP Stack on Rocky Linux 8<\/h3>\n\n\n\n<p>One of the major requirements for setting up DVWA lab is to have LAMP Stack up and running. Follow the guides below to learn how to install LAMP stack on Rocky Linux 8.<\/p>\n\n\n\n<p>Note that we use PHP 7.4.<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/install-lamp-stack-on-rocky-linux-8\/\" target=\"_blank\">Install LAMP Stack with MariaDB 10 on Rocky Linux 8<\/a><\/p>\n\n\n\n<p>Install additional PHP modules and other packages;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install php-gd git vim<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Create DVWA Database and Database User<\/h3>\n\n\n\n<p>Once the LAMP stack installation is done, proceed to create MariaDB DVWA database and database user.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql -u root -p<\/code><\/pre>\n\n\n\n<p>Create DVWA database. Replace the database name accordingly.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>create database dvwa;<\/code><\/pre>\n\n\n\n<p>Create DVWA database user and grant all privileges. Replace the database user accordingly.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>grant all on dvwa.* to <strong>dvwauser<\/strong>@localhost identified by '<strong>Str0nGp@ssword<\/strong>';<\/code><\/pre>\n\n\n\n<p>Reload the privileges table and exit the database.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>flush privileges;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>quit<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install DVWA on Rocky Linux 8<\/h3>\n\n\n\n<p>Clone the latest version of the DVWA&nbsp;to Apache default web root directory, <strong><code>\/var\/www\/html<\/code><\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>git clone https:\/\/github.com\/digininja\/DVWA.git \/var\/www\/html\/<\/code><\/pre>\n\n\n\n<p>Check the contents of&nbsp;<code>\/var\/www\/html\/<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ls -1 \/var\/www\/html\/<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>about.php\nCHANGELOG.md\nconfig\nCOPYING.txt\ndocs\ndvwa\nexternal\nfavicon.ico\nhackable\nids_log.php\nindex.php\ninstructions.php\nlogin.php\nlogout.php\nphpinfo.php\nphp.ini\nREADME.md\nREADME.zh.md\nrobots.txt\nsecurity.php\nsetup.php\ntests\nvulnerabilities\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configure DVWA on Rocky Linux 8<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Setup DVWA Database Connection<\/h4>\n\n\n\n<p>Begin by renaming the sample configuration file&nbsp;<strong><code>\/var\/www\/html\/config\/config.inc.php.dist<\/code><\/strong>&nbsp;to&nbsp;<strong><code>\/var\/www\/html\/config\/config.inc.php<\/code><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cp \/var\/www\/html\/config\/config.inc.php{.dist,}<\/code><\/pre>\n\n\n\n<p>Next, edit the configuration file,&nbsp;<strong><code>\/var\/www\/html\/config\/config.inc.php<\/code><\/strong>&nbsp;and set the database connection details.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/var\/www\/html\/config\/config.inc.php<\/code><\/pre>\n\n\n\n<p>Replace the database and database user and the password accordingly.<\/p>\n\n\n\n&#8230;\n<pre class=\"scroll-box\"><code># Database variables\n...\n<srong>$_DVWA = array();\n$_DVWA[ 'db_server' ]   = '127.0.0.1';\n$_DVWA[ 'db_database' ] = 'dvwa';\n$_DVWA[ 'db_user' ]     = 'dvwauser';\n$_DVWA[ 'db_password' ] = 'Str0nGp@ssword';\n<\/srong><\/code><\/pre>\n&#8230;\n\n\n\n<h4 class=\"wp-block-heading\">Install reCAPTCHA keys<\/h4>\n\n\n\n<p>Generate recapture values from&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.google.com\/recaptcha\/admin\" target=\"_blank\">Google service<\/a>.<\/p>\n\n\n\n<p>Once generated, simply copy and paste the&nbsp;<strong>site key<\/strong>&nbsp;and&nbsp;<strong>site secret key<\/strong>&nbsp;to&nbsp;<strong><code>$_DVWA[ 'recaptcha_public_key' ]<\/code><\/strong>&nbsp;and&nbsp;<code><strong>$_DVWA[ 'recaptcha_private_key' ]<\/strong><\/code>&nbsp;respectively.<\/p>\n\n\n\n&#8230;\n<pre class=\"scroll-box\"><code># 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<strong>$_DVWA[ 'recaptcha_public_key' ]  = '6Lc4BsMUAAAAAKs72dKl4ZTVsA8giXiN7yqQcoVz';\n$_DVWA[ 'recaptcha_private_key' ] = '6Lc4BsMUAAAAAI9v0sd_xvlh_PMXTcgtqRYJ6VEd';<\/strong>\n<\/code><\/pre>\n&#8230;\n\n\n\n<p>Save and exit the configuration file.<\/p>\n\n\n\n<p>Restart MariaDB<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart mariadb<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configure PHP<\/h3>\n\n\n\n<p>The version PHP installed in our case here is 7.4.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>php -v<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>PHP 7.4.6 (cli) (built: May 12 2020 08:09:15) ( NTS )\nCopyright (c) The PHP Group\nZend Engine v3.4.0, Copyright (c) Zend Technologies\n    with Zend OPcache v7.4.6, Copyright (c), by Zend Technologies<\/code><\/pre>\n\n\n\n<p>Proceed to edit&nbsp;<strong><code><strong>\/etc\/php.ini<\/strong><\/code><\/strong>&nbsp;and make the following changes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/php.ini<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>allow_url_include = On<\/code>&nbsp;\u2013 Allows for Remote File Inclusions (RFI)<\/li>\n\n\n\n<li><code>allow_url_fopen = On<\/code>&nbsp;\u2013 Allows for Remote File Inclusions (RFI)<\/li>\n\n\n\n<li><code>display_errors = Off<\/code>&nbsp;\u2013 (Optional) Hides PHP warning messages to make it less verbose<\/li>\n<\/ul>\n\n\n\n<p>Save and quit the PHP configuration file<\/p>\n\n\n\n<p>Set the ownership of the DVWA web root directory to Web server user.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>chown -R apache: \/var\/www\/html<\/code><\/pre>\n\n\n\n<p>Restart Apache and MariaDB<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart httpd mariadb<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Configure SELinux<\/h4>\n\n\n\n<p>You might experience that the apache web server user might not be allowed to write <code>\/var\/www\/html\/external\/phpids\/0.6\/lib\/IDS\/tmp\/phpids_log.txt<\/code>&nbsp;as well as on the directory,&nbsp;<code>\/var\/www\/html\/config<\/code>. <\/p>\n\n\n\n<p>Such errors as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>[User: apache] Writable file \/var\/www\/html\/external\/phpids\/0.6\/lib\/IDS\/tmp\/phpids_log.txt: No<\/li>\n\n\n\n<li>[User: apache] Writable folder \/var\/www\/html\/config: No<\/li>\n<\/ul>\n\n\n\n<p>To fix this, we simply set SELinux to permissive.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>setenforce 0<\/code><\/pre>\n\n\n\n<p>sed -i &#8216;s\/=enforcing\/=permissive\/&#8217; \/etc\/selinux\/config<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Complete DVWA Setup from Browser<\/h3>\n\n\n\n<p>Navigate to the web browser and access your DVWA using the address,&nbsp;<strong><code>http:\/\/server-IP<\/code><\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"982\" height=\"952\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/dvwa-1.png\" alt=\"\" class=\"wp-image-9660\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/dvwa-1.png?v=1626116599 982w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/dvwa-1-768x745.png?v=1626116599 768w\" sizes=\"(max-width: 982px) 100vw, 982px\" \/><\/figure><\/div>\n\n\n<p>On the status check page, ensure that you fix any check whose status is red.<\/p>\n\n\n\n<p>Next, click&nbsp;<strong>Create\/Reset Database<\/strong>&nbsp;at the bottom to setup the DVWA database. If the database already exists, it will be reset.<\/p>\n\n\n\n<p>After that, you are then taken to the Login screen.<\/p>\n\n\n\n<p>Login using the default credentials:&nbsp;<strong>admin:password<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1068\" height=\"428\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/dvwa-login.png\" alt=\"\" class=\"wp-image-9655\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/dvwa-login.png?v=1626115669 1068w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/dvwa-login-768x308.png?v=1626115669 768w\" sizes=\"(max-width: 1068px) 100vw, 1068px\" \/><\/figure>\n\n\n\n<p>You should now land on DVWA welcome page.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1109\" height=\"950\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/dvwa-dashboard.png\" alt=\"\" class=\"wp-image-9654\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/dvwa-dashboard.png?v=1626115639 1109w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/dvwa-dashboard-768x658.png?v=1626115639 768w\" sizes=\"(max-width: 1109px) 100vw, 1109px\" \/><\/figure>\n\n\n\n<p>There you go. That is it on how to setup DVWA on Rocky Linux 8. You can now run web application security testings as you wish. Enjoy.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Other Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/detecting-malicious-files-with-wazuh-and-virustotal\/\" target=\"_blank\" rel=\"noreferrer noopener\">Detecting Malicious Files with Wazuh and VirusTotal<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-install-and-use-nikto-web-scanner-on-ubuntu-18-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Use Nikto Web Scanner on Ubuntu 18.04<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-and-setup-nessus-scanner-on-ubuntu-20-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Setup Nessus Scanner on Ubuntu 20.04<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to play around with&nbsp;Damn Vulnerable Web Application, then follow through this guide to learn how to install and setup DVWA on Rocky<\/p>\n","protected":false},"author":1,"featured_media":9658,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[34,121],"tags":[222,3833,3834,3587],"class_list":["post-9653","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security","category-howtos","tag-dvwa","tag-dvwa-rocky-linux","tag-install-dvwa-rocky-linux","tag-rocky-linux-8","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/9653"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=9653"}],"version-history":[{"count":5,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/9653\/revisions"}],"predecessor-version":[{"id":21732,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/9653\/revisions\/21732"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/9658"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=9653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=9653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=9653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}