SlideShare a Scribd company logo
Memory Analysis of the Dalvik (Android) Virtual MachineAndrew CaseDigital Forensics Solutions
Who Am I?Security Analyst at Digital Forensics SolutionsAlso perform wide ranging forensics investigationsVolatility DeveloperFormer Blackhat and DFRWS speaker2
AgendaWhat is Dalvik / why do we care?Brief overview of memory forensicsExtracting allocated and historical data from DalvikinstancesTarget specific Android applications3
What is Dalvik?Dalvik is the software VM for all Android applicationsNearly identical to the Java Virtual Machine (JVM) [1]Open source, written in C / Java4
Why do we care?Android-based phones leading in US mobile marketWhich makes for many phones to investigateMemory forensics capabilities against Android applications have numerous uses/implicationsEntire forensics community (LEO,  .gov, private firms) already urging development of such capabilities5
Memory Forensics IntroductionMemory forensics is vital to orderly recovery of runtime informationUnstructured methods (strings, grep, etc) are brittle and only recover superficial infoStructured methods allow for recovery of data structures, variables, and code from memoryPrevious work at operating system level led to recovery of processes, open files, network connections, etc [4,5]6
Memory Analysis ProcessFirst, need to acquire memory Acquisition depends on environment [6]Next, requires locating information in memory and interpreting it correctlyAlso requires re-implementing functionality offlineThen it needs to be displayed in a useful way to the investigator7
Dalvik Memory Analysis8
Acquiring Memory – Approach 1The normal method is to acquire a complete capture of physical RAMWorks well when analyzing kernel data structures as their pages are not swapped outAllows for recovery of allocated and historical processes, open files, network connections, and so on9
Approach 1 on AndroidWithout /dev/mem support, need a LKM to read memoryNo current module works for Android (ARM)We developed our own (mostly by @jtsylve)Benefits of full capture:Can target any process (including its mappings)Can recover information from unmapped pages in processes10
Acquiring Memory – Approach 2Memory can be acquired on a per-process basisEnsures that all pages of the process will be acquiredEasiest to perform with memfetch[8]After a few small changes, was statically compiled for ARMNo unmapped pages will be recovered thoughHeap and GC don’t munmap immediately11
Analyzing C vs JavaMost previous forensics research has had the “luxury” of analyzing CNearly 1:1 mapping of code/data to in-memory layoutDeclaration of a C “string”char buffer[] = “Hello World”;Memory Layout (xxd)4865 6c6c 6f20 576f 726c 6400  Hello World.12
A Dalvik String in MemoryFirst, need the address of the “StringObject”Next, need the offsets of the “java/lang/String” value and byte offset membersStringObject + value offset leads us to an “ArrayObject”ArrayObject + byte offset leads to an UTF-16 array of characters… finally we have the string (in Unicode)13
Now for the memory analysis…The real goal of the research was to be able to locate arbitrary class instances and fields in memoryOther goals included replicating commonly used features of the Android debugging framework14
Locating Data StructuresThe base of Dalvik loads as a shared library (libdvm.so)Contains global variables that we use to locate classes and other informationAlso contains the C structures needed to parse and gather evidence we need15
Gathering libdvm’s StructuresGrab the shared library from the phone (adb)	2) Use Volatility’s dwarfparse.py:Builds a profile of C structures along with members, types, and byte offsets
Records offsets of global variables3) Example structure definition'ClassObject': [ 0xa0, {		Class name and size	'obj': [0x0, ['Object']],	 member name, offset, 				and type16
Volatility Plugin SampleAccessing structures is as simple as knowing     	the type and offset intval = obj.Object(“int”, offset=intOffset, ..)Volatility code to access ‘descriptor’ of an 	‘Object’:	o = obj.Object("Object", offset=objectAddress, ..)	c = obj.Object("ClassObject", offset=o.clazz, …)desc = linux_common.get_string(c.descriptor)17
gDvmgDvm is a global structure of type DvmGlobalsHolds info about a specific Dalvik instanceUsed to locate a number of structures needed for analysis18
Locating Loaded ClassesgDvm.loadedClasses is a hash table of ClassObjectsfor each loaded classHash table is stored as an arrayAnalysis code walks the backing array and handles active entriesInactive entries are NULL or have a pointer value of 0xcbcacccd19
Information Per ClassType and (often) name of the source code fileInformation on backing DexFileDexFilestores everything Dalvik cares about for a binaryData FieldsStaticInstanceMethodsName and TypeLocation of Instructions20
Static FieldsStored once per class (not instance)Pre-initialized if knownStored in an array with element type StaticFieldLeads directly to the value of the specific field21
Instance FieldsPer instance of a ClassFields are stored in an array of element type InstFieldOffset of each field stored in byteOffsetmemberRelative offset from ClassObjectstructure22
Listing Instance MembersSource file: ComposeMessageActivity.java Class: Lcom/android/mms/ui/ComposeMessageActivity;Instance Fields:	name:        m_receiversignature:  Landroid/content/BroadcastReceiver; name:        m_filtersignature: Landroid/content/IntentFilter;	name:        mAppContextsignature:  Landroid/content/Context; name:       mAvailableDirPathsignature: Ljava/lang/String; 23
Analyzing MethodsWe can enumerate all methods (direct, virtual) and retrieve names and instructionsNot really applicable to this talkCan be extremely useful for malware analysis thoughIf .apk is no longer on disk or if code was changed at runtime24
Methods in Memory vs on DiskDalvik makes a number of runtime optimizations [1]Example: When class members are accessed (iget, iput) the field table index is replaced with the direct byte offsetWould likely need to undo some of the optimizations to get complete baksmali output 25
Analyzing Specific Applications26
Recovery ApproachBest approach seems to be locating data structures of UI screensUI screens represented by uniform (single type) lists of displayed informationData for many views are pre-loaded27
Finding Data StructuresCan save substantial time by using adb’slogcat(next slide)Shows the classes and often methods involved in handling UI eventsOtherwise, need to examine source codeSome applications are open sourceOthers can be “decompiled” with baksmali [9]28
logcat exampleThe following is a snippet of output when clicking on the text message view:D/ConversationList(12520): onResume StartD/ComposeMessageActivity(12520): onConatctInfoChangeD/RecipientList(12520): mFilterHandler not nullD/RecipientList(12520): get recipient: 0D/RecipientList(12520): r.name: John SmithD/RecipientList(12520): r.filter() return resultD/RecipientList(12520): indexOf(r)0D/RecipientList(12520): prepare set, index/name: 0/John Smith29
Phone Call HistoryCall history view controlled through a DialerContactCard$OnCardClickListenerEach contact stored as a DialerContactCardContains the name, number, convo length, and photo of contact30
Per Contact Call HistoryCan (sometimes) retrieve call history per-contactRequires the user to actually view a contact’s history before being populated31
Text MessagesRecovery through ComposeMessageActivity & TextMessageViewComplete conversations can be recovered Not pre-populated32
VoicemailAudio file is open()’edNot mapped contiguously into the process address spaceNo method to recover deleted voicemails..33
Browser (Opera Mini)Opera Mini is the most used mobile browserCan recover some session informationThe history file is always mapped in memory (including information from current session)HTTP requests and page information is (possibly) recoverableCan recover <title> informationStored in Opera Binary Markup LanguageNot publicly documented? 34
Recovering Wireless InformationScreenshot on the right shows results of a scan for wireless networksRecovery of this view provides the SSID, MAC address, and enc type for routers foundRecovery of “Connected” routers show which were associated with35
Other Wireless InformationPotentially interesting information:Wireless keysConnection statsThese are not controlled by DalvikKeys only initially entered through Dalvik, but then savedStored by the usual Linux applicationswpa_supplicant, dhcpd, in-kernel stats36
Location RecoveryAssociating location & time not always importantBut makes for better slides *hint*Interesting for a number of reasonsForensics & Privacy concernsNot part of a “standard” forensics investigation37
Google MapsDid not do source code analysisMost phones won’t be using Google Maps while being seizedWanted to find ways to get historical data cleanlyFound two promising searchesmTime=TIME,mLatitude=LAT,mLongitude=LONpoint: LAT,LON … lastFix: TIMETIME is the last location, extra work needed to verify38
“Popular” Weather ApplicationThe weather application uses your location to give you relevant informationhttp://vendor.site.com/widget/search.asp? lat=LAT&lon=LON&nocache=TIME39
More GPS FunAll of the following applications do not clear GPS data from memory, and all send their lat/lon using GET with HTTPUrban SpoonWeather ChannelWeatherBugYelpGrouponMovies40
ImplementationRecovery code written as Volatility [7] pluginsMost popular memory analysis frameworkHas support for all Windows versions since XP and 2.6 Intel LinuxNow also supports ARM Linux/AndroidMakes rapid development of memory analysis capabilities simpleAlso can be used for analyzing other binary formats41
TestingTested against a HTC EVO 4GNo phone-specific features used in analysisOnly a few HTC-specific packages were analyzedVisually tested against other Dalvik versionsNo drastic changes in core Dalvik functionality 42
Research ApplicationsMemory forensics (obviously)Testing of privacy assurancesMalware analysisCan enumerate and recover methods and their instructions43
Future Avenues of ResearchNumerous applications with potentially interesting informationToo much to manually dig through Need automationBaksmali/Volatility/logcat integration?Automated determination of interesting evidence across the whole systemCombing work done in [2] and [3]44
Questions/Comments?andrew@digdeeply.com@attrc45
References - 1[1] http://bit.ly/dalvikvsjava[2] Brendan Dolan-Gavitt, et al, “Virtuoso: Narrowing 	the Semantic Gap in Virtual Machine 	Introspection”, IEEE Security and Privacy, 2011[3] TaintDroid, http://www.appanalysis.org/[4] http://bit.ly/windowsmemory [5] http://bit.ly/linuxmem [6] http://bit.ly/memimaging[7] http://code.google.com/p/volatility/[8] http://lcamtuf.coredump.cx/soft/memfetch.tgz46
Ad

Recommended

Android Mind Reading: Android Live Memory Analysis with LiME and Volatility
Android Mind Reading: Android Live Memory Analysis with LiME and Volatility
Joe Sylve
 
Memory Analysis of the Dalvik (Android) Virtual Machine
Memory Analysis of the Dalvik (Android) Virtual Machine
Andrew Case
 
Live Memory Forensics on Android devices
Live Memory Forensics on Android devices
Nikos Gkogkos
 
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
Andrew Case
 
Windows Memory Forensic Analysis using EnCase
Windows Memory Forensic Analysis using EnCase
Takahiro Haruyama
 
Linux Memory Analysis with Volatility
Linux Memory Analysis with Volatility
Andrew Case
 
Mac Memory Analysis with Volatility
Mac Memory Analysis with Volatility
Andrew Case
 
Next Generation Memory Forensics
Next Generation Memory Forensics
Andrew Case
 
Hunting Mac Malware with Memory Forensics
Hunting Mac Malware with Memory Forensics
Andrew Case
 
Malware analysis using volatility
Malware analysis using volatility
Yashashree Gund
 
Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshop
Tamas K Lengyel
 
Memory forensics
Memory forensics
Sunil Kumar
 
(120513) #fitalk an introduction to linux memory forensics
(120513) #fitalk an introduction to linux memory forensics
INSIGHT FORENSIC
 
Workshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with Volatility
Andrew Case
 
Unmasking Careto through Memory Forensics (video in description)
Unmasking Careto through Memory Forensics (video in description)
Andrew Case
 
One-Byte Modification for Breaking Memory Forensic Analysis
One-Byte Modification for Breaking Memory Forensic Analysis
Takahiro Haruyama
 
I Know You Want Me - Unplugging PlugX
I Know You Want Me - Unplugging PlugX
Takahiro Haruyama
 
Winnti Polymorphism
Winnti Polymorphism
Takahiro Haruyama
 
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
RootedCON
 
REMnux tutorial-2: Extraction and decoding of Artifacts
REMnux tutorial-2: Extraction and decoding of Artifacts
Rhydham Joshi
 
Detect Kernel-Mode Rootkits via Real Time Logging & Controlling Memory Access
Detect Kernel-Mode Rootkits via Real Time Logging & Controlling Memory Access
Igor Korkin
 
Volatile IOCs for Fast Incident Response
Volatile IOCs for Fast Incident Response
Takahiro Haruyama
 
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON
 
44CON London 2015: NTFS Analysis with PowerForensics
44CON London 2015: NTFS Analysis with PowerForensics
Jared Atkinson
 
Applying Memory Forensics to Rootkit Detection
Applying Memory Forensics to Rootkit Detection
Igor Korkin
 
REMnux Tutorial-3: Investigation of Malicious PDF & Doc documents
REMnux Tutorial-3: Investigation of Malicious PDF & Doc documents
Rhydham Joshi
 
Remnux tutorial-1 Statically Analyse Portable Executable(PE) Files
Remnux tutorial-1 Statically Analyse Portable Executable(PE) Files
Rhydham Joshi
 
Forensics of a Windows System
Forensics of a Windows System
Conferencias FIST
 
Lect1.pptx
Lect1.pptx
muhammadRamzan816406
 
DotNet Introduction
DotNet Introduction
Wei Sun
 

More Related Content

What's hot (20)

Hunting Mac Malware with Memory Forensics
Hunting Mac Malware with Memory Forensics
Andrew Case
 
Malware analysis using volatility
Malware analysis using volatility
Yashashree Gund
 
Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshop
Tamas K Lengyel
 
Memory forensics
Memory forensics
Sunil Kumar
 
(120513) #fitalk an introduction to linux memory forensics
(120513) #fitalk an introduction to linux memory forensics
INSIGHT FORENSIC
 
Workshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with Volatility
Andrew Case
 
Unmasking Careto through Memory Forensics (video in description)
Unmasking Careto through Memory Forensics (video in description)
Andrew Case
 
One-Byte Modification for Breaking Memory Forensic Analysis
One-Byte Modification for Breaking Memory Forensic Analysis
Takahiro Haruyama
 
I Know You Want Me - Unplugging PlugX
I Know You Want Me - Unplugging PlugX
Takahiro Haruyama
 
Winnti Polymorphism
Winnti Polymorphism
Takahiro Haruyama
 
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
RootedCON
 
REMnux tutorial-2: Extraction and decoding of Artifacts
REMnux tutorial-2: Extraction and decoding of Artifacts
Rhydham Joshi
 
Detect Kernel-Mode Rootkits via Real Time Logging & Controlling Memory Access
Detect Kernel-Mode Rootkits via Real Time Logging & Controlling Memory Access
Igor Korkin
 
Volatile IOCs for Fast Incident Response
Volatile IOCs for Fast Incident Response
Takahiro Haruyama
 
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON
 
44CON London 2015: NTFS Analysis with PowerForensics
44CON London 2015: NTFS Analysis with PowerForensics
Jared Atkinson
 
Applying Memory Forensics to Rootkit Detection
Applying Memory Forensics to Rootkit Detection
Igor Korkin
 
REMnux Tutorial-3: Investigation of Malicious PDF & Doc documents
REMnux Tutorial-3: Investigation of Malicious PDF & Doc documents
Rhydham Joshi
 
Remnux tutorial-1 Statically Analyse Portable Executable(PE) Files
Remnux tutorial-1 Statically Analyse Portable Executable(PE) Files
Rhydham Joshi
 
Forensics of a Windows System
Forensics of a Windows System
Conferencias FIST
 
Hunting Mac Malware with Memory Forensics
Hunting Mac Malware with Memory Forensics
Andrew Case
 
Malware analysis using volatility
Malware analysis using volatility
Yashashree Gund
 
Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshop
Tamas K Lengyel
 
Memory forensics
Memory forensics
Sunil Kumar
 
(120513) #fitalk an introduction to linux memory forensics
(120513) #fitalk an introduction to linux memory forensics
INSIGHT FORENSIC
 
Workshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with Volatility
Andrew Case
 
Unmasking Careto through Memory Forensics (video in description)
Unmasking Careto through Memory Forensics (video in description)
Andrew Case
 
One-Byte Modification for Breaking Memory Forensic Analysis
One-Byte Modification for Breaking Memory Forensic Analysis
Takahiro Haruyama
 
I Know You Want Me - Unplugging PlugX
I Know You Want Me - Unplugging PlugX
Takahiro Haruyama
 
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
RootedCON
 
REMnux tutorial-2: Extraction and decoding of Artifacts
REMnux tutorial-2: Extraction and decoding of Artifacts
Rhydham Joshi
 
Detect Kernel-Mode Rootkits via Real Time Logging & Controlling Memory Access
Detect Kernel-Mode Rootkits via Real Time Logging & Controlling Memory Access
Igor Korkin
 
Volatile IOCs for Fast Incident Response
Volatile IOCs for Fast Incident Response
Takahiro Haruyama
 
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON
 
44CON London 2015: NTFS Analysis with PowerForensics
44CON London 2015: NTFS Analysis with PowerForensics
Jared Atkinson
 
Applying Memory Forensics to Rootkit Detection
Applying Memory Forensics to Rootkit Detection
Igor Korkin
 
REMnux Tutorial-3: Investigation of Malicious PDF & Doc documents
REMnux Tutorial-3: Investigation of Malicious PDF & Doc documents
Rhydham Joshi
 
Remnux tutorial-1 Statically Analyse Portable Executable(PE) Files
Remnux tutorial-1 Statically Analyse Portable Executable(PE) Files
Rhydham Joshi
 
Forensics of a Windows System
Forensics of a Windows System
Conferencias FIST
 

Similar to Forensic Memory Analysis of Android's Dalvik Virtual Machine (20)

Lect1.pptx
Lect1.pptx
muhammadRamzan816406
 
DotNet Introduction
DotNet Introduction
Wei Sun
 
Daniel Krasner - High Performance Text Processing with Rosetta
Daniel Krasner - High Performance Text Processing with Rosetta
PyData
 
Interview Question of Aspdotnet
Interview Question of Aspdotnet
MohitKumar1985
 
Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02
Wei Sun
 
Debugging With Id
Debugging With Id
guest215c4e
 
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Emery Berger
 
Java Hates Linux. Deal With It.
Java Hates Linux. Deal With It.
Greg Banks
 
Software Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in Java
Isuru Perera
 
T3_Embedded programing_07072022T3_Embedded programing_07072022.pptx
T3_Embedded programing_07072022T3_Embedded programing_07072022.pptx
HuyTrn352093
 
20100309 03 - Vulnerability analysis (McCabe)
20100309 03 - Vulnerability analysis (McCabe)
LeClubQualiteLogicielle
 
Bangladesh Bank Assistant Maintenance Engineer Question Solution.
Bangladesh Bank Assistant Maintenance Engineer Question Solution.
Engr. Md. Jamal Uddin Rayhan
 
Test Bank for Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition Jas...
Test Bank for Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition Jas...
kuervoingvar25
 
DDS Advanced Tutorial - OMG June 2013 Berlin Meeting
DDS Advanced Tutorial - OMG June 2013 Berlin Meeting
Jaime Martin Losa
 
iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)
Netcetera
 
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)
IJERD Editor
 
