网站首页 > 技术文章 正文
简介
redis是一种key-value键值对的非关系型数据库,默认运行在6379端口
它启动时不会像apache一样,以一种www-data低权限身份运行。而是以运行者的身份,例如用root权限直接运行redis时,redis的权限就是root权限
其次它的默认配置是无需密码的,也就造成了默认的未授权访问
redis还支持本地存储,也就导致了任意文件写入。从而可以写入私钥,利用私钥直接ssh登录服务器。
漏洞环境搭建
攻击机
操作系统:ubuntu 16.04
ip :192.168.85.128
安装redis
靶机
操作系统: centos 6.5
ip :192.168.85.132
下载编译redis
修改下配置文件,不然默认虽然是无密码,但是会有protected模式,导致无法从外部主机连接
bind 127.0.0.1前面加上#号 protected-mode设为no
启动redis
写入ssh-keygen公钥
现在下先在本地生成一对密钥
这样就可以在~/.ssh目录下生成一对id_rsa、id_rsa.pub
然后连接靶机redis
这样,我们就把公钥写入对方的服务器了,直接用生成的私钥连接即可
假如报了如下错误
运行下如下两句即可
利用计划任务反弹shell
先开一个终端监听本地的23333端口
利用之前类似的文件写入,写入定时命令
需要等待一会,一般一分钟之内吧,nc就能收到反弹回来的shell了
写入webshell
当redis权限较低,上面两种方法都行不通的时候,可以尝试往web服务中写入一句话,获取webshell
这样,就能在根目录下生成shell.php。访问一下
结合SSRF
之前能看到,默认情况下虽然是没有密码,但是会开启protected保护模式
在这情况下,我们尝试连接一下对方redis
kingkk@ubuntu:~/test/redis$ redis-cli -h 192.168.85.132
192.168.85.132:6379> info
DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.可以看到保护模式拒绝了redis的远程连接,所以经常redis都是配合着ssrf这个可以伪造身份的攻击方式一起进行攻击
猜你喜欢
- 2025-07-23 半导体封装Wire Bonding 打线邦定(引线键合技术)的详解;
- 2025-07-23 看球听歌足球和人生一样,有失就会有得
- 2025-07-23 一首歌拯救你的起床气(拯救你歌曲)
- 2025-07-23 TED演讲:如何相信自己(一)(中英文)
- 2025-07-23 工艺范围与校准范围及公差(允差)之间的关系
- 2025-04-29 精华总结:10个问题理解 Linux epoll
- 2025-04-29 网络工程实例(Cisco路由设备详解实例)
- 2025-04-29 概率分布,贝叶斯神经网络python开发程序包pyro教程和使用指南
- 2025-04-29 欧美经典怀旧歌曲Free loop-管不住的音符
- 2025-04-29 虚拟化:提升座舱算力效率
- 最近发表
- 
- 聊一下 gRPC 的 C++ 异步编程_grpc 异步流模式
- [原创首发]安全日志管理中心实战(3)——开源NIDS之suricata部署
- 超详细手把手搭建在ubuntu系统的FFmpeg环境
- Nginx运维之路(Docker多段构建新版本并增加第三方模
- 92.1K小星星,一款开源免费的远程桌面,让你告别付费远程控制!
- Go 人脸识别教程_piwigo人脸识别
- 安卓手机安装Termux——搭建移动服务器
- ubuntu 安装开发环境(c/c++ 15)_ubuntu安装c++编译器
- Rust开发环境搭建指南:从安装到镜像配置的零坑实践
- Windows系统安装VirtualBox构造本地Linux开发环境
 
- 标签列表
- 
- cmd/c (90)
- c++中::是什么意思 (84)
- 标签用于 (71)
- 主键只能有一个吗 (77)
- c#console.writeline不显示 (95)
- pythoncase语句 (88)
- es6includes (74)
- sqlset (76)
- apt-getinstall-y (100)
- node_modules怎么生成 (87)
- chromepost (71)
- flexdirection (73)
- c++int转char (80)
- mysqlany_value (79)
- static函数和普通函数 (84)
- el-date-picker开始日期早于结束日期 (76)
- js判断是否是json字符串 (75)
- c语言min函数头文件 (77)
- asynccallback (87)
- localstorage.removeitem (77)
- vector线程安全吗 (73)
- java (73)
- js数组插入 (83)
- mac安装java (72)
- 无效的列索引 (74)
 
