Method with argument of type array of array cannot be instrumented
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- java, javascript
- 领域
- devtools
调研方向
从 lib/types.js 中的 getArrayType() 附近开始,然后使用提供的 TestA.array_of_array(byte[][]) 方法和 overload('[[B') 重现该故障。验证在 factory.use() 和 casting 之前数组类型名称是如何转换的。在没有 ClassNotFoundException 的情况下 instrumentation 成功,并且可以通过 Java bridge 调用该方法,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Hello,
I run into a problem while trying to instrument methods that take an array of array of byte as argument. For exemple:
package com.example.testclassloader;
public class TestA {
public static int array_of_array(byte[][] arrays) {
int size = 0;
for (byte[] arr: arrays) {
size += arr.length;
}
return size;
}
}
[Android Emulator 5554::TestClassLoader ]-> Java.performNow(() => { })
[Android Emulator 5554::TestClassLoader ]-> TestA = Java.use("com.example.testclassloader.TestA")
"<class: com.example.testclassloader.TestA>"
[Android Emulator 5554::TestClassLoader ]-> method = TestA.array_of_array
function
[Android Emulator 5554::TestClassLoader ]-> method.argumentTypes
[
{
"className": "[[B",
"defaultValue": "0x0",
"name": "[[B",
"size": 1,
"type": "pointer"
}
]
[Android Emulator 5554::TestClassLoader ]-> method.overload('[[B').implementation = function(arrays) { s =
method(arrays); console.log(s); return s; };
function
# after triggering the method in the app:
[Android Emulator 5554::TestClassLoader ]-> Process crashed: java.lang.ClassNotFoundException: Didn't find class "[L[B;" on path: DexPathList[[dex file "/data/data/com.example.testclassloader/code_cache/.overlay/base.apk/classes3.dex", zip file "/data/app/~~NRqmDlxjA4t3ccEvxe4Qlw==/com.example.testclassloader-JhUO40ypsrxE2AIa8f1k4A==/base.apk"],nativeLibraryDirectories=[/data/app/~~NRqmDlxjA4t3ccEvxe4Qlw==/com.example.testclassloader-JhUO40ypsrxE2AIa8f1k4A==/lib/x86_64, /system/lib64, /system_ext/lib64]]
I believe the issue comes from here: https://github.com/frida/frida-java-bridge/blob/1e23abb71fd26726d59627e4da3ad8e10ba849aa/lib/types.js#L480
I think something like this could be a rough solution, but I did not manage to get frida to use patched version of frida-java-bridge:
diff --git a/lib/types.js b/lib/types.js
index 6a0f977..9b8d91f 100644
--- a/lib/types.js
+++ b/lib/types.js
@@ -477,7 +477,13 @@ function getArrayType (typeName, unbox, factory) {
}
// The type name we get is not always the correct representation of the type so we make it so here.
- const internalTypeName = '[L' + elementTypeName.replace(/\./g, '/') + ';';
+ let internalElementTypeName = '';
+ if (elementTypeName.replace[0] === '[') {
+ internalElementTypeName = elementTypeName.replace(/\./g, '/');
+ } else {
+ internalElementTypeName = 'L' + elementTypeName.replace(/\./g, '/') + ';';
+ }
+ const internalTypeName = '[' + internalElementTypeName;
try {
result.$w = factory.cast(arr, factory.use(internalTypeName), owned);
} catch (e) {
PS: Is there some documentation for running a patched java-bridge? I tried https://github.com/frida/frida-tools?tab=readme-ov-file#loading-your-custom-frida-java-bridge and failled
- 主要语言
- JavaScript
- 星标
- 414
- 派生
- 174
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
frida/frida-java-bridge 的其他 Issue
-
Types is missing `deoptimizeMethod`可能已有人在做 @Electric1447 于 181 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 65/100
frida/frida-java-bridge#386 ·
-
[v7.0.11+] Process crash on accessing object["<init>"] with JVMTI available可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
frida/frida-java-bridge#384 · 2 条评论 · 2 个 reaction ·
-
[Android 17] Early observations: JIT thread pool crash on attach and JNI transition frame aborts未关闭
难度 5/5 一周以上 新手友好度 12/100
frida/frida-java-bridge#411 ·
-
难度 3/5 1-2 天 新手友好度 42/100
frida/frida-java-bridge#409 ·
-
ensureClassInitialized() no longer initializes on ART since 7983e815 — hooks on uninitialized classes install successfully but never dispatch可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 4/5 3-5 天 新手友好度 52/100
frida/frida-java-bridge#408 ·
查看 frida/frida-java-bridge 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
[BUG] npm pkg delete removes the first array item for a nonexistent property可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 2 天内回复
-
feedback simulation workshop
难度 2/5 1-3 小时 新手友好度 72/100
githubnext/gh-aw-workshop#4755 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
videojs/video.js#9537 · 1 条评论 ·
维护者通常 1 天内回复
-
fix
难度 1/5 1 小时以内 新手友好度 72/100
idean3885/claude-ops-agent#728 ·
维护者通常 1 天内回复