Bugs Ex Ante by Kristaps Dzonsons
Bugs Ex Ante by Kristaps Dzonsons
eurobsdcon
 
Linux Assignment 3
Linux Assignment 3
Diane Allen
 
Introduction to databae eChapter 1-.pptx
Introduction to databae eChapter 1-.pptx
MAHERMOHAMED27
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation Systems
National Cheng Kung University
 
DotNet Introduction
DotNet Introduction
Wei Sun
 
Daniel Krasner - High Performance Text Processing with Rosetta
Daniel Krasner - High Performance Text Processing with Rosetta
PyData
 
Interview Question of Aspdotnet
Interview Question of Aspdotnet
MohitKumar1985
 
Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02
Wei Sun
 
Debugging With Id
Debugging With Id
guest215c4e
 
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Emery Berger
 
Java Hates Linux. Deal With It.
Java Hates Linux. Deal With It.
Greg Banks
 
Software Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in Java
Isuru Perera
 
T3_Embedded programing_07072022T3_Embedded programing_07072022.pptx
T3_Embedded programing_07072022T3_Embedded programing_07072022.pptx
HuyTrn352093
 
20100309 03 - Vulnerability analysis (McCabe)
20100309 03 - Vulnerability analysis (McCabe)
LeClubQualiteLogicielle
 
