1 - Analyst Flow to Unpack
1.1 - Setting breakpoints
Using IDA Pro we can go to the names subview, choose relevant module, and search for the functions IDA has loaded in. From here, we can set breakpoints at specific Win API’s. We should set breakpoints on the following API calls based on which phase we should target:
- Decompress or Decrypt
RtlDecompressBufferCryptDecrypt
- Create of find target location (Not usually best to set BP on these, but they can give you an idea of which phase you’re at)
OpenProcessWinExecCreateProcessCreateToolhelp32SnapshotProcess32FirstProcess32Next
- Prepare Location
VirtualAlloc(Ex)NtAllocateVirtualMemoryVirtualProtectNtProtectVirtualMemoryNtMapViewOfSection
- Write
WriteProcessMemoryNtWriteVirtualMemoryRtlMoveMemory
- Prepare Execution
VirtualProtect(Ex)NtProtectVirtualMemorySetThreadContextCreateProcessInternalW
- Execute
CreateThreadpoolWaitCreateRemoteThreadRtlCreateUserThread(Nt)ResumeThreadSetWindowsHookEx
- Anti Analysis
IsDebuggerPresent