Android Application Security - obfuscation using ProGuard in Android Studio

There are many techniques out there for Android Application code obfuscation. Most popular and easy to be applied is using ProGuard in Android Studio.

What it usually does is it will shorten your app's class name, optimize your code, remove unnecessary resources and code. The main goal of it is to make your app harder to be reverse engineered.

Obfuscation in Android Application has been applied extensively by malware author to hide their malicious code and give security researcher like us a bad day.

As developer, you can applied ProGuard in your Android App project by implement this additional rule in your project level build.grade(Module:app) file.

buildTypes { release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro' } debug { minifyEnabled false shrinkResources false proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro' } }







Rule sets as an example above is for two types of build, release and debug.

  • minifyEnabled is a rule for code shrinking, obfuscation, and optimization of your code.
  • shrinkResources is a rule for resource shrinking and to exclude unused resources. It works in conjunction with minifyEnable rule, so minifyEnable must be set to true to use this rule too.
  • proguardFiles is the default rule for ProGuard that are packaged with the Android Gradle Plugin.
  • Boolean value is used to enable minifyEnabled and shrinkResources function when building your build release.

Make sure to implement this in your app before build it for production release.


Reference 

Android Developer

Comments

Post a Comment

Popular posts from this blog

Deploying open-source SOC lab with red team simulation, at home. Elasticsearch Stack EDR + SIEM (Part 1)

Deploying open-source SOC lab with red team simulation, at home. MISP, Cortex and TheHive (Part 2)