Skip to content

Function previously hooked then no longer intercepted #319

Open

Description

@Trakeur

Hi everyone,

I'm using Frida since 1 week to hook function at runtime in an android app. In my case I need to intercept function from okhttp3 lib to analyze network request. Everything was working well with the following code :
var OkHttpClient = Java.use('okhttp3.OkHttpClient') OkHttpClient.newCall.overload("okhttp3.Request").implementation = function (request) { console.log("Catching request...") ... return this.newCall(request); }
So I was able to analyze request object (url, method...). But without changing anything (maybe reload frida-server) the "newCall" method is no longer intercepted. Note that my script is correctly injected and run with some other functions getting hooked.

Could it be something related with thread ? Or some sort of obfuscation (the app has indeed some sort of lib minification) ?

Also the requests that I want to catch are at app's startup, so I guess it could be the problem. (I tried launch app with -f package without resolution...). I'm able to catch some request that are after app startup.

Activity

  1. Trakeur commented on May 22, 2024

    @Trakeur
    Author

    Also note that everything is executed inside Java.perform(function() {...} and I tried with setTimeout(function() { }.

  2. Trakeur commented on May 22, 2024

    @Trakeur
    Author

    For those of you who would face the same problem, I bypass it by reimplementing the RequestBuilder.build() method. I have something like :
    var RequestBuilder = Java.use('okhttp3.Request$Builder'); RequestBuilder.build.implementation = function(... args) { var request = this.build(...args); ... return request
    It allows me to modify the request before being sent to server.
    I'm still curious why the previous implementation with OkHttpClient didn't work anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions