System.load 和 System.loadLibrary的检测
System.load 和 System.loadLibrary 除了使用时有点小区别,还有没有其他特征区别?因为我发现某些游戏检测里,在注入某个so时,使用System.load会被检测,而使用System.loadLibrary注入则正常(以前做360加固的过签也遇到过)
有人研究过吗?{:17_1062:} 跟踪了Android12的代码,他们2个函数最后都会调用nativeLoad这个函数,但是参数不一样。
load:
String error = nativeLoad(filename, fromClass.getClassLoader());
后者是:String error = nativeLoad(filename, loader, callerClass);
也就是callerClass多了这个。
https://aosp.app/android-12.0.0_r2/xref/libcore/ojluni/src/main/java/java/lang/Runtime.java#1086
但是最后他们都是调用了同一个函数:
1120 private static String nativeLoad(String filename, ClassLoader loader) {
1121 return nativeLoad(filename, loader, null);
1122 }
1123
1124 private static native String nativeLoad(String filename, ClassLoader loader, Class<?> caller);
nativeLoad三个参数的,只不过load函数传递了caller为null。
至于区别,就要到c++里面看实现了。
https://aosp.app/android-12.0.0_r2/xref/libcore/ojluni/src/main/native/Runtime.c#80
这里就是:JVM_NativeLoad(env, javaFilename, javaLoader, caller);
如果继续挖,就只能追JVM_NativeLoad这个函数。根据这个思路一直往下追就可以了。我要搬砖了。
debug_cat 发表于 2024-6-19 09:26
跟踪了Android12的代码,他们2个函数最后都会调用nativeLoad这个函数,但是参数不一样。
load:
感谢大佬,膜拜下 插个眼, 最近也在学习native层的知识,感谢各位大佬
页:
[1]