靶机地址:https://hackmyvm.eu/machines/machine.php?vm=suidy
主机信息
kali:192.168.85.128
suidy:192.168.85.177
端口扫描
nmap -sV -p- -T 5 192.168.85.177
Web渗透
访问80端口
进行目录扫描
python3 dirsearch.py -u "http://192.168.85.177/"
有一个robots.txt
在robots.txt的最下面发现一个/shehatesme
访问/shehatesme,有一段话
She hates me because I FOUND THE REAL SECRET! I put in this directory a lot of .txt files. ONE of .txt files contains credentials like "theuser/thepass" to access to her system! All that you need is an small dict from Seclist!
提示在/shehatesme/目录下有很多txt文件,并且可以登录,提示字典seclist
使用directory-list-2.3-medium.txt字典进行爆破
爆破发现多个用户名密码
将获得的用户名密码放到文件中
爆破ssh
hydra -L user -P pass 192.168.85.177 ssh
得到theuser/thepass
shell
登录ssh
获得user.txt
提权
在home目录中还有一个用户suidy
进入suidy目录,有一个suidyyyyy可执行文件
运行suidyyyyy获得suidy权限
查看note.txt
```
I love SUID files!
The best file is suidyyyyy because users can use it to feel as I feel.
root know it and run an script to be sure that my file has SUID.
If you are "theuser" I hate you!
-suidy
```
root know it and run an script to be sure that my file has SUID.
猜测是有有程序定时给suidyyyyy权限
上传pspy64,进行监控
发现会定时执行timer.sh,应该是次程序在给suidyyyyy权限
可以写一个suidyyyyy替换掉现在的suidyyyyy
在写文件的时候发现suidy没有权限
尝试使用theuser写
写入成功
```
include
include
void main(){
setuid(0);
setgid(0);
system("bash -i");
}
```
gcc编译一下
gcc suidyyyyy.c -o suidyyyyy
将原来的suidyyyyy替换掉
过了一段时间会设置成suid权限
运行获得root权限
获得root.txt
timer.sh的内容为:
```
!/bin/sh
chmod +s /home/suidy/suidyyyyy
```
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论