Securing Your Android Apps
 By Pranay Airan @pranayairan
Pranay Airan

  Web application developer
           @Intuit

Android Developer by choice 

 Assistant organizer Blrdroid

        @pranayairan
Current Threats

  Code Protection Tools

   Code Analysis Tools

   Android App Build Process

  How to disassemble

Different protection techniques
Current Threats
Stealing App   Stealing App   Unauthorized
   Code           Assets       API Access


Stealing App   Repackaging     Malwares
    DB          and selling   and viruses



                  Piracy
Code Protectors

 Progaurd     Dexgaurd




               Java
            obfuscators
Code Analysis Tools

 Dex2jar              Smali




           IDA Pro   Dexdump
Android Application Build
              Process
                                                Java
             .java files                                                        .class files
                                               Compiler

                                                                Obfuscator



                      Jar                  .so                                    Dx tool
                                                    resource
                     Signer               files
                                                                 Obfuscator



                    .apk files                    APK Builder                    .dex files



Ref: http://net.cs.uni-bonn.de/fileadmin/user_upload/plohmann/2012-Schulz-Code_Protection_in_Android.pdf
Reverse Engineering An App
Use this methods   This can be used on
Federal Offence       ethically           your apps
Lets disassemble
                        App on
                        phone
                                   Apk Extractor


                       .apk files      Extract APK


Images
  DB                                                 AAPT   Readable
           resource   .dex files      Manifest
 asset                                                        XML
  etc
                             dex -> class (dex2jar)

                      .class files

                               Class -> java


                      Java files
Code Protection


Obfuscation   Shrinker   Optimization   Progaurd




Using Progaurd in Android
Reversed APK with Progaurd
Reversed APK with Dexgaurd
Other Techniques
              junk byte insertion

                   Dynamic Code loading

                   Self Modifying code

              Obfuscation at dex level
Ref: http://net.cs.uni-bonn.de/fileadmin/user_upload/plohmann/2012-Schulz-Code_Protection_in_Android.pdf
API Protection Google
               Play Service

                                            Token + Your                Verify
    Google          Client id                                   Your    Token
    Authutil                                 Parameters       Backend   Fields


               Access Token
                                                    Verify Token
                                                     Signature


                                                              Google



audience:server:client_id:9414861317621.apps.googleusercontent.com
API Protection
Hiding url &   Use HTTPS
parameters     (self signed
                will work)




Use time &      Use User
encoding in       Agent
parameters      Identifier
DB Protection
Hash your data


3rd Party DB encryption like SQLCipher


String Encryption
To Sum Up
Nothing is full proof


Don’t give away your code just like that


Use progaurd to protect your code


Use Google Api Verification for Sensitive
backend calls
Questions ??
Thank You
Pranay.airan@iiitb.net   @pranayairan


http://goo.gl/okiJp
Useful Links
• http://www.honeynet.org/downloads/Android.tar.gz

• http://proguard.sourceforge.net/index.html#manual/examples.
  html

• http://code.google.com/p/dex2jar/

• http://code.google.com/p/android-apktool/

• http://android-developers.blogspot.in/2013/01/verifying-back-
  end-calls-from-android.html

• http://sqlcipher.net/sqlcipher-for-android/