Web漏洞靶场搭建
渗透测试切记纸上谈兵,学习渗透测试知识的过程中,我们通常需要一个包含漏洞的测试环境来进行训练。而在非授权情况下,对于网站进行渗透测试攻击,是触及法律法规的,所以我们常常需要自己搭建一个漏洞靶场,避免直接对公网非授权目标进行测试。
漏洞靶场,不仅可以帮助我们锻炼渗透测试能力、可以帮助我们分析漏洞形成机理、更可以学习如何修复提高代码能力,同时也可以帮助我们检测各种各样漏洞扫描器的效果。
本文将以 sectooladdict/wavsep: The Web Application Vulnerability Scanner Evaluation Project靶场为例来学习靶场搭建,结合漏洞扫描服务-华为云来发现存在的漏洞。
靶场搭建
我们找一台linux机器来进行实验
❯ cat /etc/os-release -pNAME="Ubuntu" VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
docker
目前大部分靶场都有docker版本,我们利用docker来快速搭建靶场。docker安装可参考官网Install Docker Engine on Ubuntu | Docker Documentation安装手册,或者借助https://get.docker.com进行自动化安装
root in szvphisprd13003
> wget -qO- https://get.docker.com/ | bash
安装完成后,还需要配置docker镜像源来加速镜像拉取时间。这里配置中科大(USTC)源来进行加速,在 /etc/docker/daemon.json中配置
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}
wavsep
WAVSEP 是经典的漏洞靶场之一,包含常见的Web漏洞(SQL/XSS/Path Travseral/…),包含大量漏洞场景甚至假漏洞(检测扫描器误报率),目前漏洞有
- Path Traversal/LFI: 816 test cases, implemented in 816 jsp pages (GET & POST)
- Remote File Inclusion (XSS via RFI): 108 test cases, implemented in 108 jsp pages (GET & POST)
- Reflected XSS: 66 test cases, implemented in 64 jsp pages (GET & POST)
- Error Based SQL Injection: 80 test cases, implemented in 76 jsp pages (GET & POST)
- Blind SQL Injection: 46 test cases, implemented in 44 jsp pages (GET & POST)
- Time Based SQL Injection: 10 test cases, implemented in 10 jsp pages (GET & POST)
- Unvalidated Redirect: 60 test cases, implemented in 60 jsp pages (GET & POST)
- Old, Backup and Unreferenced Files: 184 test cases, implemented in 184 files (GET Only)
- Passive Information Disclosure/Session Vulnerabilities (inspired/imported from ZAP-WAVE): 3 test cases of erroneous information leakage, and 2 cases of improper authentication/information disclosure - implemented in 5 jsp pages
- Experimental Test Cases (inspired/imported from ZAP-WAVE): 9 additional RXSS test cases (anticsrf tokens, secret input vectors, tag signatures, etc), and 2 additional SQLi test cases (INSERT) - implemented in 11 jsp pages (GET & POST)
使用docker安装wavsep:
root in szvphisprd13003 in ~
❯ docker search wavsep
...
owaspvwad/wavsep The Web Application Vulnerability Scanner E… 6
...
root in szvphisprd13003 in ~
❯ docker pull owaspvwad/wavsep
...
root in szvphisprd13003 in ~
❯ docker run -itd -p 8080:8080 owaspvwad/wavsep
完成后访问 http://IP:8080/wavsep/ 即可
漏洞发现
通过手工测试与扫描器来发现靶场中的问题
手工测试
以文件包含漏洞为例,访问
http://IP:8080/wavsep/active/LFI/LFI-Detection-Evaluation-GET-500Error/index.jsp
http://IP:8080/wavsep/active/LFI/LFI-Detection-Evaluation-GET-500Error/Case01-LFI-FileClass-FilenameContext-Unrestricted-OSPath-DefaultFullInput-AnyPathReq-Read.jsp?target=/root/apache-tomcat-8.0.27/webapps/wavsep/active/LFI/LFI-Detection-Evaluation-GET-500Error/content.ini
手动修改 target 参数为 /etc/passwd 发现成功读取到 passwd 文件
华为云漏洞扫描
- 添加资产,配置域名认证
#查看wavsep容器id
root in szvphisprd13003 in ~
❯ docker ps
02e9031d5b59 owaspvwad/wavsep "/bin/sh -c 'sh ~/..." 8 months ago Up 6 minutes 0.0.0.0:8080->8080/tcp# 查看web根目录
root in szvphisprd13003 in ~
❯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zNDMyNDU0NTM5MzUzODM4NDE0MzM4MzAzNjQ1MzIzNDQ2MzYzNTQzNDYzMzQ1NDEzNjM5MzA7OzM1M
zAzMDMwMzA7MjBGQzg0NThGODVFNUM4NUI5QzBCQzE2MDgxRENGRjk7N0QyNjgyMTMwN0U2M0JDODszNzM4MzMzNDM1NjEzNTMyMkQ2MjM1Mzc2NTJEM
zQ2NTMxMzcyRDYyNjM2MzM1MkQzNjYyMzc2NTM3MzA2NTMzMzUzNjMwMzA7+IP:8080 > hwwebscan_verify.html`
访问 http://IP:8080/hwwebscan_verify.html 确认认证文件能被访问,完成域名认证
- 开始扫描,在扫描信息配置处更改目标网址为 http://IP:8080/wavsep/active/index-main.jsp
目标网址不应填写 http://IP:8080/wavsep/ 由于此页面无任何 等网页连接 爬虫无法爬取到新的页面 将扫描不到任何信息
3. 等待扫描结束 查看漏洞信息
审核编辑:汤梓红
-
Web
+关注
关注
2文章
1255浏览量
69283 -
Linux
+关注
关注
87文章
11196浏览量
208670 -
代码
+关注
关注
30文章
4717浏览量
68198
发布评论请先 登录
相关推荐
评论