icesword120反调试分析

is为了防止被逆向工程,做了许多反调试的工作。用户态的反调试很简单,玩过破解的一看就明白,主要

对用户态的反调试做了一些分析,主要有以下几个地方:


//这里作了一个反调试,如果是单步,将在0x000120E2上蓝屏,蓝屏信息为0x0000007F(a,b,c,d)
//但stosd指令是将eax的值存入edi中,为何会调用函数???
//此时eax=0xFFDFF124,为当前进程的PEB,下面将这个值修改为0xFFDFF124,则其他函数调用时产生错误
//如果不是单步,则在000120D7处跳转
//.text:000120CB      mov     eax, [esp+60h+var_70]和.text:000120D0   mov     eax, [esp+64h+var_70]
//在不调试的时候的值为0或-1(发现一次,其他时候都为0),只有在调试的时候才会真正得到堆栈中的值。

.text:00012099                 mov     eax, [ebp+Irp]
.text:0001209C                 and     dword ptr [eax+18h], 0
.text:000120A0                 mov     eax, [ebp+Irp]
.text:000120A3                 and     dword ptr [eax+1Ch], 0
.text:000120A7                 mov     eax, [ebp+Irp]
.text:000120AA                 mov     eax, [eax+60h]
.text:000120AD                 mov     [ebp+var_28], eax
.text:000120B0                 mov     eax, [ebp+var_28]
.text:000120B3                 mov     eax, [eax+8]
.text:000120B6                 mov     [ebp+var_1C], eax
.text:000120B9                 mov     eax, [ebp+var_28]
.text:000120BC                 mov     eax, [eax+4]
.text:000120BF                 mov     [ebp+var_34], eax
.text:000120C2                 mov     eax, [ebp+var_28]
.text:000120C5                 mov     eax, [eax+0Ch]
.text:000120C8                 mov     [ebp+var_30], eax
.text:000120CB                 mov     eax, [esp+60h+var_70]
.text:000120CF                 push    eax
.text:000120D0                 mov     eax, [esp+64h+var_70]
.text:000120D4                 pop     ebx
.text:000120D5                 cmp     eax, ebx
.text:000120D7                 jz      short loc_120E3
.text:000120D9                 mov     eax, 200EDBh    ; 如果没有(单步)调试将在前面跳转,以下操作将蓝屏,
.text:000120DE                 not     eax  ;此时eax=0xFFDFF124,为当前进程的PEB,下面将这个值修改为0xFFDFF124,则其他函数调用时产生错误
.text:000120E0                 push    eax
.text:000120E1                 pop     edi
.text:000120E2                 stosd
.text:000120E3

//icesword的反内核调试检测代码
//原理很简单
.text:000192BC sub_192BC       proc near               ;
.text:000192BC                 push    ds:KdDebuggerEnabled ; VirtualAddress
.text:000192C2                 call    ds:MmIsAddressValid
.text:000192C8                 test    al, al
.text:000192CA                 jz      short locret_192DD
.text:000192CC
.text:000192CC loc_192CC:                              ;
.text:000192CC                 mov     eax, ds:KdDebuggerEnabled
.text:000192D1                 cmp     byte ptr [eax], 0
.text:000192D4                 jmp     short locret_192DD ; 被修改过了???
.text:000192D6 ; ---------------------------------------------------------------------------
.text:000192D6                 call    KdDisableDebugger
.text:000192DB                 jmp     short loc_192CC
.text:000192DD ; ---------------------------------------------------------------------------
.text:000192DD
.text:000192DD locret_192DD:                           ;
.text:000192DD                                         ;
.text:000192DD                 retn
.text:000192DD sub_192BC       endp

//这里故意做了一个异常,使得调试器退出,
//网上(wuyanfeng)说的,不知道是为什么
.text:00012248                 mov     [ebp+var_38], eax
.text:0001224B                 cmp     [ebp+var_38], 0
.text:0001224F                 jl      loc_123A6
.text:00012255                 and     [ebp+var_4], 0
.text:00012259                 push    1               ; Alignment
.text:0001225B                 push    40h             ; Length
.text:0001225D                 push    ds:dword_34780  ; Address
.text:00012263                 call    ds:ProbeForRead


//用int 1作异常,用于反调试
.text:000122F4                 call    sub_197D8
.text:000122F9                 int     1               ; - internal hardware - SINGLE-STEP
.text:000122F9                                         ; generated at end of each machine instruction if TF bit in FLAGS is set
.text:000122F9 ; ---------------------------------------------------------------------------
.text:000122FB                 db 0EAh
.text:000122FC                 db  4Dh ;
.text:000122FD                 db 0EBh ;
.text:000122FE                 db  93h ;
.text:000122FF                 db  67h ;
.text:00012300                 db 0E9h ;
.text:00012301                 db 0FFh
.text:00012302                 dw 0EAE3h
.text:00012304                 db 0E0h, 0EBh
.text:00012306                 dw 0E9A6h
.text:00012308                 db 0CFh ;
.text:00012309                 db 0CEh ;
.text:0001230A                 db  83h ;
.text:0001230B                 db 0EBh ;
.text:0001230C                 db 0E9h ;
.text:0001230D ; ---------------------------------------------------------------------------
.text:0001230D                 push    0
.text:0001230F                 call    KeSetKernelStackSwapEnable

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值