Bangladesh Bank Assistant Maintenance Engineer Question Solution.
Bangladesh Bank Assistant Maintenance Engineer Question Solution.
Engr. Md. Jamal Uddin Rayhan
 
Test Bank for Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition Jas...
Test Bank for Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition Jas...
kuervoingvar25
 
DDS Advanced Tutorial - OMG June 2013 Berlin Meeting
DDS Advanced Tutorial - OMG June 2013 Berlin Meeting
Jaime Martin Losa
 
iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)
Netcetera
 
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)
IJERD Editor
 
Bugs Ex Ante by Kristaps Dzonsons
Bugs Ex Ante by Kristaps Dzonsons
eurobsdcon
 
Linux Assignment 3
Linux Assignment 3
Diane Allen
 
Introduction to databae eChapter 1-.pptx
Introduction to databae eChapter 1-.pptx
MAHERMOHAMED27
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation Systems
National Cheng Kung University
 
Ad

More from Source Conference (20)

Million Browser Botnet
Million Browser Botnet
Source Conference
 
iBanking - a botnet on Android
iBanking - a botnet on Android
Source Conference
 
I want the next generation web here SPDY QUIC
I want the next generation web here SPDY QUIC
Source Conference
 
From DNA Sequence Variation to .NET Bits and Bobs
From DNA Sequence Variation to .NET Bits and Bobs
Source Conference
 
