调试器攻击技术 - Unhandled Exception Filter
来源:互联网 发布:淘宝优5元惠券模板 编辑:程序博客网 时间:2024/06/01 08:36
5、 Unhandled Exception Filter
MSDN文档声明当一个异常到达Unhandled Exception Filter(kernel32!UnhandledExceptionFilter)并且程序没有被调试时,Unhandled Exception Filter将会调用在kernel32!SetUnhandledExceptionFilter()API作为参数指定的高层exception Filter。壳利用了这一点,通过设置exception Filter然后抛出异常,如果程序被调试那么这个异常将会被调试器接收,否则,控制被移交到exception Filter运行得以继续。
示例
下面的示例中通过SetUnhandledExceptionFilter()设置了一个高层的exception Filter,然后抛出一个违规访问异常。如果进程被调试,调试器将收到两次异常通知,否则exception Filter将修改CONTEXT.EIP并继续执行。
;set the exception filter
push .exception_filter
call [SetUnhandledExceptionFilter]
mov [.original_filter],eax
;throw an exception
xor eax,eax
mov dword [eax],0
;restore exception filter
push dword [.original_filter]
call [SetUnhandledExceptionFilter]
:::
.exception_filter:
;EAX = ExceptionInfo.ContextRecord
mov eax,[esp+4]
mov eax,[eax+4]
;set return EIP upon return
add dword [eax+0xb8],6
;return EXCEPTION_CONTINUE_EXECUTION
mov eax,0xffffffff
retn
有些壳并不调用SetUnhandledExceptionFilter()而是直接通过kernel32!_BasepCurrentTopLevelFilter手工设置exception Filter,以防逆向分析人员在那个API上下断。
对策
有意思的是kernel32!UnhandledExceptionFilter()内部实现代码是使用ntdll!NtQueryInformationProcess(ProcessDebugPort)来确定进程是否被调试,从而决定是否调用已注册的exception Filter。因此,处理方法和DebugPort调试器检测技术相同。- 调试器攻击技术 - Unhandled Exception Filter
- 调试器攻击技术 - ThreadHideFromDebugger
- 调试器攻击技术 - ThreadHideFromDebugger
- unhandled exception
- Unhandled exception in XX.exe:oxc0000005:access violation 错误调试
- ASP.NET未处理异常(Unhandled Exception)调试试验
- ASP.NET未处理异常(Unhandled Exception)调试试验
- MFC调试出错:Unhandled exception in 0xC0000005:Access Violation
- vs2033安装遇到an unhandled exception has been caught by the vsw exception filter
- unhandled exception 错误
- Unhandled Exception thrown
- Struts2 unhandled exception
- unhandled exception type UnsupportedEncodingException
- MonoDevelop-Unity: Unhandled Exception
- Unhandled Exception: System.BadImageFormatException
- Unhandled exception type ParseException
- 解决XAML设计器中Unhandled Exception has occured
- 脱壳的艺术--5 调试器攻击技术
- 单链表是否存在环?
- OpenCV--cvSmooth函数
- 二分查找需要注意的地方~~~闭和开区间
- jQuery拖动div,移动div,弹出层
- 【Build 2014】Windows Phone 8.1 正式发布,今夜 WP 粉吐气扬眉
- 调试器攻击技术 - Unhandled Exception Filter
- jquery-validation 学习总结
- Android的GPS定位
- eclipse 提示 @Override must override a superclass method 问题解决
- C指针
- Android利用Logcat监听应用程序本身被卸载
- TNS-03505問題
- [LeetCode] Longest Consecutive Sequence
- emwin,关于模态