Guarding Against CSRF Vulnerability in Redis

本文涉及的产品
Redis 开源版,标准版 2GB
推荐场景:
搭建游戏排行榜
云数据库 Tair(兼容Redis),内存型 2GB
简介: What is Redis CSRF vulnerability and how can we guarantee the security of Redis?

AliPoly_Security_2016_Annual_Report

Abstract: What is Redis CSRF vulnerability and how can we guarantee the security of Redis? Redis's CSRF vulnerability was exposed in February 2017, and the author of Redis has fixed the vulnerability in the latest release of Redis 3.2.7. This article briefly introduces the concept of CSRF vulnerability and the best practices to keep Redis instances secure.

What is CSRF?

Cross-site request forgery (CSRF or XSRF), also known as "One Click Attack" or "Session Riding", is a form of malicious website use.

46_1

The figure above shows a simple model of CSRF attacks. A user visits the malicious website Web B, which returns an HTTP message to the user asking the user to visit website Web A. If the user has set Web A as a trusted site, the access request will be executed as if the user sent the request on his/her own.

Redis CSRF Attack Model


46_2

Based on the principle of CSRF above, malicious websites may make a user send an HTTP request to Redis. Because Redis supports text protocols, and will not break off the connection in the case of illegal protocols during protocol resolution, the attacker can then add a Redis command after the normal HTTP request to execute the command on Redis. If the user and Redis do not use a password for verification, the Redis command will then be executed normally. The attacker can then encrypt data to extort money, just like the MongoDB ransom incident in January 2017.

Repairing the Kernel

The author of Redis fixed the problem in Redis v3.2.7, implementing special processing for the POST and Host: keywords, logging the events, and disconnecting to avoid execution of subsequent legal requests to Redis.

Redis Security Risks

Earlier, Redis exposed a security vulnerability that hackers may get the root permission of Redis services under certain conditions. The causes of these security vulnerabilities can be primarily attributed to users' lack of use and understanding of Redis's security mechanisms, as well as lack of Redis O&M experience. In comparison, Alibaba Cloud ApsaraDB for Redis provides more secure solutions for your on-cloud Redis services.

ApsaraDB for Redis Security Code

Intranet access to avoid Internet access

Alibaba Cloud ApsaraDB for Redis only provides trusted intranet access. You cannot access Alibaba Cloud ApsaraDB for Redis via the Internet.

Physical network isolation

Alibaba Cloud ApsaraDB for Redis's physical network and user network are physically isolated. Users' virtual machines are not allowed to directly access the backend physical machine network.

VPC network isolation

If you are an Alibaba Cloud user using the VPC network, only the services in the same VPC are inter-accessible.

Whitelist

Alibaba Cloud ApsaraDB for Redis supports whitelist settings. The feature is currently not available in the console yet. With this feature, you can set a whitelist for allowed users directly using the console.

Password access

Alibaba Cloud ApsaraDB for Redis enforces password authentication for instances in the classic network. You are recommended to set a complex password to prevent it from being cracked.

Access permission isolation

Each backend instance of Alibaba Cloud ApsaraDB for Redis is isolated in the ACL and accessible directory. Each instance is only allowed to access the path of its own instance so that inter-instance interference can be avoided.

Disabling dangerous commands

Alibaba Cloud ApsaraDB for Redis disables some dangerous system management commands such as "config" and "save". If you want to modify this parameter, you need to pass the secondary authentication in the console. This also avoids direct operations on the backend configuration files and management commands.

Security monitoring

Alibaba Cloud ApsaraDB for Redis has a complete security monitoring system for physical machines. It regularly scans and updates the security monitoring policies to discover security risks as soon as possible.

Redis cluster password

Native Redis 3.0 cluster version does not support password verification. Alibaba Cloud ApsaraDB for Redis cluster version supports password verification, which improves security.

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
目录
打赏
0
0
0
0
45
分享
相关文章
c++开发redis module问题之想实现Redis命令,如何解决
c++开发redis module问题之想实现Redis命令,如何解决
c++开发redis module问题之module根据Redis的角色采取不同的行为,如何解决
c++开发redis module问题之module根据Redis的角色采取不同的行为,如何解决
Redis突然报错 NOAUTH Authentication required
2016年年底有个项目需要用到redis,当时比较忙没有在新机器安装redis,就把我博客那台服务器上的redis地址给了技术的同事。第二天开发的同事告诉我redis连不上了,提示NOAUTH Authentication required,看了redis配置文件并没有设置密码,而且前一天使用的时候正常,我这台服务器也不会有人动。当时并没有深入分析,重启了redis后可以正常使用了。
1040 0
Redis突然报错 NOAUTH Authentication required
Jwt+Filter+SpringBoot+Redis实现Cookie自动登陆
Jwt+Filter+SpringBoot+Redis实现Cookie自动登陆
165 0
Redis未授权访问漏洞的利用总结
Redis 默认情况下,会绑定在 0.0.0.0的6379端口上,如果没有设置相关的策略和安全配置,会将 Redis 服务直接暴露在公网上,在没有设置密码认证的情况下,会导致攻击者可以未授权访问 Redis服务读取、甚至是修改 Redis 的数据
447 0
13 redis未授权访问漏洞
未授权访问漏洞可以理解为需要安全配置或权限认证的地址、授权页面配致其他用户可以无需认证授权真接访问从而引发重票权限可被操作、数据目录等敏感信息泄察
13 redis未授权访问漏洞
egg对cookies,session和redis的配置操作(四)
默认情况下,当用户请求没有导致 Session 被修改时,框架都不会延长 Session 的有效期,但是在有些场景下,我们希望用户如果长时间都在访问我们的站点,则延长他们的 Session 有效期,不让用户退出登录态。框架提供了一个 renew 配置项用于实现此功能,它会在发现当用户 Session 的有效期仅剩下最大有效期一半的时候,重置 Session 的有效期。