Extracting Forensic Information From Zeus Derivatives
Extracting Forensic Information From Zeus Derivatives
Source Conference
 
How to Like Social Media Network Security
How to Like Social Media Network Security
Source Conference
 
Wfuzz para Penetration Testers
Wfuzz para Penetration Testers
Source Conference
 
Security Goodness with Ruby on Rails
Security Goodness with Ruby on Rails
Source Conference
 
Securty Testing For RESTful Applications
Securty Testing For RESTful Applications
Source Conference
 
Esteganografia
Esteganografia
Source Conference
 
Men in the Server Meet the Man in the Browser
Men in the Server Meet the Man in the Browser
Source Conference
 
Advanced Data Exfiltration The Way Q Would Have Done It
Advanced Data Exfiltration The Way Q Would Have Done It
Source Conference
 
Adapting To The Age Of Anonymous
Adapting To The Age Of Anonymous
Source Conference
 
Are Agile And Secure Development Mutually Exclusive?
Are Agile And Secure Development Mutually Exclusive?
Source Conference
 
Advanced (persistent) binary planting
Advanced (persistent) binary planting
Source Conference
 
Legal/technical strategies addressing data risks as perimeter shifts to Cloud
Legal/technical strategies addressing data risks as perimeter shifts to Cloud
Source Conference
 
