公告:魔扣目录网为广大站长提供免费收录网站服务,提交前请做好本站友链:【 网站目录:https://www.morko.net 】, 免友链快审服务(50元/站),

点击这里在线咨询客服
新站提交
  • 网站:51998
  • 待审:31
  • 小程序:12
  • 文章:1030137
  • 会员:747

简介

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.132192.168.85.132:6379> infoDENIED 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这个可以伪造身份的攻击方式一起进行攻击

分享到:
标签:渗透 数据库
用户无头像

网友整理

注册时间:

网站:5 个   小程序:0 个  文章:12 篇

  • 51998

    网站

  • 12

    小程序

  • 1030137

    文章

  • 747

    会员

赶快注册账号,推广您的网站吧!
最新入驻小程序

数独大挑战2018-06-03

数独一种数学游戏,玩家需要根据9

答题星2018-06-03

您可以通过答题星轻松地创建试卷

全阶人生考试2018-06-03

各种考试题,题库,初中,高中,大学四六

运动步数有氧达人2018-06-03

记录运动步数,积累氧气值。还可偷

每日养生app2018-06-03

每日养生,天天健康

体育训练成绩评定2018-06-03

通用课目体育训练成绩评定