How to avoid reverse engineering of an APK assets folder resources items file?

江枫思渺然 提交于 2019-11-30 21:43:34

Reverse engineering on Android is REALLY easy ! You can't prevent that. You should not store any sensitive informations in your APK because someone could find them easily.

You should use asymmetric encryption if you want to store something on the user device.

It's possible to hide some data in your code like a symmetric encryption key but it will be found in few minutes if someone want to find it. (and few seconds if you put it in assets folder...)

EDIT If you want to put a symmetric encryption key in your code, don't set it like :

String myKey = "myEncryptionKey";
byte[] key = myKey.getBytes();

because a reverse engineer is able to list all strings in your apk with a single command... So use something like :

StringBuilder sb = new StringBuilder();
sb.append(m);
sb.append(y);
...
byte[] key = sb.toString().getBytes();

or

byte[] key = Base64.decode("esfas09f8as90f8").getBytes();

Any data which you install on a client device will be accessible to the user. Tools like Proguard are great for code optimization and may make code slightly less readable but anyone with your APK can reverse engineer the application and access everything which you included on the APK file.

For example, you can store sensitive data in the assets folder which an attacker can access easily, now encrypting this is fine but what key are you using to encrypt it? Where is the key stored?

There is another tool called DexGuard which can encrypt strings. However this has not been a proven defense yet and will only slow an attacker down.

In summary never store sensitive data on your App, it cannot be protected.

If you want to find out how easy this is, check out the following tools:

https://code.google.com/p/dex2jar/

&

http://jd.benow.ca/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!