Who should the security team hire next?
Who should the security team hire next?
Source Conference
 
The Latest Developments in Computer Crime Law
The Latest Developments in Computer Crime Law
Source Conference
 
JSF Security
JSF Security
Source Conference
 
How To: Find The Right Amount Of Security Spend
How To: Find The Right Amount Of Security Spend
Source Conference
 
iBanking - a botnet on Android
iBanking - a botnet on Android
Source Conference
 
I want the next generation web here SPDY QUIC
I want the next generation web here SPDY QUIC
Source Conference
 
From DNA Sequence Variation to .NET Bits and Bobs
From DNA Sequence Variation to .NET Bits and Bobs
Source Conference
 
Extracting Forensic Information From Zeus Derivatives
Extracting Forensic Information From Zeus Derivatives
Source Conference
 
How to Like Social Media Network Security
How to Like Social Media Network Security
Source Conference
 
Wfuzz para Penetration Testers
Wfuzz para Penetration Testers
Source Conference
 
Security Goodness with Ruby on Rails
Security Goodness with Ruby on Rails
Source Conference
 
Securty Testing For RESTful Applications
Securty Testing For RESTful Applications
Source Conference
 
Men in the Server Meet the Man in the Browser
Men in the Server Meet the Man in the Browser
Source Conference
 
