首页
社区
课程
招聘
[分享]od窗口函数地址修正
2014-2-19 13:30 6420

[分享]od窗口函数地址修正

2014-2-19 13:30
6420
具体原因参考:
http://bbs.pediy.com/showthread.php?t=121113&highlight=ClsProc
http://invlpg.blogspot.com/2010/04/ollydbg-gets-wrong-clsproc.html

摘录问题及解决方案:


OllyDbg uses GetClassLongA to retrieve ClassProc.

On most ansi windows this works fine, but on unicode ones not.

GetClassLongA will return a magic cookie which looks like FFFF1234

instead of the real procedure address.

You can patch Olly by replacing GetClassLongA with GetClassLongW to see the difference:

some values used to be FFFF1234 became meaningful pointers, and vice versa.

here is the solution:

ClsProc = GetClassLongA(hWnd, GCL_WNDPROC)
if ClsProc & 0x80000000:
 ClsProc = GetClassLongW(hWnd, GCL_WNDPROC)


修改过程:
在用OD加载OD,然后在GetClassLongA下断,找到调用GetClassLongA的地方,在此段尾部找一块空白处,打如下补丁:

004AF7DD   $  FF7424 08     push dword ptr ss:[esp+0x8]              ; /Index;复制参数栈
004AF7E1   .  FF7424 08     push dword ptr ss:[esp+0x8]              ; |hWnd
004AF7E5   .  E8 36FCFFFF   call <jmp.&USER32.GetClassLongA>         ; \GetClassLongA
004AF7EA   .  25 00000080   and eax,0x80000000 ;是否是Unicode Window
004AF7EF   .- 0F85 04C98677 jnz USER32.GetClassLongW
004AF7F5   .  C2 0800       retn 0x8


然后将所有对GetClassLongA的调用修改为调用此函数。
此处GetClassLongW使用的是硬编码,不想搞IAT,所以就不上传二进制文件了。




[培训]二进制漏洞攻防(第3期);满10人开班;模糊测试与工具使用二次开发;网络协议漏洞挖掘;Linux内核漏洞挖掘与利用;AOSP漏洞挖掘与利用;代码审计。

上传的附件:
收藏
点赞0
打赏
分享
最新回复 (3)
雪    币: 3682
活跃值: (891)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
daohaodaye 2014-4-5 00:46
2
0
没能搞明白概念,楼主能否写清楚些呢?
雪    币: 270
活跃值: (47)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
newice 2014-4-14 11:49
3
0
高手写个插件修复一下吧
雪    币: 102
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
略输文采 2014-6-7 02:08
4
0
刚写了一个插件,DELPHI写的,有点大80多K。 发上去大家试下吧。

http://bbs.pediy.com/showthread.php?p=1291065
上传的附件:
游客
登录 | 注册 方可回帖
返回