Skip to content

Commit 06d1971

Browse files
committed
exploit/windows/local/unquoted_service_path: Check if write_file fails
1 parent 41361db commit 06d1971

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/exploits/windows/local/unquoted_service_path.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,12 @@ def exploit
170170
print_status(" Placing #{exe_path} for #{svc_name}")
171171
exe = @svc_exes[svc_name] ||= generate_payload_exe_service({ servicename: svc_name })
172172
print_status(" Attempting to write #{exe.length} bytes to #{exe_path}...")
173-
write_file(exe_path, exe)
173+
174+
unless write_file(exe_path, exe)
175+
print_error("#{exe_path} could not be written")
176+
next
177+
end
178+
174179
print_good ' Successfully wrote payload'
175180
register_file_for_cleanup(exe_path)
176181

0 commit comments

Comments
 (0)