Advanced Data Exfiltration The Way Q Would Have Done It
Advanced Data Exfiltration The Way Q Would Have Done It
Source Conference
 
Adapting To The Age Of Anonymous
Adapting To The Age Of Anonymous
Source Conference
 
Are Agile And Secure Development Mutually Exclusive?
Are Agile And Secure Development Mutually Exclusive?
Source Conference
 
Advanced (persistent) binary planting
Advanced (persistent) binary planting
Source Conference
 
Legal/technical strategies addressing data risks as perimeter shifts to Cloud
Legal/technical strategies addressing data risks as perimeter shifts to Cloud
Source Conference
 
Who should the security team hire next?
Who should the security team hire next?
Source Conference
 
The Latest Developments in Computer Crime Law
The Latest Developments in Computer Crime Law
Source Conference
 
How To: Find The Right Amount Of Security Spend
How To: Find The Right Amount Of Security Spend
Source Conference
 
Ad

Recently uploaded (20)

SAP Modernization Strategies for a Successful S/4HANA Journey.pdf
SAP Modernization Strategies for a Successful S/4HANA Journey.pdf
Precisely
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
June Patch Tuesday
June Patch Tuesday
Ivanti
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
High Availability On-Premises FME Flow.pdf
High Availability On-Premises FME Flow.pdf
Safe Software
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
Edge AI and Vision Alliance
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
SAP Modernization Strategies for a Successful S/4HANA Journey.pdf
SAP Modernization Strategies for a Successful S/4HANA Journey.pdf
Precisely
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
June Patch Tuesday
June Patch Tuesday
Ivanti
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
High Availability On-Premises FME Flow.pdf
High Availability On-Premises FME Flow.pdf
Safe Software
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
Edge AI and Vision Alliance
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 

