How to upgrade Damn Vulnerable Web Application (DVWA) to the latest release in Samurai Web Testing Framework or Web Security Dojo (SOLVED)

Damn Vulnerable Web Application (DVWA) is pre-installed in Samurai Web Testing Framework and Web Security Dojo (ethical hacking sandboxes, pre-configured vulnerable targets). However, the release version is likely outdated.

To update DVWA to the latest release in Samurai Web Testing Framework

Create the upd_dvwa.sh file with the following contents:

#!/bin/bash  
 
sudo apt-get update
sudo apt-get install php5-gd -y
 
sudo sed -i 's/allow_url_include = Off/allow_url_include = On/' /etc/php5/apache2/php.ini
 
sudo service apache2 restart
 
cd /tmp
temp="$(curl -sL -A 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' https://github.com/ethicalhack3r/DVWA/releases)"
if [ $? -ne '0' ]; then
    exit 1
fi
 
wget 'https://github.com'`echo "${temp}" | grep -o -E '/ethicalhack3r/DVWA/archive/v[0-9.]{3,}[.]zip' | head -n 1`
unzip v*.zip
 
sudo rm -rf /usr/share/dvwa.old/
sudo mv /usr/share/dvwa/ /usr/share/dvwa.old/
sudo mkdir /usr/share/dvwa/
sudo mv DVWA*/* /usr/share/dvwa/
sudo mv /usr/share/dvwa.old/ssl.crt /usr/share/dvwa/ssl.crt
 
sudo chown -R www-data:www-data /usr/share/dvwa/
 
sudo rm -rf DVWA*
sudo rm v*.zip
 
sudo sed -i 's/p@ssw0rd/samurai/' /usr/share/dvwa/config/config.inc.php
 
cd

Run the script:

sudo bash upd_dvwa.sh

In DVWA go to the Setup / Reset DB page and perform a reset / rebuild of the database.

To update DVWA to the latest release in Web Security Dojo

Create the upd_dvwa.sh file with the following contents:

#!/bin/bash
   
sudo apt-get update
sudo apt-get install php-gd -y
   
sudo service apache2 restart
   
cd /tmp
temp="$(curl -sL -A 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' https://github.com/ethicalhack3r/DVWA/releases)"
if [ $? -ne '0' ]; then
    exit 1
fi
   
git clone https://github.com/ethicalhack3r/DVWA.git
 
sudo rm -rf /var/www/dvwa.old/
sudo mv /var/www/dvwa/ /var/www/dvwa.old/
sudo mkdir /var/www/dvwa/
sudo mv DVWA*/* /var/www/dvwa/
   
sudo chown -R www-data:www-data /var/www/dvwa/
   
sudo rm -rf DVWA*
 
sudo mv /var/www/dvwa/config/config.inc.php.dist /var/www/dvwa/config/config.inc.php
sudo sed -i 's/p@ssw0rd/dojo/' /var/www/dvwa/config/config.inc.php
  
cd

Run the script:

sudo bash upd_dvwa.sh

Go to http://localhost/dvwa/setup.php page to create / reset the database, click on the Create / Reset Database button.

To install DVWA in Kali Linux follow this guide.

Recommended for you:

Leave a Reply

Your email address will not be published. Required fields are marked *