using android to attack proguard
play

Using Android to attack ProGuard (and saving 2 e for a ticket) - PowerPoint PPT Presentation

Using Android to attack ProGuard (and saving 2 e for a ticket) BeeRumP 29 mai 2019 Android Open Source Project Reversing the obfuscation Conclusion Who am I? @laughing_bit (C|Python|Twitter|Beamer|Mirabelle) Lover. Author of the


  1. Using Android to attack ProGuard (and saving 2 e for a ticket) BeeRumP – 29 mai 2019

  2. Android Open Source Project Reversing the obfuscation Conclusion Who am I? ◮ @laughing_bit ◮ (C|Python|Twitter|Beamer|Mirabelle) Lover. ◮ Author of the SRE tool Chrysalide ◮ Daily job at Risk&Co BeeRumP ’19 2 / 12

  3. Android Open Source Project Android application building Reversing the obfuscation ProGuard and its features Conclusion Battle plan Android key points ◮ Application = code (.java) + dependencies (.class) ◮ APK = dx( ProGuard( javac(code) + dependencies ) ) ◮ External repositories: Google, JCenter, ... ◮ lots of repositories: https://mvnrepository.com/repos Getting started ◮ Starting point: https://github.com/googlesamples ◮ 176 results for repositories matching android written in Java ◮ Let’s pick SimpleMediaPlayer as an example! BeeRumP ’19 3 / 12

  4. Android Open Source Project Android application building Reversing the obfuscation ProGuard and its features Conclusion Battle plan ProGuard ◮ Shrinks, optimizes and obfuscates Java bytecode ◮ Renames classes, fields, and methods (for instance a.a.a()) ◮ deterministic name obfuscation ◮ default obfuscation dictionary: [a-z]+ BeeRumP ’19 4 / 12

  5. Android Open Source Project Android application building Reversing the obfuscation ProGuard and its features Conclusion Battle plan ProGuard ◮ Shrinks, optimizes and obfuscates Java bytecode ◮ Renames classes, fields, and methods (for instance a.a.a()) ◮ deterministic name obfuscation ◮ default obfuscation dictionary: [a-z]+ Advanced usage ◮ Repackage all classes to a single root-level package ◮ -repackageclasses ◮ Use custom obfuscation dictionaries (with reserved keywords) ◮ -{,package,class}obfuscationdictionary ◮ Buy DexGuard ◮ runtime self-protection ◮ extra obfuscation: arithmetic and logical expressions + CFG BeeRumP ’19 4 / 12

  6. Android Open Source Project Android application building Reversing the obfuscation ProGuard and its features Conclusion Battle plan 1. Collect Android package bytecode ◮ easy to script ◮ https://maven.google.com/: 1.2 Gb BeeRumP ’19 5 / 12

  7. Android Open Source Project Android application building Reversing the obfuscation ProGuard and its features Conclusion Battle plan 1. Collect Android package bytecode ◮ easy to script ◮ https://maven.google.com/: 1.2 Gb 2. Fingerprint Android packages ◮ easy to script BeeRumP ’19 5 / 12

  8. Android Open Source Project Android application building Reversing the obfuscation ProGuard and its features Conclusion Battle plan 1. Collect Android package bytecode ◮ easy to script ◮ https://maven.google.com/: 1.2 Gb 2. Fingerprint Android packages ◮ easy to script 3. Compare the fingerprints with obscucated code fingerprints ◮ easy to script scriptable ◮ if there is a match, obfuscation is reversed! BeeRumP ’19 5 / 12

  9. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm group- index.xml POM Artifact A + JAR Version 1 Google Maven group- POM Artifact B Version 2 index.xml + AAR master-index.xml Version 3 POM Artifact C + AAR group- index.xml BeeRumP ’19 6 / 12

  10. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm group- index.xml POM Artifact A + JAR Version 1 Google Maven group- POM Artifact B Version 2 index.xml + AAR master-index.xml Version 3 POM Artifact C + AAR group- index.xml https://developer.android.com/studio/build/dependencies#gmaven-access BeeRumP ’19 6 / 12

  11. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm Method ◮ Avoid to have to deal with similarity *and* confidence ◮ Select binary heuristics and hope � similarity = identity BeeRumP ’19 7 / 12

  12. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm Method ◮ Avoid to have to deal with similarity *and* confidence ◮ Select binary heuristics and hope � similarity = identity Used heuristics BeeRumP ’19 7 / 12

  13. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm Method ◮ Avoid to have to deal with similarity *and* confidence ◮ Select binary heuristics and hope � similarity = identity Used heuristics ◮ Small Primes Product ◮ each instruction type is linked to a prime number BeeRumP ’19 7 / 12

  14. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm Method ◮ Avoid to have to deal with similarity *and* confidence ◮ Select binary heuristics and hope � similarity = identity Used heuristics ◮ Small Primes Product ◮ each instruction type is linked to a prime number ◮ Cyclomatic complexity ◮ #edges - #nodes + 2 * #exits BeeRumP ’19 7 / 12

  15. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm Method ◮ Avoid to have to deal with similarity *and* confidence ◮ Select binary heuristics and hope � similarity = identity Used heuristics ◮ Small Primes Product ◮ each instruction type is linked to a prime number ◮ Cyclomatic complexity ◮ #edges - #nodes + 2 * #exits ◮ Xrefs ◮ count of: jumps, branchs, calls, links to strings BeeRumP ’19 7 / 12

  16. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm Method ◮ Avoid to have to deal with similarity *and* confidence ◮ Select binary heuristics and hope � similarity = identity Used heuristics ◮ Small Primes Product ◮ each instruction type is linked to a prime number ◮ Cyclomatic complexity ◮ #edges - #nodes + 2 * #exits ◮ Xrefs ◮ count of: jumps, branchs, calls, links to strings ◮ Machoc hash ◮ Murmurhash3(<BB index>:[c,][<dest index>, ...];) BeeRumP ’19 7 / 12

  17. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm Method ◮ Avoid to have to deal with similarity *and* confidence ◮ Select binary heuristics and hope � similarity = identity Used heuristics ◮ Small Primes Product ◮ each instruction type is linked to a prime number ◮ Cyclomatic complexity ◮ #edges - #nodes + 2 * #exits ◮ Xrefs ◮ count of: jumps, branchs, calls, links to strings ◮ Machoc hash ◮ Murmurhash3(<BB index>:[c,][<dest index>, ...];) ◮ Dex code_item fields ◮ registers_size ins_size outs_size tries_size insns_size BeeRumP ’19 7 / 12

  18. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm Method ◮ Avoid to have to deal with similarity *and* confidence ◮ Select binary heuristics and hope � similarity = identity Used heuristics ◮ Small Primes Product ◮ each instruction type is linked to a prime number ◮ Cyclomatic complexity ◮ #edges - #nodes + 2 * #exits ◮ Xrefs ◮ count of: jumps, branchs, calls, links to strings ◮ Machoc hash ◮ Murmurhash3(<BB index>:[c,][<dest index>, ...];) ◮ Dex code_item fields ◮ registers_size ins_size outs_size tries_size insns_size ◮ Filtered prototypes ◮ (Ljava/lang/String;)[Landroid/support/a/a/h$b; BeeRumP ’19 7 / 12

  19. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm Method ◮ Avoid to have to deal with similarity *and* confidence ◮ Select binary heuristics and hope � similarity = identity Used heuristics ◮ Small Primes Product ◮ each instruction type is linked to a prime number ◮ Cyclomatic complexity ◮ #edges - #nodes + 2 * #exits ◮ Xrefs ◮ count of: jumps, branchs, calls, links to strings ◮ Machoc hash ◮ Murmurhash3(<BB index>:[c,][<dest index>, ...];) ◮ Dex code_item fields ◮ registers_size ins_size outs_size tries_size insns_size ◮ Filtered prototypes ◮ (Ljava/lang/String;)[Landroid/support/a/a/h$b; ◮ Filtered class descriptors ◮ Landroid/support/v7/view/menu/e$2$1; BeeRumP ’19 7 / 12

  20. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm 1. Build a tree with all obfuscated symbol labels ◮ nodes are parts of the labels: (package|class|routine) names ◮ leafs contain AOSP candidates BeeRumP ’19 8 / 12

  21. Android Open Source Project Download inspiration Reversing the obfuscation Compare and conquer Conclusion Match algorithm 1. Build a tree with all obfuscated symbol labels ◮ nodes are parts of the labels: (package|class|routine) names ◮ leafs contain AOSP candidates 2. Quickly filter some AOSP candidates ◮ android.support.v7.app.b$a.a ◮ android.support.v4.app.NoSaveStateFrameLayout.<init> BeeRumP ’19 8 / 12

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend