-
-
Notifications
You must be signed in to change notification settings - Fork 155
[CONT] android: Support ART w/o copied_methods_offset_ #379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/support-newer-art-without-copied-methods-offset
Are you sure you want to change the base?
Conversation
|
Got an error on app spawn with script:
|
|
Thank you for doing this! 🎉
This is likely caused by frida-tools' bundled frida-java-bridge not having the changes needed. With your changes, are you also seeing this crash when one of the system_server agent hooks gets hit? (One of the two in |
lib/android.js
Outdated
| // Ensure class is loaded by prematurely calling Class::getName() | ||
| const jniClassName = className.replace(/\./g, '/'); | ||
| const clazz = env.findClass(jniClassName); | ||
| const javaLangClass = env.findClass("java/lang/Class"); | ||
| const getNameId = env.getMethodId(javaLangClass, "getName", "()Ljava/lang/String;"); | ||
|
|
||
| env.callObjectMethodA(clazz, getNameId, ptr(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Ensure class is loaded by prematurely calling Class::getName() | |
| const jniClassName = className.replace(/\./g, '/'); | |
| const clazz = env.findClass(jniClassName); | |
| const javaLangClass = env.findClass("java/lang/Class"); | |
| const getNameId = env.getMethodId(javaLangClass, "getName", "()Ljava/lang/String;"); | |
| env.callObjectMethodA(clazz, getNameId, ptr(0)); | |
| env.getClassName(classRef); |
Should have the same effect, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, looks like it. I didn't even see that helper. I was wondering where all the JNI functions for method calls were 😅
|
By the way, just pushed the missing piece to get hooking working on my device, in 4a4970b. |
100% this was the problem, which I realized while I was in bed... 😅. Anyway, I'm not getting that crash,
Edit: ignore the previous log, everything seems to work fine when swapping out |
|
I'm doing some tests with this too. This PR gets my gadget running again and hooking methods correctly printing results that look correct so far. Edit: I've distributed it to the masses for further testing. So far no complaints. |
It's because |
|
Good news by the way: I've just removed the system_server agent from frida-core, so frida-java-bridge is no longer a dependency there. We now use frida-helper.dex, implemented in Java. It was previously only used on non-rooted Android, but I've split it out and added the extra functionality that we need on rooted Android. |
edit 2: working now? no idea, not going to question it at the moment |
|
@hoo-dles Oops! I've pushed some improvements that should make it clear exactly why in case it fails on you again. |
This is an attempt at a completion of #378 to resolve the issues mentioned by @oleavr.
As stated in the comments of the other PR, I'm not sure if this is even a valid approach. I initially was trying to call
Class.ForName()with the explicitinitializebool, but I think it triggered a deadlock somewhere. Switching to the lighter instance methodgetName()doesn't seem to have this issue.I'm able to build, run, and interact with frida-server on Android 16, but I'm 99% sure there's something wrong with this PR.