我是逆向工程的新手,一直在使用 olly 和 x64_dbg。我已经在某种程度上成功地逆向工程并理解了几个应用程序的功能和部分代码。我还不能阅读 Asm 或发现数据结构。我最近试图偷看一个新 PE 的反汇编代码,但它被混淆了。所以在这一点上它远远超出了我的头脑,但我继续深入研究。我遇到了一个由该User32.CreateWindowExA 函数创建/启动的弹出对话框。由于反调试代码,我不能在实际的可执行文件中放置任何断点....exe 和 dll 的某些内存位置可以有断点。无论如何,我将范围缩小到一个DispatchMessageA被调用的函数,然后CreateWindowExA功能。我无法找出两者之间发生了什么,也无法找到 GetMessage 函数。我相信我知道正在发送的消息,但我的问题是,如何找到发送的适当消息的接收消息功能。假设可以发送 3 条不同的消息,我如何找出谁收集了它们?
帮助跟踪获胜消息
逆向工程
拆卸
2021-06-14 17:56:32
1个回答
就目前而言,查询范围太广
捕获通过 GetMessageX 发送到某个进程的所有消息 可以使用与此类似的条件日志断点
OS xpsp3 使用 windbg 和Ken Johnsonssdbgext windbg 扩展
演示结果
查找 GetMessage 的索引
0:000> uf USER32!NtUserGetMessage
USER32!NtUserGetMessage:
7e4191b2 b8a5110000 mov eax,11A5h
7e4191b7 ba0003fe7f mov edx,offset SharedUserData!SystemCallStub (7ffe0300)
7e4191bc ff12 call dword ptr [edx]
7e4191be c21000 ret 10h
知道需要多少步
0:000> uf ntdll!KiFastSystemCall
ntdll!KiFastSystemCall:
7c90e510 8bd4 mov edx,esp
7c90e512 0f34 sysenter
7c90e514 c3 ret
使用索引和步数设置条件日志断点
0:000> bp ntdll!KiFastSystemCall ".if(@eax == 11a5) {r $t0 = poi(@esp+8);p 2 \"!usermsg @$t0;g\";} .else {gc}"
确认断点
0:000> .bpcmds
bp0 0x7c90e510 ".if(@eax == 11a5) {r $t0 = poi(@esp+8);p 2 \"!usermsg @$t0;g\";} .else {gc}";
执行
0:000> g
**记录大量的喷出,稍后解析**
eax=000011a5 ebx=00000000 ecx=00000000 edx=0007fde0 esi=0007fee8 edi=01014018
eip=7c90e512 esp=0007fde0 ebp=0007fdfc iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
ntdll!KiFastSystemCall+0x2:
7c90e512 0f34 sysenter
hwnd:
Window 000a01d6
Name C
Class Button
WndProc 00000000
Style WS_OVERLAPPED
ExStyle WS_EX_NOPARENTNOTIFY WS_EX_LEFT WS_EX_LTRREADING WS_EX_RIGHTSCROLLBAR
HInstance 01000000
ParentWnd 001200e0
Id 00000088
UserData 00000000
Unicode TRUE
ThreadId 00000be8
ProcessId 00000be0
Message: WM_PAINT
wParam: 0
lParam: 0
Time: 5bd026
pt: (1021, 413)
eax=000011a5 ebx=00000000 ecx=00000000 edx=0007fde0 esi=0007fee8 edi=01014018
eip=7c90e512 esp=0007fde0 ebp=0007fdfc iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
ntdll!KiFastSystemCall+0x2:
7c90e512 0f34 sysenter
hwnd:
Window 00080186
Name /
Class Button
WndProc 00000000
Style WS_OVERLAPPED
ExStyle WS_EX_NOPARENTNOTIFY WS_EX_LEFT WS_EX_LTRREADING WS_EX_RIGHTSCROLLBAR
HInstance 01000000
ParentWnd 001200e0
Id 0000005a
UserData 00000000
Unicode TRUE
ThreadId 00000be8
ProcessId 00000be0
Message: WM_PAINT
wParam: 0
lParam: 0
Time: 5bd14f
pt: (1021, 413)
eax=000011a5 ebx=00000000 ecx=00000000 edx=0007fde0 esi=0007fee8 edi=01014018
eip=7c90e512 esp=0007fde0 ebp=0007fdfc iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
ntdll!KiFastSystemCall+0x2:
7c90e512 0f34 sysenter
hwnd:
Window 000a0160
Name *
Class Button
WndProc 00000000
Style WS_OVERLAPPED
ExStyle WS_EX_NOPARENTNOTIFY WS_EX_LEFT WS_EX_LTRREADING WS_EX_RIGHTSCROLLBAR
HInstance 01000000
ParentWnd 001200e0
Id 0000005b
UserData 00000000
Unicode TRUE
ThreadId 00000be8
ProcessId 00000be0
Message: WM_PAINT
wParam: 0
lParam: 0
Time: 5bd249
pt: (1021, 413)
eax=000011a5 ebx=00000000 ecx=00000000 edx=0007fde0 esi=0007fee8 edi=01014018
eip=7c90e512 esp=0007fde0 ebp=0007fdfc iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
ntdll!KiFastSystemCall+0x2:
7c90e512 0f34 sysenter