在shelllwolf 的
反调试技巧总结-原理和实现中有一段int3/popf反调试:
__asm
{
push offset e_handler; set exception handler
push dword ptr fs:[0h]
mov dword ptr fs:[0h],esp
xor eax,eax;reset EAX invoke int3
int 3h
pushfd
nop
nop
nop
nop
pop dword ptr fs:[0h];restore exception handler
add esp,4
test eax,eax; check the flag
je rf_label
jmp rt_label
e_handler:
push offset e_handler1; set exception handler
push dword ptr fs:[0h]
mov dword ptr fs:[0h],esp
xor eax,eax;reset EAX invoke int3
int 3h
nop
pop dword ptr fs:[0h];restore exception handler
add esp,4
;EAX = ContextRecord
mov ebx,eax;dr0=>ebx
mov eax,dword ptr [esp+0xc]
;set ContextRecord.EIP
inc dword ptr [eax+0xb8];
mov dword ptr [eax+0xb0],ebx;dr0=>eax
xor eax,eax
retn
e_handler1:
;EAX = ContextRecord
mov eax,dword ptr [esp+0xc]
;set ContextRecord.EIP
inc dword ptr [eax+0xb8];
mov ebx,dword ptr[eax+0x04]
mov dword ptr [eax+0xb0],ebx;dr0=>eax
xor eax,eax
retn
rt_label:
xor eax,eax
inc eax
mov esp,ebp
pop ebp
retn
rf_label:
xor eax,eax
mov esp,ebp
pop ebp
retn
}
我在OllyICE上F9测试失败(没有hideod),跟直接运行一样
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)