Hello.
During this sample reverse engineering I came across very familiar code. Bot itself uses high number of obfuscated system calls, here they
Example
Best Regards,
-rin
During this sample reverse engineering I came across very familiar code. Bot itself uses high number of obfuscated system calls, here they
Code: Select all
Each routine called by obfuscated ID through dedicated sysenter gate, but before call it of course deobfuscated and xored with global key created from GetTickCount during bot initialization (ntdll service ID extraction routine located at .text:00403A70). .text:00403EDF NtAllocateVirtualMemoryStub
.text:00403FDF NtCloseStub
.text:0040421F NtCreateFileStub
.text:0040409F NtCreateKeyStub
.text:0040401F NtDeleteValueKeyStub
.text:0040415F NtEnumerateKeyStub
.text:00403E9F NtFlushInstructionCacheStub
.text:00403E5F NtGetContextThreadStub
.text:0040419F NtLoadKeyStub
.text:00403F9F NtNotifyChangeKeyStub
.text:004040DF NtOpenKeyStub
.text:00403F5F NtOpenProcessStub
.text:00403D1F NtProtectVirtualMemoryStub
.text:00403F1F NtQuerySystemInformationStub
.text:0040411F NtQueryValueKeyStub
.text:00403D9F NtReadVirtualMemoryStub
.text:00403DDF NtResumeThreadStub
.text:00403E1F NtSetContextThreadStub
.text:0040405F NtSetValueKeyStub
.text:004041DF NtUnloadKeyStub
.text:0040429F NtWaitForSingleObjectStub
.text:0040425F NtWriteFileStub
.text:00403D5F NtWriteVirtualMemoryStub
Example
Code: Select all
Interesting code located at address .text:00403640 in unpacked bot binary. This is force OpenProcess routine similar to http://www.kernelmode.info/forum/viewto ... 986#p18986, used by bot for process injection. What interested me here is how exactly it used if NtOpenProcess with PAGE_GUARD trick fails then it trying again NtOpenProcess this time using direct system call through dedicated stub..text:00403CF0 NtProtectVirtualMemoryStub proc near ; CODE XREF: OpenProcessForce+7Bp
.text:00403CF0 ; WriteProcessMemoryWithFlush+25p ...
.text:00403CF0 mov ecx, 5B63D1D7h
.text:00403CF5 call GetServiceIdFromHash
.text:00403CFA cmp dword_42150C, 0
.text:00403D01 jz short loc_403D19
.text:00403D03 xor eax, g_dwXorKey
.text:00403D09 lea edx, [esp+arg_0]
.text:00403D0D xor ecx, ecx
.text:00403D0F call large dword ptr fs:0C0h
.text:00403D16 retn
.text:00403D19
.text:00403D19 loc_403D19: ; CODE XREF: NtProtectVirtualMemoryStub+11j
.text:00403D19 xor eax, g_dwXorKey
.text:00403D1F call NtProtectVirtualMemoryStub_sysenter
.text:00403D24 retn
.text:00403D24 NtProtectVirtualMemoryStub endp
.text:00403D24
.text:00403D25 NtProtectVirtualMemoryStub_sysenter proc near
.text:00403D25 ; CODE XREF: NtProtectVirtualMemoryStub+2Fp
.text:00403D25 mov edx, esp
.text:00403D27 sysenter
.text:00403D29 retn
.text:00403D29 NtProtectVirtualMemoryStub_sysenter endp
Best Regards,
-rin