-
-
Notifications
You must be signed in to change notification settings - Fork 155
Open
Description
Description
When hooking Java methods using frida-java-bridge, calling methods on null parameters causes the target process to crash, even when the code is wrapped in a try-catch block. This is unexpected behavior for JavaScript developers and causes production apps to terminate silently.
Reproduction
Java.perform(function () {
const ArrayList = Java.use("java.util.ArrayList");
ArrayList.add.overload('java.lang.Object').implementation = function (value) {
try {
// This crashes the process when value is null
var className = value.getClass().getName();
console.log("Class:", className);
} catch (e) {
console.log("Exception caught:", e); // Never executed
}
return this.add(value);
};
});Command:
frida -UF -l script.jsExpected Behavior
The try-catch block should catch the NullPointerException when value is null, log the error message, and allow the application to continue running.
Actual Behavior
The target process terminates immediately:
Process terminatedThe exception is never caught, and no error message appears in the console.
Environment
Frida version: 16.2.1
Target platform: Android 6
Script language: JavaScriptMetadata
Metadata
Assignees
Labels
No labels