DVWA(Damn Vulnerable Web Application)是一個用來進行安全脆弱性鑑定的PHP/MySQL Web應用,旨在爲安全專業人員測試本身的專業技能和工具提供合法的環境,幫助web開發者更好的理解web應用安全防範的過程。DVWA代碼分爲四種安全級別:Low,Medium,High,Impossible,經過比較不一樣級別的代碼,學習如何提升代碼審計。php
環境:Docker(17.04.0-ce)、鏡像Ubuntu(16.04.3)html
1.安裝mysql、apache二、phpmysql
root@22072ee3c9ac:~# apt-get update root@22072ee3c9ac:~# apt-get install -y mysql-server apache2 php
2.php啓用mysql支持,apache2啓用php支持git
root@22072ee3c9ac:~# apt-get install -y php-mysql libapache2-mod-php
3.啓動apache2和mysql服務github
root@22072ee3c9ac:~# /etc/init.d/mysql start
root@22072ee3c9ac:~# /etc/init.d/apache2 start
1.下載DVWA程序包web
root@22072ee3c9ac:~# wget https://github.com/ethicalhack3r/DVWA/archive/master.zip root@22072ee3c9ac:~# unzip master.zip -d /var/www/html/
2.安裝php圖像處理模塊gdsql
root@22072ee3c9ac:~# apt-get install -y php-gd
3.php啓用allow_ur_include數據庫
root@22072ee3c9ac:~# vim /etc/php/7.0/apache2/php.ini allow_url_include = On root@22072ee3c9ac:~# /etc/init.d/apache2 restart
4.配置config.inc.php,修改數據庫passwordapache
root@22072ee3c9ac:~# cp /var/www/html/DVWA-master/config/config.inc.php.dist /var/www/html/DVWA-master/config/config.inc.php root@22072ee3c9ac:~# vim /var/www/html/DVWA-master/config/config.inc.php $_DVWA[ 'db_server' ] = '127.0.0.1'; $_DVWA[ 'db_database' ] = 'dvwa'; $_DVWA[ 'db_user' ] = 'root'; $_DVWA[ 'db_password' ] = 'p@ssw0rd';
5.增長目錄config和uploads文件phpids_log.txt可寫權限vim
root@22072ee3c9ac:~# chmod 777 /var/www/html/DVWA-master/config/ root@22072ee3c9ac:~# chmod 777 /var/www/html/DVWA-master/hackable/uploads/ root@22072ee3c9ac:~# chmod 777 /var/www/html/DVWA-master/external/phpids/0.6/lib/IDS/tmp/phpids_log.txt
6.安裝DVWA
訪問http://172.17.0.2/DVWA-master/setup.php,點擊頁面底部"Create/Reset Database"建立數據庫
訪問http://172.17.0.2/DVWA-master/login.php,用戶名(admin)密碼(password)
1.申請reCAPTCHA服務
訪問https://www.google.com/recaptcha/
2.配置confi.inc.php,修改祕鑰
root@22072ee3c9ac:~# vim /var/www/html/DVWA-master/config/config.inc.php $_DVWA[ 'recaptcha_public_key' ] = ''; $_DVWA[ 'recaptcha_private_key' ] = '';
3.驗證是否生效
訪問http://172.17.0.2/DVWA-master/setup.php,reCAPTCHA key變爲綠色
訪問http://172.17.0.2/DVWA-master/vulnerabilities/captcha/,驗證碼顯示正常