0x00 redis简述
REmote DIctionary Server(Redis) 是一个由Salvatore Sanfilippo写的key-value存储系统。
Redis是一个开源的使用ANSI C语言编写、遵守BSD协议、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。它通常被称为数据结构服务器,因为值(value)可以是 字符串(String), 哈希(Map), 列表(list), 集合(sets) 和 有序集合(sorted sets)等类型。
0x01 redis配置文件
配置文件名称:redis.conf
默认路径:/etc/redis.conf
默认端口:6379
redis配置文件中与权限和密码有关的字段:
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
# internet, binding to all the interfaces is dangerous and will expose the
# following bind directive, that will force Redis to listen only into
bind 0.0.0.0
# If the master is password protected (using the "requirepass" configuration
# requirepass foobared
bind代表允许访问的ip
requirepass 代码访问redis的密码
0x02 那种情况下,redis存在未授权访问
启动方式 |
对应进程 |
配置文件 |
是否存在未授权访问 |
./redis-server |
00:00:00 redis-server 0.0.0.0:6379 |
没有配置文件 |
不存在 |
./redis-server redis.conf |
redis-server 0.0.0.0:6379 |
bind 0.0.0.0 |
存在 |
./redis-server redis.conf |
redis-server 0.0.0.0:6379 |
默认配置 |
不存在 |
./redis-server redis.conf |
redis-server 0.0.0.0:6379 |
requirepass foobared; bind 0.0.0.0 |
不存在 |
综上表名redis未授权访问的条件是:
- 加载了配置文件(./redis-server redis.conf)
- 允许任何ip登录,或者自己的ip在允许范围内(bind 0.0.0.0)
- 未设置密码(#requirepass foobared)