拿到pCode的程序首先想到的就是用exec、VBExplorer静态反汇编,以备心中有数
之后WKTVVBdebug跟踪,详析。
我的目的:更改事件代码的位置从而有效Anti静态反汇编,什么?用WKTVVBdebug跟踪?
看着大篇幅的代码又不能复制,跳来跳去,烦死你......呵呵
如果找到规律再写个混乱器之类的东西就更好了!
代码:
***********************************************************
Private Sub Command1_Click()
Dim a, b As Integer
there:
a = 1
b = 5
If a + b = 3 Then
GoTo there: '死循环,是为了看 jmp 向上跳的机器码
End If
End Sub
Private Sub Timer1_Timer()
If Label1.ForeColor = &HCC Then
Label1.ForeColor = &HFF0000
Else
Label1.ForeColor = &HCC
End If
End Sub
***********************************************************
VbExplorer V1.01反汇编后的代码
[Timer1.Timer]
:00401A98 0474FF FLdRfVar ;Push LOCAL_008C
1A98是事件的起始代码
:00401A9B 21 FLdPrThis ;[SR]=[stack2]
:00401A9C 0F0403 VCallAd ;Return the control index 03
:00401A9F 1978FF FStAdFunc ;
:00401AA2 0878FF FLdPr ;[SR]=[LOCAL_0088]
***********Reference To:[propget]Label.ForeColor
|
:00401AA5 0D68000000 VCallHresult ;Call ptr_00401474
:00401AAA 6C74FF ILdRf ;Push DWORD [LOCAL_008C]
:00401AAD F5CC000000 LitI4 ;Push 000000CC
:00401AB2 C7 EqI4 ;Push (Pop1 == Pop2)
:00401AB3 1A78FF FFree1Ad ;Push [LOCAL_0088]; Call [[[LOCAL_0088]]+8]; [[LOCAL_0088]]=0
:00401AB6 1C3B00 BranchF ;If Pop=0 then ESI=00401AD3
:00401AB9 F50000FF00 LitI4 ;Push 00FF0000
:00401ABE 21 FLdPrThis ;[SR]=[stack2]
:00401ABF 0F0403 VCallAd ;Return the control index 03
:00401AC2 1978FF FStAdFunc ;
:00401AC5 0878FF FLdPr ;[SR]=[LOCAL_0088]
***********Reference To:[propput]Label.ForeColor
|
:00401AC8 0D6C000000 VCallHresult ;Call ptr_00401474
:00401ACD 1A78FF FFree1Ad ;Push [LOCAL_0088]; Call [[[LOCAL_0088]]+8]; [[LOCAL_0088]]=0
:00401AD0 1E5200 Branch ;ESI=00401AEA
:00401AD3 F5CC000000 LitI4 ;Push 000000CC
:00401AD8 21 FLdPrThis ;[SR]=[stack2]
:00401AD9 0F0403 VCallAd ;Return the control index 03
:00401ADC 1978FF FStAdFunc ;
:00401ADF 0878FF FLdPr ;[SR]=[LOCAL_0088]
***********Reference To:[propput]Label.ForeColor
|
:00401AE2 0D6C000000 VCallHresult ;Call ptr_00401474
:00401AE7 1A78FF FFree1Ad ;Push [LOCAL_0088]; Call [[[LOCAL_0088]]+8]; [[LOCAL_0088]]=0
:00401AEA 13 ExitProcHresult ;
在1C10处找到一大块空地(导入表后面)
1C10-1A98=178
Branch机器码1EXXXX(低位在前)
将00401A98--00401AEA的代码贴到1C10处
将00401A98的机器码由0474FF改为1E7801(让她跳到新地址去运行)
现在将00401A9B--00401AEA的代码全码改乱,我改为00(好像是pCode的NOP)
再次运行发现程序运行异常(表现为只自动更改一次label1的颜色)
再次跟踪发现程序00401AB6跳到00401AD3运行,看来是又跳回来了
00401AD3--00401AEA都已改为00(NOP)所以最后只有执行ExitProcHresult
重新恢复00401AD3--00401AEA处的原始代码,这样程序又跑起来了
代码:
:00401A98 1E7801 Branch ;ESI=00401C10
:00401A9B 0000 LargeBos ;IDE beginning of line with 00 byte codes
:00401A9D 0000 LargeBos ;IDE beginning of line with 00 byte codes
:00401A9F 0000 LargeBos ;IDE beginning of line with 00 byte codes
......(这段nop可以改为其它pCode指令,反正也不走这,一眼看去,乱......呵呵)
:00401AD1 0000 LargeBos ;IDE beginning of line with 00 byte codes
:00401AD3 F5CC000000 LitI4 ;Push 000000CC
:00401AD8 21 FLdPrThis ;[SR]=[stack2]
:00401AD9 0F0403 VCallAd ;Return the control index 03
:00401ADC 1978FF FStAdFunc ;
:00401ADF 0878FF FLdPr ;[SR]=[LOCAL_0088]
***********Reference To:[propput]Label.ForeColor
|
:00401AE2 0D6C000000 VCallHresult ;Call ptr_00401474
:00401AE7 1A78FF FFree1Ad ;Push [LOCAL_0088]; Call [[[LOCAL_0088]]+8]; [[LOCAL_0088]]=0
:00401AEA 13 ExitProcHresult ;
只有部分代码移植成功,我们的修改没完全达到目的
00401AB6 1C3B00 BranchF ;If Pop=0 then ESI=00401AD3
003B=59(Dec),正是Timer1.Timer起始地址00401A98-->00401AD3的距离+1
看来这个是相对跳转,我想可能是在Timer1.Timer事件执行前pCode引擎已经将Timer1.Timer的起始地址压入
堆栈了,是不是只有重定位才能搞定?pCode的重定位又该始何操作?
附件:Project.rar 附件:Project.rar
[培训]科锐逆向工程师培训第53期2025年7月8日开班!