Using Android to attack ProGuard
(and saving 2e for a ticket)
BeeRumP – 29 mai 2019
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
BeeRumP – 29 mai 2019
Android Open Source Project Reversing the obfuscation Conclusion
BeeRumP ’19 2 / 12
Android Open Source Project Reversing the obfuscation Conclusion Android application building ProGuard and its features Battle plan
◮ lots of repositories: https://mvnrepository.com/repos
◮ 176 results for repositories matching android written in Java
BeeRumP ’19 3 / 12
Android Open Source Project Reversing the obfuscation Conclusion Android application building ProGuard and its features Battle plan
◮ deterministic name obfuscation ◮ default obfuscation dictionary: [a-z]+ BeeRumP ’19 4 / 12
Android Open Source Project Reversing the obfuscation Conclusion Android application building ProGuard and its features Battle plan
◮ deterministic name obfuscation ◮ default obfuscation dictionary: [a-z]+
◮ -repackageclasses
◮ -{,package,class}obfuscationdictionary
◮ runtime self-protection ◮ extra obfuscation: arithmetic and logical expressions + CFG BeeRumP ’19 4 / 12
Android Open Source Project Reversing the obfuscation Conclusion Android application building ProGuard and its features Battle plan
◮ easy to script ◮ https://maven.google.com/: 1.2 Gb BeeRumP ’19 5 / 12
Android Open Source Project Reversing the obfuscation Conclusion Android application building ProGuard and its features Battle plan
◮ easy to script ◮ https://maven.google.com/: 1.2 Gb
◮ easy to script BeeRumP ’19 5 / 12
Android Open Source Project Reversing the obfuscation Conclusion Android application building ProGuard and its features Battle plan
◮ easy to script ◮ https://maven.google.com/: 1.2 Gb
◮ easy to script
◮ easy to script scriptable ◮ if there is a match, obfuscation is reversed! BeeRumP ’19 5 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
group- index.xml group- index.xml
Artifact C Artifact B
Version 3 POM + AAR Version 2 POM + AAR Version 1 POM + JAR
Artifact A
group- index.xml
BeeRumP ’19 6 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
group- index.xml group- index.xml
Artifact C Artifact B
Version 3 POM + AAR Version 2 POM + AAR Version 1 POM + JAR
Artifact A
group- index.xml
BeeRumP ’19 6 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
BeeRumP ’19 7 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
BeeRumP ’19 7 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
◮ each instruction type is linked to a prime number BeeRumP ’19 7 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
◮ each instruction type is linked to a prime number
◮ #edges - #nodes + 2 * #exits BeeRumP ’19 7 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
◮ each instruction type is linked to a prime number
◮ #edges - #nodes + 2 * #exits
◮ count of: jumps, branchs, calls, links to strings BeeRumP ’19 7 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
◮ each instruction type is linked to a prime number
◮ #edges - #nodes + 2 * #exits
◮ count of: jumps, branchs, calls, links to strings
◮ Murmurhash3(<BB index>:[c,][<dest index>, ...];) BeeRumP ’19 7 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
◮ each instruction type is linked to a prime number
◮ #edges - #nodes + 2 * #exits
◮ count of: jumps, branchs, calls, links to strings
◮ Murmurhash3(<BB index>:[c,][<dest index>, ...];)
◮ registers_size ins_size outs_size tries_size insns_size BeeRumP ’19 7 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
◮ each instruction type is linked to a prime number
◮ #edges - #nodes + 2 * #exits
◮ count of: jumps, branchs, calls, links to strings
◮ Murmurhash3(<BB index>:[c,][<dest index>, ...];)
◮ registers_size ins_size outs_size tries_size insns_size
◮ (Ljava/lang/String;)[Landroid/support/a/a/h$b; BeeRumP ’19 7 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
◮ each instruction type is linked to a prime number
◮ #edges - #nodes + 2 * #exits
◮ count of: jumps, branchs, calls, links to strings
◮ Murmurhash3(<BB index>:[c,][<dest index>, ...];)
◮ registers_size ins_size outs_size tries_size insns_size
◮ (Ljava/lang/String;)[Landroid/support/a/a/h$b;
◮ Landroid/support/v7/view/menu/e$2$1; BeeRumP ’19 7 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
◮ nodes are parts of the labels: (package|class|routine) names ◮ leafs contain AOSP candidates BeeRumP ’19 8 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
◮ nodes are parts of the labels: (package|class|routine) names ◮ leafs contain AOSP candidates
◮ android.support.v7.app.b$a.a ◮ android.support.v4.app.NoSaveStateFrameLayout.<init> BeeRumP ’19 8 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
◮ nodes are parts of the labels: (package|class|routine) names ◮ leafs contain AOSP candidates
◮ android.support.v7.app.b$a.a ◮ android.support.v4.app.NoSaveStateFrameLayout.<init>
◮ select the biggest symbol ◮ retrieve its original name by using binary diffing ◮ remove AOSP packages which do not match BeeRumP ’19 8 / 12
Android Open Source Project Reversing the obfuscation Conclusion Download inspiration Compare and conquer Match algorithm
◮ nodes are parts of the labels: (package|class|routine) names ◮ leafs contain AOSP candidates
◮ android.support.v7.app.b$a.a ◮ android.support.v4.app.NoSaveStateFrameLayout.<init>
◮ select the biggest symbol ◮ retrieve its original name by using binary diffing ◮ remove AOSP packages which do not match
◮ keep the best match with binary diffing BeeRumP ’19 8 / 12
Android Open Source Project Reversing the obfuscation Conclusion What we got so far Demo screen Next steps and beyond
◮ Work In Progress... ◮ Limitations: only the external dependencies are processed ◮ still an extra help for disassembly understanding!
◮ https://chrysalide.re/api/python/pychrysalide-analysis-diffing BeeRumP ’19 9 / 12
Android Open Source Project Reversing the obfuscation Conclusion What we got so far Demo screen Next steps and beyond BeeRumP ’19 10 / 12
Android Open Source Project Reversing the obfuscation Conclusion What we got so far Demo screen Next steps and beyond
◮ scale does matter! ◮ but Chrysalide does not disassemble large APKs yet... (ENOMEM)
◮ class names could leak from source files
BeeRumP ’19 11 / 12
Android Open Source Project Reversing the obfuscation Conclusion
BeeRumP ’19 12 / 12