$ cat /etc/issue
Ubuntu 18.04.2 LTS \n \l
$ uname -a
Linux R 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ dpkg -l | grep php
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install php5.6
$ php -v
PHP 5.6.40-5+ubuntu18.04.1+deb.sury.org+1 (cli)
$ sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml
$ sudo service apache2 restart
sudo apt install apache2
sudo a2enmod php5.6
$ cd /var/www/html/
$ sudo wget https://github.com/ethicalhack3r/DVWA/archive/master.zip
$ sudo unzip master.zip
$ sudo mv DVWA-master/ dvwa
$ pwd
/var/www/html/dvwa/config
$ sudo cp config.inc.php.dist config.inc.php
$ pwd
/etc/php/5.6/apache2
$ sudo vim php.ini
#allow_url_include = Off
allow_url_include = On
$ sudo service apache2 restart
$ pwd
/var/www/html/dvwa/config
sudo vim config.inc.php
$_DVWA[ 'db_server' ] = '127.0.0.1';
$_DVWA[ 'db_database' ] = 'dvwa';
$_DVWA[ 'db_user' ] = 'root';
$_DVWA[ 'db_password' ] = '';
申请免费域名
免费域名申请网站
使用reCaptcha
https://www.google.com/recaptcha/admin
$ sudo apt-get install -y php5.6-gd
$ sudo service apache2 restart
$ sudo chgrp www-data hackable/uploads/
$ sudo chgrp www-data /var/www/html/dvwa/external/phpids/0.6/lib/IDS/tmp/phpids_log.txt
$ sudo chgrp www-data config/
$ sudo service apache2 restart
$ sudo chmod g+w hackable/uploads/
$ sudo chmod g+w /var/www/html/dvwa/external/phpids/0.6/lib/IDS/tmp/phpids_log.txt
$ sudo chmod g+w config/
$ sudo apt-get install mysql-server
$ sudo vim /etc/mysql/debian.cnf
[client]
host = localhost
user = root
password = root
$ sudo mysql -u root -p
mysql> show databases;
mysql> create database dvwa;
$ pwd
/var/www/html/dvwa/config
$ sudo vim config.inc.php
$_DVWA[ 'db_server' ] = '127.0.0.1';
$_DVWA[ 'db_database' ] = 'dvwa';
$_DVWA[ 'db_user' ] = 'dvwa';
$_DVWA[ 'db_password' ] = 'dvwa1234';
$ pwd
/var/www/html/dvwa
$ sudo vim info.php
<?php phpinfo(); ?>
$ sudo mysql -u root -p.root
mysql> create user 'dvwa'@'localhost' identified 'dvwa1234';
mysql> grant all on dvwa.* to 'dvwa'@'localhost';
$ sudo service apache2 restart
$ sudo service mysql restart
$ mysql -u dvwa -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| dvwa |
+--------------------+
2 rows in set (0.00 sec)
mysql> use dvwa;
mysql> show tables;
+----------------+
| Tables_in_dvwa |
+----------------+
| guestbook |
| users |
+----------------+
2 rows in set (0.00 sec)
mysql> select * from users;
+---------+------------+-----------+---------+----------------------------------+
| user_id | first_name | last_name | user | password |
+---------+------------+-----------+---------+----------------------------------+
| 1 | admin | admin | admin | 5f4dcc3b5aa765d61d8327deb882cf99 |
mysql> update users set password = md5('admin') where user_id = 1 ;
mysql> select * from users;
+---------+------------+-----------+---------+----------------------------------+
| user_id | first_name | last_name | user | password |
+---------+------------+-----------+---------+----------------------------------+
| 1 | admin | admin | admin | 21232f297a57a5a743894a0e4a801fc3 |
在线MD5值解密
# pwd
/etc/apache2/sites-available
# vim 000-default.conf
#DocumentRoot /var/www/html
DocumentRoot /var/www/html/dvwa
[dvwa]
type = tcp
local_ip = 127.0.0.1
local_port = 80
remote_port = 80
参考: