0x00 基本信息
下载
Please remember that VulnHub is a free community resource so we are unable to check the machines that are provided to us. Before you download, please read our FAQs sections dealing with the dangers of running unknown VMs and our suggestions for “protecting yourself and your network. If you understand the risks, please download!
Tr0ll3.ova (Size: 4.0GB)
Download: https://drive.google.com/file/d/1Jshz0VifMrw3S-Kcq8C3nf9HMQtXuKrW/view
Download (Mirror): https://download.vulnhub.com/tr0ll/Tr0ll3.ova
Download (Torrent): https://download.vulnhub.com/tr0ll/Tr0ll3.ova.torrent ( Magnet)
描述
Description
The latest version of the Tr0ll series. This one is a little different from the previous iterations, I would say still on the beginner++ level. I hope everyone has fun, be sure to tag @Maleus21 with screen shots of the flag.
You will need to login with start:here
Type: Boot 2 Root
Goal: Obtain flag.txt
Difficulty: Beginner++
Fun level: Over 9000
0x01 信息收集
端口扫描,只扫描出来22端口:
但是又开机描述得到登录账号密码 start:here
使用这个账号登录,登录成功:
现在进去能查看的文件,感觉没啥用
0x01 漏洞利用
然后通过通过find命令来查看靶机里面的文件:
find / -perm -u+s -type f 2>/dev/null
意思:查找权限为所有用户都能执行的文件,并且将标准错误删除
find / -type d -writable 2>/dev/null
意思:查找可写的块设备,并将标准错误删除, b/d/c/l/p/f==》目录/块设备/字符设备/链接文件/管道文件/普通文件
find / -type f -perm 0777 2>/dev/null
意思:查找具有可读可写可执行的文件
sudo -l
意思:查看具有特殊权限的文件
在查找具有文件中,发现了一个cap包:
下载cap包:
看到流量包中的包含TP-link,猜测这是一个wifi流量包:
下载刚刚发现的文件
使用刚刚发现的文件来作为字典对流量包进行爆破,得到 wytshadow:gaUoCe34t1
aricrack-ng -w wordlist.txt .cap
0x02 提权
查看文件:
在切换目录,发现了可执行文件:
查看LYNX是什么,LYNA就是一个纯文本的浏览器
刚刚发现了nginx,在去查看一下nginx的配置文件:
大概意思就是开启nginx服务并监听8080端口,外部访问的user-agent只能是LYNX,否则就返回403
所以现在打开nginx, sudo /usr/sbin/service nginx start,就可以看到8080端口已经打开,然后通过火狐浏览器去访问,查看是否是返回的是403
所以接下来使用lynx访问,在kali上安装此命令工具(也可以在burp中修改浏览器为lynx,或者直接修改nginx中的配置文件来访问):
sudo apt-get install lynx
得到一个账户密码: genphlux:HF9nd0cR! ,尝试登录,然后发现了一个私钥:
chmod 600 id_rsa (权限过大不能登录)
ssh -i id_rsa 192.168.56.101 -l maleus
查看.viminfo文件,发现里面存在密码 B^slc8I$:
既然知道了密码,那么就可以通过sudo -l 来查看具有哪些权限,可以看到,dont_even_bother是具有root权限的
查看这个是文件
发现此文件是可执行文件,那么就可以判断,如果此文件使用sudo权限执行,那么就可以提权为root用户,所以前提是要更改里面的代码为提权代码,目前此文件执行的效果如下:
我们尝试复制此文件到一个新的文件名称为dont_even_bother.c 在此文件使用vim写入提权代码,具体如下:
int main (void){
setresuid(0,0,0);
system("/bin/sh");
}
然后删除原文件,并重新编译新文件:
gcc dont_even_bother.c -o dont_even_bothe
执行文件,直接提取成功:
0x03 总结
参考文章:
https://www.cnblogs.com/autopwn/p/13474508.html
https://blog.youkuaiyun.com/weixin_43202322/article/details/99475201
工具总结
namp
find
python
gcc
lynx
aricrack-ng
知识点:
1、find命名的用法?
2、什么是lynx?
3、私钥的权限为什么不能是777,而是600?
4、.viminfo是什么文件?有什么作用?