Reputation: 11
I am trying out a challenge where the system has an app installed from which I need to extract a variable called x. The app has a man-in-the-disk vulnerability where it calls a file in the external storage. I replaced this file and now I am trying with this file to extract the variable. I tried java reflection but I was getting ClassNotFound exception.
public class Abc {
public static void run() throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
Class<?> classToLoad = Class.forName("com.system.app.MainActivity");
Field xField = classToLoad.getDeclaredField("x");
xField.setAccessible(true);
// Access the value of the field\n" +
String xValue = (String) xField.get(null); // Print
Log.d("x", "Value of MainActivity.x: " + xValue);
}
}
What am I doing wrong? I just need to extract x from com.system.app; if not java reflection what do I do?
Upvotes: 1
Views: 17