vendredi 27 mars 2015

[Q] Weird ClassLoader bug

I tried to hook method "java.lang.System.loadLibrary", but it caused the process crashed.

My code is simple:




Quote:








@Override

public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {

if (!loadPackageParam.packageName.equals("com.shinybo x.yongchuandixiachengfortx13"))

return;



XposedHelpers.findAndHookMethod("java.lang.System" , loadPackageParam.classLoader, "loadLibrary",

String.class,

new XC_MethodHook() {

@Override

protected void beforeHookedMethod(MethodHookParam param) throws Throwable {

String libName = (String) param.args[0];

XposedBridge.log("XPOSED:" + libName);

XposedBridge.log("XPOSED:" + loadPackageParam.classLoader.toString());

super.beforeHookedMethod(param);

}

});



}



And I could got some output:




Quote:








I/Xposed ( 1709): XPOSED:crypto

I/Xposed ( 1709): XPOSED:dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.shinybox.yongchuandixiachengfortx13-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.shinybox.yongchuandixiachengfortx13-1, /vendor/lib, /system/lib]]]

I/Xposed ( 1709): XPOSED:ssl

I/Xposed ( 1709): XPOSED:dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.shinybox.yongchuandixiachengfortx13-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.shinybox.yongchuandixiachengfortx13-1, /vendor/lib, /system/lib]]]

I/Xposed ( 1709): XPOSED:openal

I/Xposed ( 1709): XPOSED:dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.shinybox.yongchuandixiachengfortx13-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.shinybox.yongchuandixiachengfortx13-1, /vendor/lib, /system/lib]]]



But the app crashed and here is the error info:




Quote:








E/AndroidRuntime( 1709): java.lang.UnsatisfiedLinkError: Couldn't load openal from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/data/de.robv.android.xposed.installer/bin/XposedBridge.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]]: findLibrary returned null

E/AndroidRuntime( 1709): at de.robv.android.xposed.XposedBridge.invokeOriginal MethodNative(Native Method)

E/AndroidRuntime( 1709): at de.robv.android.xposed.XposedBridge.handleHookedMe thod(XposedBridge.java:631)

E/AndroidRuntime( 1709): at de.robv.android.xposed.XposedBridge.main(XposedBri dge.java:132)



The reason is that the app tried to load the library "openal" from xposed installer's class loader rather than its own's. How this happened?





from xda-developers http://ift.tt/1bCWbep

via IFTTT

Aucun commentaire:

Enregistrer un commentaire

LightBlog