Info Obfuscated methods

Description

Obfuscation refers to methods to obscure code and make it hard to understand. Compiled Java classes can be decompiled if there is no obfuscation during compilation step.

Adversaries can steal code and repurpose it and sell it in a new application or create a malicious fake application based on the initial one.

Code obfuscation only slows the attacker from reverse engineering but does not make it impossible.

Recommendation

Design the application to add the following protections and slow reverse engineering of the application:

  • Obfuscate Java source code with tools like Proguard or Dexguard
  • buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
            }
        }
  • Verification application signing certificate during runtime by checking context.getPackageManager().signature
  • Check application installer to ensure it matches the Android Market by calling context.getPackageManager().getInstallerPackageName
  • Check running environment at runtime
  • private static String getSystemProperty(String name) throws Exception {
        Class systemPropertyClazz = Class.forName("android.os.SystemProperties");
        return (String) systemPropertyClazz.getMethod("get", new Class[] { String.class }).invoke(systemPropertyClazz, new Object[] { name });
    }
    
    public static boolean checkEmulator() {
    
        try {
            boolean goldfish = getSystemProperty("ro.hardware").contains("goldfish");
            boolean qemu = getSystemProperty("ro.kernel.qemu").length() > 0;
            boolean sdk = getSystemProperty("ro.product.model").equals("sdk");
    
            if (qemu || goldfish || sdk) {
                return true;
            }
    
        } catch (Exception e) {
        }
    
        return false;
      }
  • Check debug flag at runtime
  • context.getApplicationInfo().applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE;

Technical details
PackageObfuscated
org.jsoup False
androidx.core.internal False
com.google.protobuf False
android.support.asynclayoutinflater False
android.support.constraint False
com.google.longrunning False
com.squareup.okhttp False
android.support.compat False
android.support.print False
javax.annotation False
android.support.interpolator False
com.google.api False
android.support.loader False
io.opencensus.stats False
io.grpc False
com.appsflyer True
android.support.design False
android.arch.core False
android.support.annotation False
android.support.coreui False
androidx.browser.browseractions False
com.android.installreferrer False
android.support.coreutils False
android.support.swiperefreshlayout False
android.support.v4 False
okio False
android.support.localbroadcastmanager False
android.support.transition False
com.google.rpc False
com.google.type False
android.support.customtabs False
android.arch.lifecycle False
io.opencensus.tags False
io.opencensus.trace False
androidx.media False
android.support.mediacompat False
com.google.gson False
com.google.zxing False
android.support.drawerlayout False
androidx.versionedparcelable False
android.support.customview False
android.support.slidingpanelayout False
com.facebook False
android.support.documentfile False
android.support.cursoradapter False
io.opencensus.internal False
com.android.volley False
android.support.coordinatorlayout False
io.opencensus.common False
com.google.firebase True
android.support.fragment False
bolts False
firebase.com.protolitewrapper False