Forensic Memory Analysis of Android's Dalvik Virtual Machine

  • 1. Memory Analysis of the Dalvik (Android) Virtual MachineAndrew CaseDigital Forensics Solutions
  • 2. Who Am I?Security Analyst at Digital Forensics SolutionsAlso perform wide ranging forensics investigationsVolatility DeveloperFormer Blackhat and DFRWS speaker2
  • 3. AgendaWhat is Dalvik / why do we care?Brief overview of memory forensicsExtracting allocated and historical data from DalvikinstancesTarget specific Android applications3
  • 4. What is Dalvik?Dalvik is the software VM for all Android applicationsNearly identical to the Java Virtual Machine (JVM) [1]Open source, written in C / Java4
  • 5. Why do we care?Android-based phones leading in US mobile marketWhich makes for many phones to investigateMemory forensics capabilities against Android applications have numerous uses/implicationsEntire forensics community (LEO, .gov, private firms) already urging development of such capabilities5
  • 6. Memory Forensics IntroductionMemory forensics is vital to orderly recovery of runtime informationUnstructured methods (strings, grep, etc) are brittle and only recover superficial infoStructured methods allow for recovery of data structures, variables, and code from memoryPrevious work at operating system level led to recovery of processes, open files, network connections, etc [4,5]6
  • 7. Memory Analysis ProcessFirst, need to acquire memory Acquisition depends on environment [6]Next, requires locating information in memory and interpreting it correctlyAlso requires re-implementing functionality offlineThen it needs to be displayed in a useful way to the investigator7
  • 9. Acquiring Memory – Approach 1The normal method is to acquire a complete capture of physical RAMWorks well when analyzing kernel data structures as their pages are not swapped outAllows for recovery of allocated and historical processes, open files, network connections, and so on9
  • 10. Approach 1 on AndroidWithout /dev/mem support, need a LKM to read memoryNo current module works for Android (ARM)We developed our own (mostly by @jtsylve)Benefits of full capture:Can target any process (including its mappings)Can recover information from unmapped pages in processes10
  • 11. Acquiring Memory – Approach 2Memory can be acquired on a per-process basisEnsures that all pages of the process will be acquiredEasiest to perform with memfetch[8]After a few small changes, was statically compiled for ARMNo unmapped pages will be recovered thoughHeap and GC don’t munmap immediately11
  • 12. Analyzing C vs JavaMost previous forensics research has had the “luxury” of analyzing CNearly 1:1 mapping of code/data to in-memory layoutDeclaration of a C “string”char buffer[] = “Hello World”;Memory Layout (xxd)4865 6c6c 6f20 576f 726c 6400 Hello World.12
  • 13. A Dalvik String in MemoryFirst, need the address of the “StringObject”Next, need the offsets of the “java/lang/String” value and byte offset membersStringObject + value offset leads us to an “ArrayObject”ArrayObject + byte offset leads to an UTF-16 array of characters… finally we have the string (in Unicode)13
  • 14. Now for the memory analysis…The real goal of the research was to be able to locate arbitrary class instances and fields in memoryOther goals included replicating commonly used features of the Android debugging framework14
  • 15. Locating Data StructuresThe base of Dalvik loads as a shared library (libdvm.so)Contains global variables that we use to locate classes and other informationAlso contains the C structures needed to parse and gather evidence we need15
  • 16. Gathering libdvm’s StructuresGrab the shared library from the phone (adb) 2) Use Volatility’s dwarfparse.py:Builds a profile of C structures along with members, types, and byte offsets
  • 17. Records offsets of global variables3) Example structure definition'ClassObject': [ 0xa0, { Class name and size 'obj': [0x0, ['Object']], member name, offset, and type16
  • 18. Volatility Plugin SampleAccessing structures is as simple as knowing the type and offset intval = obj.Object(“int”, offset=intOffset, ..)Volatility code to access ‘descriptor’ of an ‘Object’: o = obj.Object("Object", offset=objectAddress, ..) c = obj.Object("ClassObject", offset=o.clazz, …)desc = linux_common.get_string(c.descriptor)17
  • 19. gDvmgDvm is a global structure of type DvmGlobalsHolds info about a specific Dalvik instanceUsed to locate a number of structures needed for analysis18
  • 20. Locating Loaded ClassesgDvm.loadedClasses is a hash table of ClassObjectsfor each loaded classHash table is stored as an arrayAnalysis code walks the backing array and handles active entriesInactive entries are NULL or have a pointer value of 0xcbcacccd19
  • 21. Information Per ClassType and (often) name of the source code fileInformation on backing DexFileDexFilestores everything Dalvik cares about for a binaryData FieldsStaticInstanceMethodsName and TypeLocation of Instructions20
  • 22. Static FieldsStored once per class (not instance)Pre-initialized if knownStored in an array with element type StaticFieldLeads directly to the value of the specific field21
  • 23. Instance FieldsPer instance of a ClassFields are stored in an array of element type InstFieldOffset of each field stored in byteOffsetmemberRelative offset from ClassObjectstructure22
  • 24. Listing Instance MembersSource file: ComposeMessageActivity.java Class: Lcom/android/mms/ui/ComposeMessageActivity;Instance Fields: name: m_receiversignature: Landroid/content/BroadcastReceiver; name: m_filtersignature: Landroid/content/IntentFilter; name: mAppContextsignature: Landroid/content/Context; name: mAvailableDirPathsignature: Ljava/lang/String; 23
  • 25. Analyzing MethodsWe can enumerate all methods (direct, virtual) and retrieve names and instructionsNot really applicable to this talkCan be extremely useful for malware analysis thoughIf .apk is no longer on disk or if code was changed at runtime24
  • 26. Methods in Memory vs on DiskDalvik makes a number of runtime optimizations [1]Example: When class members are accessed (iget, iput) the field table index is replaced with the direct byte offsetWould likely need to undo some of the optimizations to get complete baksmali output 25
  • 28. Recovery ApproachBest approach seems to be locating data structures of UI screensUI screens represented by uniform (single type) lists of displayed informationData for many views are pre-loaded27
  • 29. Finding Data StructuresCan save substantial time by using adb’slogcat(next slide)Shows the classes and often methods involved in handling UI eventsOtherwise, need to examine source codeSome applications are open sourceOthers can be “decompiled” with baksmali [9]28
  • 30. logcat exampleThe following is a snippet of output when clicking on the text message view:D/ConversationList(12520): onResume StartD/ComposeMessageActivity(12520): onConatctInfoChangeD/RecipientList(12520): mFilterHandler not nullD/RecipientList(12520): get recipient: 0D/RecipientList(12520): r.name: John SmithD/RecipientList(12520): r.filter() return resultD/RecipientList(12520): indexOf(r)0D/RecipientList(12520): prepare set, index/name: 0/John Smith29
  • 31. Phone Call HistoryCall history view controlled through a DialerContactCard$OnCardClickListenerEach contact stored as a DialerContactCardContains the name, number, convo length, and photo of contact30
  • 32. Per Contact Call HistoryCan (sometimes) retrieve call history per-contactRequires the user to actually view a contact’s history before being populated31
  • 33. Text MessagesRecovery through ComposeMessageActivity & TextMessageViewComplete conversations can be recovered Not pre-populated32
  • 34. VoicemailAudio file is open()’edNot mapped contiguously into the process address spaceNo method to recover deleted voicemails..33
  • 35. Browser (Opera Mini)Opera Mini is the most used mobile browserCan recover some session informationThe history file is always mapped in memory (including information from current session)HTTP requests and page information is (possibly) recoverableCan recover <title> informationStored in Opera Binary Markup LanguageNot publicly documented? 34
  • 36. Recovering Wireless InformationScreenshot on the right shows results of a scan for wireless networksRecovery of this view provides the SSID, MAC address, and enc type for routers foundRecovery of “Connected” routers show which were associated with35
  • 37. Other Wireless InformationPotentially interesting information:Wireless keysConnection statsThese are not controlled by DalvikKeys only initially entered through Dalvik, but then savedStored by the usual Linux applicationswpa_supplicant, dhcpd, in-kernel stats36
  • 38. Location RecoveryAssociating location & time not always importantBut makes for better slides *hint*Interesting for a number of reasonsForensics & Privacy concernsNot part of a “standard” forensics investigation37
  • 39. Google MapsDid not do source code analysisMost phones won’t be using Google Maps while being seizedWanted to find ways to get historical data cleanlyFound two promising searchesmTime=TIME,mLatitude=LAT,mLongitude=LONpoint: LAT,LON … lastFix: TIMETIME is the last location, extra work needed to verify38
  • 40. “Popular” Weather ApplicationThe weather application uses your location to give you relevant informationhttp://vendor.site.com/widget/search.asp? lat=LAT&lon=LON&nocache=TIME39
  • 41. More GPS FunAll of the following applications do not clear GPS data from memory, and all send their lat/lon using GET with HTTPUrban SpoonWeather ChannelWeatherBugYelpGrouponMovies40
  • 42. ImplementationRecovery code written as Volatility [7] pluginsMost popular memory analysis frameworkHas support for all Windows versions since XP and 2.6 Intel LinuxNow also supports ARM Linux/AndroidMakes rapid development of memory analysis capabilities simpleAlso can be used for analyzing other binary formats41
  • 43. TestingTested against a HTC EVO 4GNo phone-specific features used in analysisOnly a few HTC-specific packages were analyzedVisually tested against other Dalvik versionsNo drastic changes in core Dalvik functionality 42
  • 44. Research ApplicationsMemory forensics (obviously)Testing of privacy assurancesMalware analysisCan enumerate and recover methods and their instructions43
  • 45. Future Avenues of ResearchNumerous applications with potentially interesting informationToo much to manually dig through Need automationBaksmali/Volatility/logcat integration?Automated determination of interesting evidence across the whole systemCombing work done in [2] and [3]44
  • 47. References - 1[1] http://bit.ly/dalvikvsjava[2] Brendan Dolan-Gavitt, et al, “Virtuoso: Narrowing the Semantic Gap in Virtual Machine Introspection”, IEEE Security and Privacy, 2011[3] TaintDroid, http://www.appanalysis.org/[4] http://bit.ly/windowsmemory [5] http://bit.ly/linuxmem [6] http://bit.ly/memimaging[7] http://code.google.com/p/volatility/[8] http://lcamtuf.coredump.cx/soft/memfetch.tgz46
  • 48. References - 2[9] baksmali - http://code.google.com/p/smali/47