Skip to content

Commit af06d75

Browse files
authored
frida: bump version (#2640)
* frida: bump version * frida_windows: fix
1 parent 83c87ac commit af06d75

File tree

8 files changed

+17
-28
lines changed

8 files changed

+17
-28
lines changed

fuzzers/binary_only/frida_executable_libpng/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ libafl = { path = "../../../libafl", features = [
2525
"frida_cli",
2626
] } #, "llmp_small_maps", "llmp_debug"]}
2727
libafl_bolts = { path = "../../../libafl_bolts" }
28-
frida-gum = { version = "0.14.2", features = [
28+
frida-gum = { version = "0.15.1", features = [
2929
"auto-download",
3030
"event-sink",
3131
"invocation-listener",

fuzzers/binary_only/frida_libpng/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ libafl = { path = "../../../libafl", features = [
2626
"errors_backtrace",
2727
] } #, "llmp_small_maps", "llmp_debug"]}
2828
libafl_bolts = { path = "../../../libafl_bolts" }
29-
frida-gum = { version = "0.14.2", features = [
29+
frida-gum = { version = "0.15.1", features = [
3030
"auto-download",
3131
"event-sink",
3232
"invocation-listener",

fuzzers/binary_only/frida_windows_gdiplus/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ libafl = { path = "../../../libafl", features = [
2323
"errors_backtrace",
2424
] } #, "llmp_small_maps", "llmp_debug"]}
2525
libafl_bolts = { path = "../../../libafl_bolts" }
26-
frida-gum = { version = "0.14.2", features = [
26+
frida-gum = { version = "0.15.1", features = [
2727
"auto-download",
2828
"event-sink",
2929
"invocation-listener",

libafl_frida/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ nix = { workspace = true, default-features = true, features = ["mman"] }
6666
libc = { workspace = true }
6767
hashbrown = { workspace = true, default-features = true }
6868
rangemap = { workspace = true }
69-
frida-gum-sys = { version = "0.14.2", features = [
69+
frida-gum-sys = { version = "0.15.1", features = [
7070
"event-sink",
7171
"invocation-listener",
7272
] }
73-
frida-gum = { version = "0.14.2", features = [
73+
frida-gum = { version = "0.15.1", features = [
7474
"event-sink",
7575
"invocation-listener",
7676
"module-names",

libafl_frida/src/asan/asan_rt.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,13 +476,14 @@ impl AsanRuntime {
476476
#[allow(clippy::too_many_lines)]
477477
pub fn register_hooks(&mut self, gum: &Gum) {
478478
let mut interceptor = Interceptor::obtain(gum);
479+
let module = Module::obtain(gum);
479480
macro_rules! hook_func {
480481
//No library case
481482
($name:ident, ($($param:ident : $param_type:ty),*), $return_type:ty) => {
482483
paste::paste! {
483484
log::trace!("Hooking {}", stringify!($name));
484485

485-
let target_function = frida_gum::Module::find_export_by_name(None, stringify!($name)).expect("Failed to find function");
486+
let target_function = module.find_export_by_name(None, stringify!($name)).expect("Failed to find function");
486487

487488
static [<$name:snake:upper _PTR>]: std::sync::OnceLock<extern "C" fn($($param: $param_type),*) -> $return_type> = std::sync::OnceLock::new();
488489

@@ -522,7 +523,7 @@ impl AsanRuntime {
522523
paste::paste! {
523524
log::trace!("Hooking {}:{}", $lib, stringify!($name));
524525

525-
let target_function = frida_gum::Module::find_export_by_name(Some($lib), stringify!($name)).expect("Failed to find function");
526+
let target_function = module.find_export_by_name(Some($lib), stringify!($name)).expect("Failed to find function");
526527

527528
static [<$lib_ident:snake:upper _ $name:snake:upper _PTR>]: std::sync::OnceLock<extern "C" fn($($param: $param_type),*) -> $return_type> = std::sync::OnceLock::new();
528529

@@ -564,7 +565,7 @@ impl AsanRuntime {
564565
($name:ident, ($($param:ident : $param_type:ty),*), $return_type:ty) => {
565566
paste::paste! {
566567
log::trace!("Hooking {}", stringify!($name));
567-
let target_function = frida_gum::Module::find_export_by_name(None, stringify!($name)).expect("Failed to find function");
568+
let target_function = module.find_export_by_name(None, stringify!($name)).expect("Failed to find function");
568569

569570
static [<$name:snake:upper _PTR>]: std::sync::OnceLock<extern "C" fn($($param: $param_type),*) -> $return_type> = std::sync::OnceLock::new();
570571

@@ -604,7 +605,7 @@ impl AsanRuntime {
604605
($lib:literal, $lib_ident:ident, $name:ident, ($($param:ident : $param_type:ty),*), $return_type:ty) => {
605606
paste::paste! {
606607
log::trace!("Hooking {}:{}", $lib, stringify!($name));
607-
let target_function = frida_gum::Module::find_export_by_name(Some($lib), stringify!($name)).expect("Failed to find function");
608+
let target_function = module.find_export_by_name(Some($lib), stringify!($name)).expect("Failed to find function");
608609

609610
static [<$lib_ident:snake:upper _ $name:snake:upper _PTR>]: std::sync::OnceLock<extern "C" fn($($param: $param_type),*) -> $return_type> = std::sync::OnceLock::new();
610611

@@ -693,7 +694,7 @@ impl AsanRuntime {
693694
macro_rules! hook_heap_windows {
694695
($libname:literal, $lib_ident:ident) => {
695696
log::info!("Hooking allocator functions in {}", $libname);
696-
for export in Module::enumerate_exports($libname) {
697+
for export in module.enumerate_exports($libname) {
697698
// log::trace!("- {}", export.name);
698699
match &export.name[..] {
699700
"NtGdiCreateCompatibleDC" => {
@@ -919,7 +920,7 @@ impl AsanRuntime {
919920
macro_rules! hook_cpp {
920921
($libname:literal, $lib_ident:ident) => {
921922
log::info!("Hooking c++ functions in {}", $libname);
922-
for export in Module::enumerate_exports($libname) {
923+
for export in module.enumerate_exports($libname) {
923924
match &export.name[..] {
924925
"_Znam" => {
925926
hook_func!($libname, $lib_ident, _Znam, (size: usize), *mut c_void);

libafl_frida/src/executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ where
187187
// Include the current module (the fuzzer) in stalked ranges. We clone the ranges so that
188188
// we don't add it to the INSTRUMENTED ranges.
189189
let mut ranges = helper.ranges().clone();
190-
for module in frida_gum::Module::enumerate_modules() {
190+
for module in frida_gum::Module::obtain(gum).enumerate_modules() {
191191
if module.base_address < Self::new as usize
192192
&& (Self::new as usize) < module.base_address + module.size
193193
{

libafl_frida/src/helper.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::{
1010
use frida_gum::{
1111
instruction_writer::InstructionWriter,
1212
stalker::{StalkerIterator, StalkerOutput, Transformer},
13-
Backend, Gum, Module, ModuleDetails, ModuleMap, PageProtection, Script,
13+
Backend, Gum, ModuleDetails, ModuleMap, Script,
1414
};
1515
use frida_gum_sys::gchar;
1616
use libafl::{
@@ -415,19 +415,6 @@ pub unsafe extern "C" fn test_function(message: *const gchar) {
415415
}
416416
}
417417

418-
/// Helper function to get the size of a module's CODE section from frida
419-
#[must_use]
420-
pub fn get_module_size(module_name: &str) -> usize {
421-
let mut code_size = 0;
422-
let code_size_ref = &mut code_size;
423-
Module::enumerate_ranges(module_name, PageProtection::ReadExecute, move |details| {
424-
*code_size_ref = details.memory_range().size();
425-
true
426-
});
427-
428-
code_size
429-
}
430-
431418
fn pathlist_contains_module<I, P>(list: I, module: &ModuleDetails) -> bool
432419
where
433420
I: IntoIterator<Item = P>,

libafl_frida/src/windows_hooks.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ unsafe extern "C" fn unhandled_exception_filter_detour(
2121
}
2222
/// Initialize the hooks
2323
pub fn initialize(gum: &Gum) {
24+
let module = Module::obtain(gum);
2425
let is_processor_feature_present =
25-
Module::find_export_by_name(Some("kernel32.dll"), "IsProcessorFeaturePresent");
26+
module.find_export_by_name(Some("kernel32.dll"), "IsProcessorFeaturePresent");
2627
let is_processor_feature_present = is_processor_feature_present.unwrap();
2728
assert!(
2829
!is_processor_feature_present.is_null(),
2930
"IsProcessorFeaturePresent not found"
3031
);
3132
let unhandled_exception_filter =
32-
Module::find_export_by_name(Some("kernel32.dll"), "UnhandledExceptionFilter");
33+
module.find_export_by_name(Some("kernel32.dll"), "UnhandledExceptionFilter");
3334
let unhandled_exception_filter = unhandled_exception_filter.unwrap();
3435
assert!(
3536
!unhandled_exception_filter.is_null(),

0 commit comments

Comments
 (0)