redis未授权访问-漏洞复现

影响版本

Redis 4.x/5.0.5以前版本

环境搭建

4.X版本

git clone https://github.com/vulhub/vulhub.git
cd ./vulhub/redis/4-unacc
docker-compose up -d

5.x的环境
docker pull redis:5.0.9

指纹信息

➜ nmap -sV --open -p 6379 127.0.0.1
Starting Nmap 7.95 ( https://nmap.org ) at 2024-12-24 20:43 CST
Nmap scan report for hanqing.chaitin.net (127.0.0.1)
Host is up (0.000096s latency).

PORT     STATE SERVICE VERSION
6379/tcp open  redis   Redis key-value store 4.0.14

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 6.15 seconds

nmap信息搜集

nmap -sV --open -p 6379 127.0.0.1 --script redis-info

image

信息泄漏

image
info
config get *

主从复制getshell

image
image

通俗原理

两个点:
(1) 支持传输备份文件
(2)支持加载so链接库,拓展命令
第一步,我们伪装成redis数据库,然后受害者将我们的数据库设置为主节点。
第二步,我们设置备份文件名为so文件
第三步,设置传输方式为全量传输
第四步加载恶意so文件,实现任意命令执行
经过测试主从复制的可利用版本是4.x-5.x

参考文章:
https://blog.csdn.net/m0_55854679/article/details/126100539
https://xz.aliyun.com/t/7974

posted @ 2024-12-24 21:45  菜就多练forever  阅读(28)  评论(0)    收藏  举报