1

I want to create a simple http request with frida while hooking the function. With android 6, everything is ok, but when I try with android 11, there's a big prolem here:

Error: no supported overloads
at U (frida/node_modules/frida-java-bridge/lib/class-factory.js:484)
at value (frida/node_modules/frida-java-bridge/lib/class-factory.js:800)
at get (frida/node_modules/frida-java-bridge/lib/class-factory.js:696)
at get (frida/node_modules/frida-java-bridge/lib/class-factory.js:681)
at <anonymous> (/inject.js:52)
at <anonymous> (frida/node_modules/frida-java-bridge/lib/vm.js:16)
at perform (frida/node_modules/frida-java-bridge/index.js:193)
at make_custom_request (/inject.js:55)
at onEnter (/inject.js:42)

Here is the code:

var req = _uri + param;
Java.perform(function(){
    var OkHttpClient =  Java.use("com.android.okhttp.OkHttpClient");
    var Builder = Java.use("com.android.okhttp.Request$Builder").$new();     //error here
    var request = Builder.url(Java.use("java.lang.String").$new(req)).build();
    OkHttpClient.$new().newCall(request).execute();
});

I'm new with frida. Help me please.

Update I know this issue due to restriction on non-sdk interface mechanic in android 9+. So, how can i bypass this mechanic with frida?

5
  • Are you sure the app is the same of Android 6 and 11? Are you sure the requested class really exists in the app you have hooked with Frida? Extract it from device and decompile it e.g. using Jadx or apktool to see if the class you want to hook really exist. The class you requested only exists in pretty old OkHTTP versions, may be the app uses a newer version? Commented Nov 28, 2021 at 17:51
  • I use the same app for both of android version. I'm definitely sure that it has class "com.android.okhttp.Request$Builder". Commented Nov 29, 2021 at 7:20
  • Is the Android 11 device a real physical one or an emulator? Commented Nov 29, 2021 at 8:05
  • I use real physical device. Another things, when I getMethods(), It does't show all functions of class "com.android.okhttp.Request$Builder" in android 11, but android 6 does. Commented Nov 29, 2021 at 13:40
  • I also just had the case that certain classes are not visible to Frida but they are in the app (On an Android 9 and 11 device). It seems like those platforms no longer load all classes on start-up. Instead some classes are loaded later may be on-demand when a certain activity or service is started? At least I noticed that the classes I miss are accessible after opening a certain activity that makes use of them. Commented Dec 6, 2021 at 9:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.