This post present how to install Damn Vulnerable Web Application (DVWA) application on BackTrack 5 R3 distribution. In order to automate the install I used to script from installDVWA.sh – Script to Download, Configure, and launch Damn Vulnerable Web App on Backtrack 5. The problem with this script is that it was written to install the version 1.0.7 of DVWA and it doesn’t work for a new version of DVWA.
So, here are the modification that I’ve made to the initial script in order to make it run again:
- Get the application from github by replacing the line
wget http://voxel.dl.sourceforge.net/project/dvwa/DVWA-1.0.7.zip
with (the source forge proxy was not available, so get the zip directly from github)
wget https://github.com/RandomStorm/DVWA/archive/v1.0.8.zip
- Changed the name of the zip file retrieved from github.
mv /tmp/v1.0.8.zip /tmp/DVWA-1.0.8.zip
- The zip will be expanded in the /tmp/DVWA-1.0.8 folder; rename this folder to dvwa after the line unzip DVWA-1.0.8.zip > /dev/null :
mv /tmp/DVWA-1.0.8 /tmp/dvwa
Now if you launch the script the following error will be print:
[*] Updating Database...ERROR 1146 (42S02) at line 1: Table 'dvwa.users' doesn't exist ERROR 1146 (42S02) at line 1: Table 'dvwa.users' doesn't exist ERROR 1146 (42S02) at line 1: Table 'dvwa.users' doesn't exist ERROR 1146 (42S02) at line 1: Table 'dvwa.users' doesn't exist ERROR 1146 (42S02) at line 1: Table 'dvwa.users' doesn't exist
This is due to fact that the PHP server tries to connect to the mysql db using the root account and the password ‘[email protected]’. Now, you have 2 choices, either modify the DVWA config.inc.php file (and replace the password for the root user) or you modify the password of the mysql root user on your server.
- Modify the password of mysql root account. In a console, as root tie the following command:
mysqladmin -u root -p'toor' password [email protected]
- Modify the password of the mysql root account in the script; replace ‘toor’ by ‘[email protected]’.
This is the diff between the original script and my own version:
19c19 < wget http://voxel.dl.sourceforge.net/project/dvwa/DVWA-1.0.7.zip --- > wget https://github.com/RandomStorm/DVWA/archive/v1.0.8.zip 21a22 > mv /tmp/v1.0.8.zip /tmp/DVWA-1.0.8.zip 23c24 < unzip DVWA-1.0.7.zip > /dev/null --- > unzip DVWA-1.0.8.zip > /dev/null 25a27,28 > mv /tmp/DVWA-1.0.8 /tmp/dvwa > 27c30 < rm DVWA-1.0.7.zip > /dev/null --- > rm DVWA-1.0.8.zip > /dev/null 64,68c67,71 < mysql -u root --password='toor' -e 'update dvwa.users set avatar = "/hackable/users/gordonb.jpg" where user = "gordonb";' < mysql -u root --password='toor' -e 'update dvwa.users set avatar = "/hackable/users/smithy.jpg" where user = "smithy";' < mysql -u root --password='toor' -e 'update dvwa.users set avatar = "/hackable/users/admin.jpg" where user = "admin";' < mysql -u root --password='toor' -e 'update dvwa.users set avatar = "/hackable/users/pablo.jpg" where user = "pablo";' < mysql -u root --password='toor' -e 'update dvwa.users set avatar = "/hackable/users/1337.jpg" where user = "1337";' --- > mysql -u root --password='[email protected]' -e 'update dvwa.users set avatar = "/hackable/users/gordonb.jpg" where user = "gordonb";' > mysql -u root --password='[email protected]' -e 'update dvwa.users set avatar = "/hackable/users/smithy.jpg" where user = "smithy";' > mysql -u root --password='[email protected]' -e 'update dvwa.users set avatar = "/hackable/users/admin.jpg" where user = "admin";' > mysql -u root --password='[email protected]' -e 'update dvwa.users set avatar = "/hackable/users/pablo.jpg" where user = "pablo";' > mysql -u root --password='[email protected]' -e 'update dvwa.users set avatar = "/hackable/users/1337.jpg" where user = "1337";'