Frida Windows: calling original UnhandledExceptionFilter in the hook (#832)

This commit is contained in:
expend20 2022-10-13 09:06:15 +02:00 committed by GitHub
parent 089bc49d55
commit bb3d6b3688
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -14,7 +14,9 @@ use num_enum::TryFromPrimitive;
pub use windows::Win32::{ pub use windows::Win32::{
Foundation::NTSTATUS, Foundation::NTSTATUS,
System::{ System::{
Diagnostics::Debug::{AddVectoredExceptionHandler, EXCEPTION_POINTERS}, Diagnostics::Debug::{
AddVectoredExceptionHandler, UnhandledExceptionFilter, EXCEPTION_POINTERS,
},
Threading::{IsProcessorFeaturePresent, PROCESSOR_FEATURE_ID}, Threading::{IsProcessorFeaturePresent, PROCESSOR_FEATURE_ID},
}, },
}; };

View File

@ -1,7 +1,8 @@
// Based on the example of setting hooks: Https://github.com/frida/frida-rust/blob/main/examples/gum/hook_open/src/lib.rs // Based on the example of setting hooks: Https://github.com/frida/frida-rust/blob/main/examples/gum/hook_open/src/lib.rs
use frida_gum::{interceptor::Interceptor, Gum, Module, NativePointer}; use frida_gum::{interceptor::Interceptor, Gum, Module, NativePointer};
use libafl::bolts::os::windows_exceptions::{ use libafl::bolts::os::windows_exceptions::{
handle_exception, IsProcessorFeaturePresent, EXCEPTION_POINTERS, PROCESSOR_FEATURE_ID, handle_exception, IsProcessorFeaturePresent, UnhandledExceptionFilter, EXCEPTION_POINTERS,
PROCESSOR_FEATURE_ID,
}; };
/// Initialize the hooks /// Initialize the hooks
@ -50,6 +51,6 @@ pub fn initialize(gum: &Gum) {
exception_pointers: *mut EXCEPTION_POINTERS, exception_pointers: *mut EXCEPTION_POINTERS,
) -> i32 { ) -> i32 {
handle_exception(exception_pointers); handle_exception(exception_pointers);
unreachable!("handle_exception should not return"); UnhandledExceptionFilter(exception_pointers)
} }
} }