Skip to content

Commit 5225186

Browse files
committed
Ensure Windows single payloads use payload backend
This means the singles that define their own assembly will use the payload backend to generate it.
1 parent 16d065a commit 5225186

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

lib/msf/core/payload.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ def assembly
185185
return module_info['Payload'] ? module_info['Payload']['Assembly'] : nil
186186
end
187187

188+
#
189+
# Sets the assembly string that describes the payload
190+
# If this method is used to define the payload, a payload with no offsets will be created
191+
#
192+
def assembly=(asm)
193+
module_info['Payload'] ||= {'Offsets' => {} }
194+
module_info['Payload']['Assembly'] = asm
195+
end
196+
188197
#
189198
# Returns the offsets to variables that must be substitute, if any.
190199
#

modules/payloads/singles/windows/dns_txt_query_exec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ def generate
253253
254254
255255
EOS
256-
the_payload = Metasm::Shellcode.assemble(Metasm::Ia32.new, payload_data).encode_string
256+
self.assembly = payload_data
257+
super
257258
end
258259
end

modules/payloads/singles/windows/download_exec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ def generate
387387
db "#{server_host}", 0x00
388388
end:
389389
EOS
390-
the_payload = Metasm::Shellcode.assemble(Metasm::Ia32.new, payload_data).encode_string
390+
self.assembly = payload_data
391+
super
391392
end
392393
end

modules/payloads/singles/windows/messagebox.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ def generate
266266
;EXITFUNC
267267
#{doexit}
268268
EOS
269-
the_payload = Metasm::Shellcode.assemble(Metasm::Ia32.new, payload_data).encode_string
269+
self.assembly = payload_data
270+
super
270271
end
271272

272273
#

0 commit comments

Comments
 (0)