frida-mono-api icon indicating copy to clipboard operation
frida-mono-api copied to clipboard

MonoApi.mono_compile_method timeout

Open bakabird opened this issue 1 year ago • 4 comments

Environment: macOS 14.0 CPU: Apple M2 Model: MacBook Air Frida Version: 16.1.4

I'm executing the command frida AGame -l myscript.js, but every time the JavaScript script runs MonoApi.mono_compile_method(method), the script gets stuck. After more than a minute, it prints:

Failed to load script: timeout was reached

Is there a solution?

bakabird avatar Oct 16 '23 12:10 bakabird

Guess you have to look into the underlaying mono documentation and use the debugger to get into this issue :/ http://docs.go-mono.com/index.aspx?link=xhtml%3Adeploy%2Fmono-api-unsorted.html https://github.com/mono/mono/blob/main/mono/metadata/object.c#L773

freehuntx avatar Oct 16 '23 21:10 freehuntx

Guess you have to look into the underlaying mono documentation and use the debugger to get into this issue :/ http://docs.go-mono.com/index.aspx?link=xhtml%3Adeploy%2Fmono-api-unsorted.html https://github.com/mono/mono/blob/main/mono/metadata/object.c#L773

Thanks, but how to debug the mono-api call on a running Game that builded by Unity. Should i hack the mono-api functions like mono_compile_method inside the dylib/dll of mono-embed? Adding some output?

bakabird avatar Oct 17 '23 06:10 bakabird

According to https://github.com/Misaka-Mikoto-Tech/MonoHook#%E5%8E%9F%E7%90%86, it say that MethodInfo.MethodHandle.GetFunctionPointer().ToPointer() can return the jit_address of method. Can it be a replacement for MonoApi.mono_compile_method?

bakabird avatar Oct 17 '23 09:10 bakabird

According to https://github.com/Misaka-Mikoto-Tech/MonoHook#%E5%8E%9F%E7%90%86, it say that MethodInfo.MethodHandle.GetFunctionPointer().ToPointer() can return the jit_address of method. Can it be a replacement for MonoApi.mono_compile_method?

Well, it seems infeasible... the class and method to get MethodInfo still need mono-api to fetch the jit-addres to be called ...

bakabird avatar Oct 18 '23 00:10 bakabird