frida / frida-java-bridge

Java runtime interop from Frida
330 stars 125 forks source link

Error: access violation accessing 0x0 when calling Java.enumerateLoadedClasses() or Java.choose() #42

Closed StefaanSeys closed 7 years ago

StefaanSeys commented 7 years ago

Hello,

When executing the following simple scripts

Java.perform(function () {   
        Java.enumerateLoadedClasses({
            onMatch: function(className){
                console.log(className)
            },
            onComplete:function(){
            }
    });
});

I get this error:

{'type': 'error', 
'description': 'Error: access violation accessing 0x0', 
'stack': 'Error: access violation accessing 0x0
    at v (frida/node_modules/frida-java/index.js:233)
    at frida/node_modules/frida-java/index.js:105
    at [anon] (script1.js:10)
    at frida/node_modules/frida-java/index.js:266
    at call (native)
    at dispatchMessage (input:1)', 'fileName': 'frida/node_modules/frida-java/index.js', 'lineNumber': 233, 'columnNumber': 1}

I get the same issue when calling Java.choose().

Versions used:

StefaanSeys commented 7 years ago

I have updated my test platform to Android 4.4.4 (Cyanogenmod 11) and now the exact same script does work with both Frida versions. This issue can be closed.

Myonium commented 7 years ago

There seems to be an issue with Android 4.3 Test set: Samsung 3 Android 4.3 Frida-Server: frida-server-10.6.2-android-arm Frida-Client: frida 10.6.3

On executing: Java.perform(function () { Java.enumerateLoadedClasses({ onMatch: function(className){ console.log(className) }, onComplete:function(){ } }); }); I receive the following error: Error: access violation accessing 0x0 at v (frida/node_modules/frida-java/index.js:232) at frida/node_modules/frida-java/index.js:105 at [anon] (input:8) at frida/node_modules/frida-java/lib/vm.js:39 at frida/node_modules/frida-java/index.js:281 at eval (input:9) at eval (native) at repl1.js:4 at apply (native) [...]

audebert commented 7 years ago

Same issue on:

Code:

jscode = """
setTimeout(function(){
    Java.enumerateLoadedClasses({
        onMatch: function(className) {
            send(className);
        },
        onComplete: function() { }
    });
}, 0);
"""

script = process.create_script(jscode)
script.on('message', on_message)
script.load()

Error message: {'lineNumber': 229, 'fileName': 'frida/node_modules/frida-java/index.js', 'description': 'Error: access violation accessing 0x0', 'stack': 'Error: access violation accessing 0x0\n at v (frida/node_modules/frida-java/index.js:229)\n at frida/node_modules/frida-java/index.js:108\n at [anon] (script1.js:9)\n at frida/runtime/core.js:57', 'type': 'error', 'columnNumber': 1}

audebert commented 7 years ago

Actually this is a duplicate of #7

enovella commented 6 years ago

Same here with latest Frida and r2frida :(

Unhandled message: {"type":"error","description":"Error: access violation accessing 0x0","stack":"Error: access violation accessing 0x0\n    at input:1\n    at frida/node_modules/frida-java/index.js:339\n    at input:1","fileName":"input","lineNumber":1,"columnNumber":1}

What its weird is that it only happens with some versions of the app I'm working with.

enovella commented 6 years ago

If I clear the cache and data of the app before starting the app, the error doesn't show up anymore. But this need to be done everytime before running Frida/r2frida.