appspear: bytecode decryp0ng and dex reassembling for...

19
AppSpear: Bytecode Decryp0ng and DEX Reassembling for Packed Android Malware Yang Wenbo, Zhang Yuanyuan, Li Juanru, Shu Junliang, Li Bodong, Hu Wenjun, Gu Dawu Sudeep Nanjappa Jayakumar

Upload: others

Post on 01-Apr-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

AppSpear:BytecodeDecryp0ngandDEXReassemblingforPackedAndroidMalware

YangWenbo,ZhangYuanyuan,LiJuanru,ShuJunliang,LiBodong,HuWenjun,GuDawu

SudeepNanjappaJayakumar

Page 2: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

Agenda•  Introduc0on•  AppSpear–Goals,Contribu0ons•  CodePackedAndroidMalware•  Analysis•  AppSpear–Overview•  DEXReassembling•  ExperimentalEvalua0on•  AccuracyofDEXreassembling•  RelatedWork•  Conclusion

Page 3: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

Introduc0on•  Arangeofsta0canddynamicanalysisapproaches(usingcodesimilaritycomparison

todetectmalware)havebeenproposedfordetec0ngmaliciousAndroidapps.•  These techniques are ini0ally designed to counter reverse engineering and

effec0velyresistmanyprogramtamperingaXempts,theyarebecomingacommonmeasureofmalwaredetec0oncircumven0on.

•  Currentunpackingapproachesareeitherbasedonmanualefforts,whichareslowandtedious,orbasedoncoarse-grainedmemorydumping.

•  Inves0ga0onon37,688Androidmalwaresamplesisconductedtotakesta0s0csoftheandroidapps.

•  Thispaperconductsasystema0cstudyofpackedAndroidmalware,andexaminesthefeasibilityofuniversalandautomatedun-packingforAndroidapplica0ons.

Page 4: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

AppSpear•  AppSpearisagenericandfinegrainedsystemforautoma0cmalwareunpacking.•  Its core technique is a bytecode decryp0ng and Dalvik executable (DEX)

reassemblingmethod,which isable to recoveranyprotectedbytecodeeffec0velywithouttheknowledgeofthepacker.

•  AppSpear directly instruments the Dalvik VM to collect the decrypted bytecodeinforma0on from the Dalvik Data Struct (DDS), and performs the unpacking byconduc0ngarefinedreassemblingprocesstocreateanewDEXfile.

•  The unpacked applica0on is then available for analyzing by malware detec0onsystems.

•  AppSpearisthefirstautoma0candgenericunpackingsystemforcurrentcommercialAndroidpackers.

Page 5: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

Goal1. Thorough inves0ga0on is done on large-scale Androidmalware samples to takesta0s0cs of how widespread those malware samples are protected by Androidpackers.

a) 10popular commercialandroidpackersare studiedwhichareusedby malwareauthors,alsowhichcoversthemajorityofexis0ngtechniquesand thentheinves0ga0onisconductedon37,688malwaresamples. b) Thiscontains490codepackedmalware.

2. To address the challenge of analyzing code packed malware, Authors haveproposedAppSpearwhichisagenericandfinegrainedsystemforautoma0cmalwareunpacking.

Page 6: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

Contribu0ons

•  Thorough inves0ga0on on both exis0ng mainstream Android packers and codepackedAndroidmalware isdone in thewildand furthersummarizing typicalan0-analysisdefensesofAndroidpackers.

•  A bytecode decryp0ng and DEX reassembling technique is proposed to rebuildprotectedapps.OurAPKrebuildingprocesstransformsacodepackedmalwaretoanunpackedone,whichisafeasibleformforcommodityprogramanalysis.

•  Designofautomatedandgenericunpackingsystem,AppSpearisdonetodealwithmost mainstream Android packers and the unpacked apps can be validated bystate-of-the-art analysis tools, which are not able to handle the packed formbeforehand.

Page 7: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

CodePackedAndroidMalware•  Inves0ga0onof10popularcommercialAndroidpackers(Bangcle,Ijiami,Qihoo360,

etc)andbuildasignaturedatabase.•  Collected37,668malwaresamplesfrom2012toMay2015usingSandDroid,which

detectsmalware according to the feedback results of 12main virus scan enginesfromVirusTotal(F-Secure,Symantec,An0Vir,ESET-NOD32,Kaspersky,BitDefender,McAfee,For0net,Ad-Aware,AVG,Baidu-Interna0onal,Qihoo-360).

•  Anappisregardedasmalwareifmorethanthreevirusscanenginesdetectit.

Page 8: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

SummaryofPackedAndroidMalware

Page 9: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

Analysis

•  Analysis indicates that an0-analysis defenses employed by those packers can beclassifiedintothreecategories.a)Thefirstcategoryofan0-analysisdefensesinvolvefunc0onsthatcheckthesta0c

anddynamicintegrityoftheapp.b) The second category of an0-analysis measures involve source code levelobfusca0on,whichrequiresthesourcecodetoemploytheprotec0on.c)Thethirdcategory,whichismostcomplex,involvesbytecodehiding.

•  Theintegrityisalsocheckedforthepackedappstodecideiftheappsaretamperedanditischeckedwithbothsta0canddynamicprocess.

Page 10: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

AppSpear-OverviewAppSpearemploystheunpackingthroughthreemainsteps:•  AppSpear introspects the Dalvik VM to

