Posted about 1 year ago, by Ksbunker

This information is nothing new, but I think it's very interesting none-the-less. Given the prevalence of hooks (detours, hotpatches, IAT hooks) in todays scene, it is becoming more important to understand how to circumvent these rudimentary attempts at slowing us down.

Hooks have been spoken about ad nauseum here at zonehacks so I won't explain what they are or how to use them... this is all assumed knowledge (and if you're still uncertain, just browse over Specific's articles). Besides this article is not about hooks per se, but rather how to call function without executing the modified (hooked) line(s) of code.

And so, I present some usermood tricks for invoking/calling WriteProcessMemory when WPM is hooked;

kernel32.WriteProcessMemory Trampoline

USAGE:
 push lpNumberOfBytesWritten ;out
 push nSize ;in
 push lpBuffer ;in
 push lpBaseAddress ;in
 push hProcess ;in
 CALL @WriteProcessMemoryTrampoline

ntdll.ZwWriteVirtualMemory Trampoline ( LoadLibrary/GetProcAddress)

USAGE:
 push lpNumberOfBytesWritten ;out
 push nSize ;in
 push lpBuffer ;in
 push lpBaseAddress ;in
 push hProcess ;in
 CALL @ZwWriteVirtualMemoryTrampoline

ZwWriteProcessMemory via Syscall

USAGE:
 push lpNumberOfBytesWritten ;out
 push nSize ;in
 push lpBuffer ;in
 push lpBaseAddress ;in
 push hProcess ;in
 CALL @ZwWPMSysCall

ZwWriteProcessMemory via KiFastSystemCall

USAGE:
 push lpNumberOfBytesWritten ;out
 push nSize ;in
 push lpBuffer ;in
 push lpBaseAddress ;in
 push hProcess ;in
 CALL @WPM_KiFastSystemCall

ZwWriteVirtualMemory via SYSENTER / Int 2E

USAGE:
 push lpNumberOfBytesWritten ;out
 push nSize ;in
 push lpBuffer ;in
 push lpBaseAddress ;in
 push hProcess ;in
 CALL @WPM_sysenter

Author Info Comment