-
-
Notifications
You must be signed in to change notification settings - Fork 156
Open
Description
Scripts compiled with frida-java-bridge v7.0.11 crashes with Error: expected a pointer when JVMTI is unavailable.
Issue description:
In lib/class-model.js:1346, the code writes jvmti as a pointer, but jvmti may be null when JVMTI is unavailable.
The function tryGetEnvJvmti (lib/android.js:547-581) tries to find the EnsurePluginLoaded symbol, but libart.so may not have it (like mine, maybe stripped by Samsung? 🤷🏻♂️).
As a result, api.jvmti becomes null and writePointer(null) crashes because null is not a Frida pointer object.
Environment:
- Android 9 (SDK 28)
- Device: Samsung Galaxy A8 2018 (SM-A530F)
Test performed:
test.js:
import Java from "frida-java-bridge";
Java.perform(() => { console.log(Java.use('java.lang.String')) })frida-compile test.js -o _test.jsfrida -UF -l _test.js
Logs:
Error: expected a pointer
at <anonymous> (node_modules/frida-java-bridge/lib/class-model.js:1352)
at forEach (native)
at compileModule (node_modules/frida-java-bridge/lib/class-model.js:1352)
at ensureInitialized (node_modules/frida-java-bridge/lib/class-model.js:1317)
at build (node_modules/frida-java-bridge/lib/class-model.js:1227)
at _make (node_modules/frida-java-bridge/lib/class-factory.js:287)
at use (node_modules/frida-java-bridge/lib/class-factory.js:158)
at <anonymous> (node_modules/frida-java-bridge/index.js:404)
at <anonymous> (node_modules/frida-java-bridge/lib/vm.js:35)
at _performPendingVmOpsWhenReady (node_modules/frida-java-bridge/index.js:452)
at perform (node_modules/frida-java-bridge/index.js:377)
at <anonymous> (test.js:3)
Patch:
--- a/lib/class-model.js
+++ b/lib/class-model.js
@@ -1343,7 +1343,7 @@ function compileModule (env) {
const field = env.javaLangReflectField();
let j = javaApi;
[
- jvmti,
+ jvmti !== null ? jvmti : ptr(0),
getDeclaredMethods, getDeclaredFields,
method.getName, method.getModifiers,
field.getName, field.getModifiersMetadata
Metadata
Assignees
Labels
No labels