Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

AASF.pdf

 AASF.pdf

Droidcon 2022 slides for my talk

Andrea Cioccarelli

October 07, 2022
Tweet

More Decks by Andrea Cioccarelli

Other Decks in Education

Transcript

  1. Context Security •App anatomy & lifecycle •Protection use cases •Tradeoffs

    •Attack vectors •Security countermeasures •External protection systems •Passive security mechanisms Outline
  2. Binary Services APIs Play Store Tampering Emulated Execution Custom OS

    Runtime Attacks Repackaging Automated DRT Decompilation-Reassembly Tools Code Injection Patches Either root-based or repackaged Data Editing Either external or internal (root)
  3. Binary Services APIs Play Store Tampering Emulated Execution Custom OS

    Runtime Attacks Repackaging Automated DRT Decompilation-Reassembly Tools Code Injection Patches Either root-based or repackaged Data Editing Either external or internal (root) Root Access Piracy Abuse
  4. Binary Services APIs Play Store Tampering Emulated Execution Custom OS

    Runtime Attacks Repackaging Automated DRT Decompilation-Reassembly Tools Code Injection Patches Either root-based or repackaged Data Editing Either external or internal (root) Root Access Piracy Abuse
  5. Security Environment Security Layer The set of security-related conditions that

    your app requires to be true in order to work properly. It is your security policy specification. The set of security countermeasures employed by your software to physically check the conditions of the security environment. It is the security policy implementation. •No Pirate Apps Installed •No Emulator •No Custom OS
  6. Protection Level Free Paid Financial No Value Local Value Aggregated

    Value Zero Zero/Low Low Low Low/Medium High Low/Medium High
  7. Calculator • No Endpoints (local value) (free) • Free Download

    • No IAP/Subscriptions (offline) Chess Analyzer • No Endpoints (local value) • Paid Download • No IAP/Subscriptions Task Manager • Service Endpoints (aggregated value) • Free Download • In App Purchase for Pro Version ♫ Streaming Service • Service + API Endpoints (aggregated value) • Free Download • Subscription + Ads ⇒ Zero protection ⇒ Low protection ⇒ Medium protection ⇒ High protection
  8. Security Environment •Underprotection: your app remains susceptible to some kinds

    of attacks Binary Binary Binary too little protection too much protection nailed it •Overprotection: your security environment is stricter than what it would need to be (for your app to operate successfully).
  9. Protection Implications • Performance (every security layer check requires CPU

    time and potentially network/storage) • Infrastructure (your application becomes more complex and/or depends on external services) • Negative feedback (your users may find the protection mechanisms unfair)
  10. Rooting System Antipiracy Integrity Emulated Execution Custom OS Administrative Tools

    •Data editing (prefs, db, files, binaries) •Administrative code execution (interference) •Memory access & violation
  11. System Antipiracy Integrity Emulated Execution Custom OS Administrative Tools •Lower

    security & stability standards •Instability factor •Usually comes with root access preinstalled/ enabled Rooting
  12. Pirate Software Malicious Proxies Custom Patches Interception System Antipiracy Integrity

    •Potential attack residue/pending/underway •Runtime influence •Unsafe environment signal
  13. Pirate Software Malicious Proxies Custom Patches Interception System Antipiracy Integrity

    •Usually applied by an automated DRT or APK editor •Tailored for a binary’s components
  14. Pirate Software Malicious Proxies Custom Patches Interception System Antipiracy Integrity

    •External component of an attack, which hard- wires to our app •Imminent attack indicators
  15. System Antipiracy Integrity Root Detection Emulator Detection Custom Binaries SELinux

    Status System Build Info •Administrative access request •Binary dumping & analysis •Root managers •Custom ROM build tags •System certificates •Filesystem checks
  16. System Antipiracy Integrity Root Detection Emulator Detection Custom Binaries SELinux

    Status System Build Info •Known emulator build fingerprint data •Advanced system detection
  17. System Antipiracy Integrity Root Detection Emulator Detection Custom Binaries SELinux

    Status System Build Info •Shell output analysis •Installed application managing binaries
  18. System Antipiracy Integrity Root Detection Emulator Detection Custom Binaries SELinux

    Status System Build Info •Generic filter through build hardcoded data
  19. System Antipiracy Integrity Antipiracy Checks •Installed application list match against

    local dataset of pirate software •Lower-fidelity detection mechanisms
  20. Binary Services APIs Play Store Tampering Emulated Execution Custom OS

    Runtime Attacks Repackaging Automated DRT Decompilation-Reassembly Tools Code Injection Patches Either root-based or repackaged Data Editing Either external or internal (root) Root Access Piracy Abuse
  21. Binary Services APIs Play Store Tampering Emulated Execution Custom OS

    Runtime Attacks Repackaging Automated DRT Decompilation-Reassembly Tools Code Injection Patches Either root-based or repackaged Data Editing Either external or internal (root) Root Access Piracy Abuse EPSs
  22. Binary Services APIs Play Store Tampering Emulated Execution Custom OS

    Runtime Attacks Repackaging Automated DRT Decompilation-Reassembly Tools Code Injection Patches Either root-based or repackaged Data Editing Either external or internal (root) Root Access Piracy Abuse EPSs
  23. // Receive the nonce from the secure server. val nonce:

    String = … // Create an instance of a manager. val integrityManager = IntegrityManagerFactory.create(applicationContext) // Request the integrity token by providing a nonce. val integrityTokenResponse: Task<IntegrityTokenResponse> = integrityManager.requestIntegrityToken( IntegrityTokenRequest.builder() .setNonce(nonce) .build())
  24. Structural Security Dynamic Security Set of measures backed into the

    application from the ground up. The building blocks of the application are made with security in mind, so that the final binary is robust against a variety of attacks. Active runtime capabilities to intercept and respond to malicious attacks, interference or tampering attempts as they happen. • Code obfuscation • Encrypted data storage • Secure data transitions • Dynamic code loading
  25. Libraries • Kevlar (https: // github.com/kevlar-kt/kevlar) • PiracyChecker (https: //

    github.com/javiersantos/PiracyChecker) • TamperDetector (https: / / github.com/mukeshsolanki/Android-Tamper-Detector) • RootBeer (https: // github.com/scottyab/rootbeer) • RootInspector (https: // github.com/devadvance/rootinspector) • Emulator Detector (https: // github.com/framgia/android-emulator-detector) Slides @cioccarellia, 7 Oct 2022 • • On my twitter later Code • There wasn’t any :D
  26. Documentation @cioccarellia, 7 Oct 2022 • • Play Integrity (https:

    / / developer.android.com/google/play/integrity) • SafetyNet (https: / / developer.android.com/training/safetynet) [deprecated] • Tampering/RevEng (https: // mobile-security.gitbook.io/mobile-security-testing-guide/android-testing- guide/0x05c-reverse-engineering-and-tampering) • Tamper Detection (https: // www.airpair.com/android/posts/adding-tampering-detection-to-your-android-app) • Securing Android LVL (https: // android-developers.googleblog.com/2010/09/securing-android-lvl- applications.html) • Root Detection (https: / / www.appknox.com/blog/root-detection-techniques) • Verifying Purchases (https: / / stackoverflow.com/questions/33850864/how-to-verify-purchase-for-android- app-in-server-side-google-play-in-app-billin) • Secure Data (https: // developer.android.com/topic/security/data) • Attack Anatomy (https: / / kevlar-kt.github.io/kevlar/pages/overview/anatomy_of_attacks)