Redis ACL - RCP 1
DaeMyung Kang (charsyam@naver.com)
Who am I?
• Software Engineer At Udemy
• Redis Contributor
• Redis Document Project Committer
• https://github.com/antirez/redis-doc
• Speaker in RedisConf 2016
• TroubleShooting Redis
Agenda
• What happened without Authentication for Redis?
• What is current Redis ACL?
• What is RCP1
What happened without
Authentication for Redis?
Memcrashed
Memcrashed
• Memcached DDOS issue not Redis
• Memcached is high-performance In-Memory K-V Store
• Memcached opened UDP port as Default(11211 port).
• Memcached doesn't support Authentication.
• It web patched in 28 Feb, 2018
Memcrashed
Attacker
Victim
UDP
Servers
UDP
Servers
UDP
Servers
1. IP spoofed Requests
They can't verify UDP source
2. Legitimate UDP Response Victim receives huge traffic
from Memcached servers
Redis in public
Redis in public
• Redis opens 6379 port in public.
• Redis runs with Root Permission.
• Redis runs without requirepass.
You are ready
to be Hacked
How to hack Redis
• Using RDB Saving
• I don't want to show you the detail steps.
How to hack Redis #2
How to hack Redis #3
Never expose Your
Redis in Public
Redis Status(2018/05/30 : Today)
• Globally 17,153 Redis Servers are in Public
Memcached Status(2018/05/30 : Today)
• Globally 37,839 Memcached Servers are in Public
What is current Redis ACL?
Redis only
support
requirepass
Limitation of requirepass
• if you know password, you can run all commands.
• O(N) Commands
• KEYS
• FLUSHALL
• LREM
rename-command
• We can change command name to another.
• or can Disable it
• But sometimes we need to use disabled commands for management.
• if someone know changed commands
• All people will know them.
• Still someone can make mistake.
RCP1
Redis ACL
ACL : Access Control List
• Specify who has granted access to objects
• In Redis
• Specify who is granted to execute specific commands
Examples
#<username> <password> [<acl> <acl> … <acl>]
charsyam "my password" +#all
client "my password" +#readonly
default "" +ping +info
charsyam can execute all commands
client can execute only readonly commands
default user only can run ping and info commands
- default is a user permission before auth step.
auth example
auth <username> <password>
Command Groups
Command Command
#readonly #zset
#write #hash
#slow #hyperloglog
#admin #scan
#string #pubsub
#list #transaction
#set #scripting
Implementation
RCP1
bit arrays for commands #1 Command Group
Command Index
in BitArray
ACL BitArray
module
0
Get
1
Set
1
Setnx
0
Setex
0
… … …
This user can't use module command
ACL BitArray
Module
0
Get
1
Set
1
Setnx
0
Setex
0
… … …
This user can use Get command
bit arrays for commands #2
64 * 4
256 bits
typedef unsigned long long acl_t;
bit arrays for commands #3
How we can use?
Default User
+#ALL
-KEYS
-FLUSHALL
-ADMIN
Admin
+#ALL
Read Only
+#ReadOnly
Some Issues for Redis Security
• SSL/TLS supporting
• Periodic Password Changing
DEMO for RCP1
Thanks

Redis acl