frida / frida-java-bridge

Java runtime interop from Frida
318 stars 118 forks source link

frida cannot registerClass for java.io.IOException: Permission denied #274

Closed Leepay closed 1 year ago

Leepay commented 1 year ago

When I want to define a new class in frida-CLI, error occurs.

My frida commands of register a class is:

const testCls = Java.registerClass({
    name: 'com.testCls',
    methods: {
        $init: function () {
            console.log('Constructor of testCls is called');
        },
    }
});

The error message is

Error: java.io.IOException: Permission denied
    at <anonymous> (frida/node_modules/frida-java-bridge/lib/env.js:124)
    at value (frida/node_modules/frida-java-bridge/lib/class-factory.js:1065)
    at e (frida/node_modules/frida-java-bridge/lib/class-factory.js:586)
    at apply (native)
    at value (frida/node_modules/frida-java-bridge/lib/class-factory.js:970)
    at e (frida/node_modules/frida-java-bridge/lib/class-factory.js:553)
    at ue (frida/node_modules/frida-java-bridge/lib/class-factory.js:1197)
    at fromBuffer (frida/node_modules/frida-java-bridge/lib/class-factory.js:1175)
    at registerClass (frida/node_modules/frida-java-bridge/lib/class-factory.js:216)
    at registerClass (frida/node_modules/frida-java-bridge/index.js:283)
    at <eval> (<input>:11)
    at eval (native)

I'm testing on:

Any way to help me solve this problem or register a java class?

Leepay commented 1 year ago

Oh I find the reason. Java.registerClass needs to be included in Java.perform() to execute. Not because of the permission problem in java