Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions ShellcodeCompiler/ASMHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,22 @@ string ASMHeader::GetASMHeader_x86()
"mov eax, [eax + 0xc] ; EAX = PEB->Ldr \r\n"
"mov esi, [eax + 0x14] ; ESI = PEB->Ldr.InMemOrder \r\n"
"lodsd ; EAX = Second module \r\n"

"Next_Module: \r\n\r\n"

"xchg eax, esi ; EAX = ESI, ESI = EAX \r\n"
"lodsd ; EAX = Third(kernel32) \r\n"
"lodsd ; EAX = Next module \r\n"
"mov ecx, [eax + 0x28] ; ECX = Module Name \r\n"
"cmp dword [ecx], 0x45004b ; KE \r\n"
"jne Next_Module \r\n"
"cmp dword [ecx + 0x4], 0x4e0052 ; RN \r\n"
"jne Next_Module \r\n"
"cmp dword [ecx + 0x8], 0x4c0045 ; EL \r\n"
"jne Next_Module \r\n"
"cmp dword [ecx + 0xc], 0x320033 ; 32 \r\n"
"jne Next_Module \r\n"
"mov ebx, [eax + 0x10] ; EBX = Base address \r\n"

"mov edx, [ebx + 0x3c] ; EDX = DOS->e_lfanew \r\n"
"add edx, ebx ; EDX = PE Header \r\n"
"mov edx, [edx + 0x78] ; EDX = Offset export table \r\n"
Expand Down Expand Up @@ -87,8 +100,20 @@ string ASMHeader::GetASMHeader_x64()
"mov rax, [rax + 0x18] ; RAX = PEB->Ldr \r\n"
"mov rsi, [rax + 0x20] ; RSI = PEB->Ldr.InMemOrder \r\n"
"lodsq ; RAX = Second module \r\n"

"Next_Module: \r\n\r\n"

"xchg rax, rsi ; RAX = RSI, RSI = RAX \r\n"
"lodsq ; RAX = Third(kernel32) \r\n"
"lodsq ; RAX = Next Module \r\n"
"mov rcx, [rax + 0x50] ; RCX = Module Name \r\n"
"cmp dword [rcx], 0x45004b ; KE \r\n"
"jne Next_Module \r\n"
"cmp dword [rcx + 0x4], 0x4e0052 ; RN \r\n"
"jne Next_Module \r\n"
"cmp dword [rcx + 0x8], 0x4c0045 ; EL \r\n"
"jne Next_Module \r\n"
"cmp dword [rcx + 0xc], 0x320033 ; 32 \r\n"
"jne Next_Module \r\n"
"mov rbx, [rax + 0x20] ; RBX = Base address \r\n\r\n"

"xor r8, r8 ; Clear r8 \r\n"
Expand Down