在费劲地搞定vulapps环境安装后,对安装漏洞环境貌似上瘾了,再装一个vulhub漏洞环境吧。
这次就继续在kali2009上安装,希望一切顺利。
Vulhub是一个面向大众的开源漏洞靶场,简单执行两条命令即可编译、运行一个完整的漏洞靶场镜像。安装 docker和 docker-compose后即可开始使用vulhub。
安装过程记录如下:
#需要pip
root@kali:/# apt-get install python3-pip
root@kali:/# pip3 install docker-compose
#下载vulhub
root@kali:/# git clone https://github.com/vulhub/vulhub.git
下载时速度很慢,卡到最后直接挂掉了:(
正克隆到 'vulhub'...
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (17/17), done.
error: RPC 失败。curl 56 GnuTLS recv error (-54): 在 pull 函数中出错。
fatal: 远端意外挂断了
fatal: 过早的文件结束符(EOF)
fatal: index-pack 失败
用网上流传的修改/etc/hosts文件的方法,也没见效果,差评。
199.232.69.194 github.global.ssl.fastly.net
140.82.113.3 github.com
正克隆到 'vulhub'...
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (17/17), done.
接收对象中: 26% (2389/9063), 2.00 MiB | 8.00 KiB/s
反正有的是时间,慢慢下吧,扔那几个小时没管总算下好了。
#查看vulhub漏洞靶场列表
root@kali:~# ls vulhub
activemq electron jackson nginx scrapy
appweb fastjson java node shiro
aria2 ffmpeg jboss openssh solr
base flask jenkins openssl spark
bash fpm jira php spring
cgi ghostscript jmeter phpmailer struts2
coldfusion git joomla phpmyadmin supervisor
confluence gitea jupyter phpunit thinkphp
contributors.md gitlab kibana postgres tomcat
contributors.zh-cn.md gitlist libssh python uwsgi
couchdb glassfish LICENSE rails weblogic
discuz goahead liferay-portal README.md webmin
django gogs log4j README.zh-cn.md wordpress
dns h2database magento redis zabbix
docker hadoop mini_httpd rsync
drupal httpd mongo-express ruby
ecshop imagemagick mysql saltstack
elasticsearch influxdb nexus samba
好多啊,有得玩了。选择一个靶场,比如进入CVE-2017-10271这个靶场
root@kali:/# cd vulhub/weblogic/CVE-2017-10271
root@kali:~/vulhub/weblogic/CVE-2017-10271# docker-compose up -d
在这里又碰到个坑,pull到后来居然失败,提示磁盘空间不足,因为安装时默认只设置了20G,悲催,只能想办法扩容了。先在虚拟机里调整一下磁盘大小,先调成30G吧,硬盘空间本身就不多了。再打开Gparted。
root@kali:~# /bin/sh /usr/lib/udisks2/udisks2-inhibit /usr/sbin/gpartedbin
======================
libparted : 3.2
======================
root@kali:~# /usr/bin/gnome-disks
打开磁盘管理工具,删除扩展分区,然后对主分区进行容量调整,适当增加空间。
剩下一部分来做交换分区。
root@kali:~# fdisk /dev/sda
Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): e
Partition number (2-4, default 2):
First sector (51175424-62914559, default 51175424):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (51175424-62914559, default 62914559):
Created a new partition 2 of type 'Extended' and of size 5.6 GiB.
Command (m for help): t
Partition number (1,2, default 2):
Hex code (type L to list all codes): 82
Changed type of partition 'Extended' to 'Linux swap / Solaris'.
Command (m for help): w
The partition table has been altered.
Syncing disks.
继续
root@kali:~# mkswap /dev/sda2
Setting up swapspace version 1, size = 5.6 GiB (6010433536 bytes)
no label, UUID=c1f37573-47e5-4431-91dc-518e508b4089
root@kali:~# swapon /dev/sda2
添加开机自动挂载swap分区
root@kali:~# vim /etc/fstab
#在fstab中添加下面的一条记录: /dev/sda2 swap swap defaults 0 0
挂载分区
root@kali:~# mount -a
这时swap分区就建立完成了。
再重新pull一次,数据包果然不小,后来30G还不够大:
root@kali:~/vulhub/weblogic/CVE-2017-10271# docker-compose up -d
Pulling weblogic (vulhub/weblogic:)...
latest: Pulling from vulhub/weblogic
6599cadaf950: Pull complete
23eda618d451: Pull complete
f0be3084efe9: Pull complete
52de432f084b: Pull complete
a3ed95caeb02: Pull complete
a2318f26c625: Pull complete
1aa642dd8cc1: Pull complete
b307208f8bf5: Pull complete
1dfbbdcc497d: Pull complete
a53e674a7606: Pull complete
5f06bb51fa3c: Pull complete
ff0ff72567f2: Downloading [======================================> ] 830MB/1.068GB
684862046025: Download complete
abbf8d475455: Download complete
848eb11ef744: Download complete
2f3438f2b83b: Download complete
8e5871e15571: Download complete
速度还不错,一会就下好了。
Digest: sha256:275ec19477cfda389dc1c42158033e7e8c650dd4cba9f090ca0ba673902b73c9
Status: Downloaded newer image for vulhub/weblogic:latest
Creating cve-2017-10271_weblogic_1 ... done
访问方式为: http://ip:7001
看到下面这个404页面,说明weblogic已成功启动。
真的是好事多磨,学习的路上总是有各种坑,好在有强大的互联网,可以帮助解决各种问题。
靶场关闭和删除
root@kali:/# docker-compose down
root@kali:/# docker rm $(docker ps -a -p)