Structured Exception Handler Exploitation
Structured Exception Handler Exploitation
http://www.htbridge.ch/
Brian Mariani
What is an exception
An exception is an event that occurs during the execution of a program Requires the execution of code outside the normal flow of control
The exception handlers are linked to each other They form a linked list chain on the stack, and sit relatively close to the bottom of the stack When an exception occurs, Windows retrieves the head of the SEH chain walks through the list and tries to find the suitable handler to close the application properly
When we performs a regular stack based buffer overflow, we overwrite the return address of the Extended Instruction Pointer (EIP) When doing a SEH overflow, we will continue overwriting the stack after overwriting overflow EIP, so we can overwrite the default exception handler as well EIP
TIB dumping let us know the SEH chain was sucessfully overwritten
Shellcode execution
Time to dance
Questions
References
http://msdn.microsoft.com/en-us/library/ms680663%28v=VS.85%29.aspx http://msdn.microsoft.com/en-us/library/c68xfk56%28v=vs.71%29.aspx http://en.wikipedia.org/wiki/Win32_Thread_Information_Block http://corelan.be