网站首页 > 技术文章 正文
简介
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 虚拟化:提升座舱算力效率
- 最近发表
-
- count(*)、count1(1)、count(主键)、count(字段) 哪个更快?
- 深入探索 Spring Boot3 中 MyBatis 的 association 标签用法
- js异步操作 Promise fetch API 带来的网络请求变革—仙盟创梦IDE
- HTTP状态码超详细说明_http 状态码有哪些
- 聊聊跨域的原理与解决方法_跨域解决方案及原理
- 告别懵圈!产品新人的接口文档轻松入门指南
- 在Javaweb中实现发送简单邮件_java web发布
- 优化必备基础:Oracle中常见的三种表连接方式
- Oracle常用工具使用 - AWR_oracle工具有哪些
- 搭载USB 3.1接口:msi 微星 发布 990FXA Gaming 游戏主板
- 标签列表
-
- 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)
- asynccallback (71)
- localstorage.removeitem (74)
- vector线程安全吗 (70)
- java (73)
- js数组插入 (83)
- mac安装java (72)
- 查看mysql是否启动 (70)
- 无效的列索引 (74)