monoxgas / sRDI

Shellcode implementation of Reflective DLL Injection. Convert DLLs to position independent shellcode
Other
2.12k stars 459 forks source link

Exception handling #19

Open funkdubi opened 3 years ago

funkdubi commented 3 years ago

Hey, I'm using your library to load a test compiled DLL as shellcode. To load I'm using the Native loader. everything was compiled using v141 toolset in VS2017. The function does something simple and just echoes back a formatted string to OutputDebugString. Inside the function I've added a throw of std::exception and I'm not catching it in the respective catch clause or any other catch clause other than the ellipsis catch handler. The compiled code and shellcode are all x64 and it runs well aside from exception handling, which I saw the shellcode adds via a call to RtlAddFunctionTable. Would love to hear what is done wrong in trying to catch the exception. Whether I need to add a hack to parse the exception structure or something the shellcode RDI needs to do to be able to handle specific exceptions.

monoxgas commented 3 years ago

Thanks for reporting, this could be related to https://github.com/monoxgas/sRDI/issues/21 as well.

Off the top of my head: I know there are a few different exception handling modes you can compile with (Eh* flags?)

I don't have a ton of bandwidth (obviously given the late response), but I'll find some time to look at both of these. If you figure anything else out, feel free to add.