SEH

When SEH is used there is a registration process where an exception structure is
created for every function as a local variable. The last field of the structure overlaps the
location where frame pointer EBP points. Function's prologue creates this structure on
its stack frame and registers it with the operating system at runtime. The significance of
this is that the pointer to the exception handler and the pointer to the Next exception
handler are both stored on the stack in the program function’s local variables section of
its stack frame.

 

参考:http://rogunix.com/docs/Reversing&Exploiting/Understanding%20SEH%20Exploitation.pdf

 

SEH Record会作为局部变量存放在栈中,或者说它与局部变量在栈中相邻存放,先存放SEH Record,再存放局部变量。

 

When an exception occurs in a program function, the system exception dispatcher
routine runs and sets up its own stack frame.While doing so, it will push elements of
this Exception Handler structure onto the stack since this is part of a function prologue to
execute the exception code. Keep in mind that this is a separate stack used for the
exception dispatcher and not directly related to the program stack that we overwrote with
the buffer.

 

当异常发生时,SEH的Handler并不会在当前程序的栈环境中执行,而是会使用独立的栈,在这个栈中,esp+8的位置上保存着指向SEH Record的指针,所以这就是为什么需要

PPR(pop;pop;ret)的原因了。

 

 

 

 

 

转载于:https://www.cnblogs.com/long123king/p/3834125.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值