transparently monitor the execu0on of anypackedapp.

•  AppSpear collects DDS in memory andperforms a reassembling process on thecollected DDS with some modified methodsfixedtore-generateaDEXfile.

•  Finally, AppSpear resects an0-analysis codeand further synthesizes the DEX file with themanifest le and other resource les from theoriginalpackedAPKasanunpackedAPK.

Page 11: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

DEXReassembling•  DEXreassemblingofAppSpearisareverseprocessoftheDEXloadingprocedure.•  AppSpearleveragesthistoemploytheDEXreassemblingprocess.•  DalvikVMmaintains18DDSparsedfromaDEXleduringrun0me.•  DDScanclassifiedintotwotypes:

a) IndexDDS(IDDS)includingHeader,StringId,TypeId,ProtoId,FieldId,MethodId, ClassDefandMapList.Themainfunc0onalityofIDDSistoindextherealoffsetofthesecondtypeofDDS.b) ContentDDS(CDDS)includingTypeList,ClassData,Code,StringData,DebugInfo, EncodedArrayand four items related toAnnota0on.This typeofDDSmainlystorerawdataofbyte-codecontentinforma0on.

Page 12: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

DEXReassemblingContd..

Page 13: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

APKRebuilding•  AppSpearperformsalaststepAPKrebuildingtoobstructanalysis.

a)An0-analysisCodeResec0ng: AppSpear maintains an empirical database of code stubs and automa0callyresectsanycodestubsindatabasewhenencountering.

b)APKRepackaging: AppSpear combines the reassembledDEX lewithmaterials from theexis0ng packed app including manifests.xml and resource files to repackage the app. Themanifests leof anappdeclares thepermissionsand theentrypointsof theappandthesearedirectlyusedintherepackagedapp.

Page 14: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

ExperimentalEvalua0on•  31packedmalwareweremanuallychosenfromthecollected490packedsamples

ofSandDroidtotestAppSpear.•  These31samplescouldrunwithoutcrashesorexcep0onsbeforeunpackingandare

allofdifferentpackagenames.•  Authorsdevelopedahomebrewedmaliciousappthatrequiresmanypermissions

andcollectssensi7vedata.•  The test app contains all four main components (Ac0vity, Service, Broadcast

Receiver,ContentProvider)andanApplica0onclass.•  TestappissubmiXedto7onlinepackingservicesofBangcle(a.k.aSecneo),Ijiami,

Qihoo360,Baidu,Alibaba,LIAPPandDex-Protector.

Page 15: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

ExperimentalEvalua0on•  AppSpearisdeployedontwodevices,GalaxyNexusandNexus4.•  VersionsofAndroidopera0ngsystemare4.3and4.4.2.•  ModifiedDalvikVMisbuiltbasedontheAOSPsourcecodeandreplacethedefault

DalvikVMwiththeAppSpearintegratedone.•  AppSpear conducts the unpacking as soon as theMain Ac0vity class invokes the

onCreatemethod.•  Allofthesamplesareunpackedautoma0callyandthecorrespondingunpackedAPK

lesaregenerated.

Page 16: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

AccuracyofDEXreassembling•  TheaccuracyoftheDEXreassemblingisdoneusingthe5popularandwidelyused

sta0ctoolsandtheyareEXTemplatefor010Editor,Baksmali,Enjarify,IDAProandAndroGuard.

•  Thetes0ngsetconsistsof7homebrewedsamplessubmiXedtoonlinepackersand31malwaresamplesfromthecollected490packedsamples,whichcovers10differentpackersaltogether.

•  TheresultaboveshowsthatDEXTemplatefor010Editor,IDAProandAndroGuardsuccessfullyparseallreassembledDEXfiles.

Page 17: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

Relatedwork•  Polyunpack: Performsautoma0cunpackingbyemula0ngtheexecu0onoftheprogramandmonitoringall memory writes and instruc0on fetches, and considers all instruc0ons fetched frompreviouslywriXenmemoryloca0onstobesuccessfullyunpacked.•  Omniunpack:

Is a real-0me unpacker that performs unpacking by looking for wriXen-then-executepaXern.•  Renovo:

Uses the wriXen-then-execute paXern to perform the unpacking. It instruments theexecu0onofthebinaryinanemulatorandtracestheexecu0onatinstruc0on-level.•  Eureka:

Usescoarse-grainedNTDLLsystemcallmonitoring forautomatedmalwareunpacking, isonlyavailableforWindowspackers.

Page 18: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

Conclusion

•  Thispaperismainlyaboutthesystema0cstudyofcodepackedAndroidmalware.•  An inves0ga0on of 37,688 Androidmalware samples is conducted and 490 code

packedappsareanalyzedwiththehelpofAppSpear.•  AppSpearemploysanovelbytecodedecryp0ngandDEXreassemblingapproachto

replacetradi0onalmanualanalysisandmemorydumpbasedunpacking.•  Experiments have demonstrated that AppSpear system is able to unpack most

malwaresamplesprotectedbypopularcommercialAndroidpackers.•  AppSpearismostessen0alprocessofcurrentAndroidmalwaredetec0on.

Page 19: AppSpear: Bytecode Decryp0ng and DEX Reassembling for ...webpages.eng.wayne.edu/~fy8421/16fa-csc6991/slides/... · and tedious, or based on coarse-grained memory dumping. • Inves0gaon

ThankYou