漏洞环境搭建

$ 漏洞环境搭建

配合徐焱《Web安全攻防:渗透测试实战指南》第二章

一、在linux系统中安装LANMP

二、在Windows系统中安装WAMP

​ 安装时缺少MSVCP110.dll和MSVCR110.dll,32位系统放在C:\Windows\SystemWOW64中,64位系统放在C:\Windows\System32中

三、搭建DVWA漏洞环境

  1. 保存并复制所有源码,粘贴在网站的根目录中

​ 将dvwa-master文件夹重命名为dvwa,复制到WAMP路径下,config文件夹下的config.inc.php.dist重命名为config.inc.php
2. reCAPTCHAP key: Missing

​ 编辑dvwa\config\config.inc.php

$_DVWA[ 'recaptcha_public_key' ] = ''
$_DVWA[ 'recaptcha_private_key' ] = ''

改为

$_DVWA[ 'recaptcha_public_key' ] = '6LdJJlUUAAAAAH1Q6cTpZRQ2Ah8VpyzhnffD0mBb'; 
$_DVWA[ 'recaptcha_private_key' ] = '6LdJJlUUAAAAAM2a3HrgzLczqdYp4g05EqDs-W4K';

参考文档:https://blog.csdn.net/RBPicsdn/article/details/80059132
3.

Could not connect to the MySQL service. Please check the config file.
Your database user is root, if you are using MariaDB, this will not work, please read the README.md file.

​ 在dvwa\config中config.inc.php,将$_DVWA[ 'db_password' ]改为“root”或为空
4. DVWA登录

​ 默认用户名/口令:admin/password

四、搭建SQL注入平台

  1. 打开浏览器访问127.0.0.1/sql1/

​ 应为127.0.0.1/sqli-labs/

五、搭建XSS测试平台

  1. 将压缩包解压缩,修改文件夹名为xss,复制到wamp64\www\目录下
  2. 在phpMyAdmin中,新建数据库xssplatform并导入xss中的xssplatform.sql
  3. 修改config.php
/*  9 */ $config['dbHost']   = 'localhost';   //数据库地址
/* 10 */ $config['dbUser']   = 'root';        //用户
/* 11 */ $config['dbPwd']    = '';            //密码
/* 12 */ $config['database'] = 'xssplatform'; //数据库名

/* 18 */ $config['register'] = 'normal';      

/* 22 */ $config['urlroot']  = 'http://127.0.0.1/xss';
  1. 在PHPMyAdmin中选择xssplatform,在SQL中执行查询
update oc_module set code=replace(code,'http://xsser.me','http://127.0.0.1/xss');
  1. 在\www\templates_c…register.html.php中第81行class的值改为“submit”
  2. 在\www\themes\default\templates\register.html中第69行class的值改为“submit”
  3. 登录网页http://127.0.0.1/xss ,注册
  4. 在phpMyAdmin中选择xssplatform选择oc_user,将adminLevel的值修改为1
  5. 修改config.php
/* 18 */ $config['register'] = 'invite';
  1. 在www\xss\中新建文件“.htaccess”,内容为
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^([0-9a-zA-Z]{6})$ index.php?do=code&urlKey=$1
RewriteRule ^do/auth/(\w+?)(/domain/([\w\.]+?))?$ index.php?do=do&auth=$1&domain=$3
RewriteRule ^register/(.*?)$ index.php?do=register&key=$1
RewriteRule ^register-validate/(.*?)$ index.php?do=register&act=validate&key=$1
RewriteRule ^login$ index.php?do=login
</IfModule>
  1. 登录之后,访问http://127.0.0.1/xss/index.php?do=user&act=invite ,生成邀请码,使用邀请码注册新用户
  2. 修改apache的httpd.conf文件,搜索“deny from”,将“allow from 127.0.0.1”改为“allow from all”;如果搜索不到,就搜索“include conf/extra/httpd-vhosts.conf”,去掉前面的#号,再搜索“Controls who can get stuff from this server”,将“Require local”/“Require all denies”修改为“Require all granted”

    参考文档:https://www.2cto.com/article/201308/239747.html

版权声明:本文为Acnorth原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。