Skip to content

Commit

Permalink
Frida Windows: calling original UnhandledExceptionFilter in the hook (A…
Browse files Browse the repository at this point in the history
  • Loading branch information
expend20 authored Oct 13, 2022
1 parent 089bc49 commit bb3d6b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion libafl/src/bolts/os/windows_exceptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ use num_enum::TryFromPrimitive;
pub use windows::Win32::{
Foundation::NTSTATUS,
System::{
Diagnostics::Debug::{AddVectoredExceptionHandler, EXCEPTION_POINTERS},
Diagnostics::Debug::{
AddVectoredExceptionHandler, UnhandledExceptionFilter, EXCEPTION_POINTERS,
},
Threading::{IsProcessorFeaturePresent, PROCESSOR_FEATURE_ID},
},
};
Expand Down
5 changes: 3 additions & 2 deletions libafl_frida/src/windows_hooks.rs
Original file line number Diff line number Diff line change
@@ -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
use frida_gum::{interceptor::Interceptor, Gum, Module, NativePointer};
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
Expand Down Expand Up @@ -50,6 +51,6 @@ pub fn initialize(gum: &Gum) {
exception_pointers: *mut EXCEPTION_POINTERS,
) -> i32 {
handle_exception(exception_pointers);
unreachable!("handle_exception should not return");
UnhandledExceptionFilter(exception_pointers)
}
}

0 comments on commit bb3d6b3

Please sign in to comment.