SlideShare a Scribd company logo
1 of 41
Download to read offline
Android Mind Reading: Memory
Acquisition and Analysis with LiME
           and Volatility
                Joe Sylve
          joe@digdeeply.com
                @jtsylve
    Digital Forensics Solutions, LLC
   www.digitalforensicssolutions.com
About the Speaker
• Senior Security Researcher at Digital Forensics
  Solutions, LLC (New Orleans, La)
• GIAC Certified Forensic Analyst
• M.S. Computer Science
  – University of New Orleans




                                                    2
What We’ll Cover
•   Live Forensics
•   Traditional Linux Memory Forensics Overview
•   Problems with Android
•   Acquisition Tools (LiME)
•   Volatility
•   Demo



                                                  3
What is Live Forensics?
• Traditional Forensics Deals with Non-Volatile
  Data
  – Hard Drives
  – Removable Media
  – Etc
• Live Forensics Deals with Volatile Data
  – RAM Mostly
  – Must be collected from a running machine
  – Not as much control over the environment

                                                  4
Why Live Forensics?
• RAM dump provides both structured and
  unstructured information
• Strings: application data, fragments of
  communications, encryption keys, etc.
• Kernel and application structures
• Processes, open files, network structures, etc.



                                                    5
Why Live Forensics?
• Advanced Malware
• Encrypted or Temp File Systems
• Analysis
  – FatKit
  – Memparser
  – Volatility




                                   6
Android




          7
Not Just Phones




                  8
9
Acquisition




              10
Traditional Memory Acquisition
• Hardware
   –   JTAG
   –   Firewire
   –   Thunderbolt
   –   Can of Compressed Air
• Software
   – Full Physical Memory
        • /dev/(k)mem
        • Fmem
        • Crash
   – Process Specific
        • Ptrace
        • Core dumps


                                    11
Traditional Memory Acquisition
               (Android Edition)
• Hardware
   –   JTAG (unlikely)
   –   Firewire
   –   Thunderbolt
   –   Can of Compressed Air
• Software
   – Full Physical Memory
        • /dev/(k)mem
        • Fmem
        • Crash
   – Process Specific
        • Ptrace
        • Core dumps


                                        12
Fmem Internals
1. Obtaining the starting offset specified by the
   read operation.
2. Checking that the page corresponding to this
   offset is physical RAM and not part of a
   hardware device's address space.
3. Obtaining a pointer to the physical page
   associated with the offset.
4. Writing the contents of the acquired page to
   the userland output buffer.
                                                13
Fmem Internals
1. Obtaining the starting offset specified by the
   read operation.
2. Checking that the page corresponding to this
   offset is physical RAM and not part of a
   hardware device's address space.
3. Obtaining a pointer to the physical page
   associated with the offset.
4. Writing the contents of the acquired page to
   the userland output buffer.
                                                14
/proc/iomem
# cat /proc/iomem
02b00000-02efffff : msm_hdmi.0
03700000-039fffff : kgsl_phys_memory
03700000-039fffff : kgsl
03a00000-03a3ffff : ram_console
03b00000-03dfffff : msm_panel.0
20000000-2e7fffff : System RAM
 20028000-20428fff : Kernel text
 2044a000-2058ca13 : Kernel data
30000000-3bffffff : System RAM
a0000000-a001ffff : kgsl_reg_memory
a0000000-a001ffff : kgsl
a0200000-a0200fff : msm_serial_hs_bcm.0
a0300000-a0300fff : msm_sdcc.1
…



                                          15
Problem 1: dd
• dd if=/dev/fmem of=ram.dd
  count=yyyy skip=xxxx
• lseek( unsigned int fd, off_t
  offset, unsigned int origin)
• vfs_llseek(struct file *file,
  loff_t offset, int origin)
• Original Offset: 0x80000000
• Signed Extension:
  0xFFFFFFFF80000000
                                  16
Problem 1:dd
• Not really Fmem’s fault
• Problem is in implementation of Android’s dd
• However, it would still be suboptimal if dd
  worked
  – dd performs a read operation for every block
  – Context Switches




                                                   17
Fmem Internals
1. Obtaining the starting offset specified by the
   read operation.
2. Checking that the page corresponding to
   this offset is physical RAM and not part of a
   hardware device's address space.
3. Obtaining a pointer to the physical page
   associated with the offset.
4. Writing the contents of the acquired page to
   the userland output buffer.
                                                    18
/proc/iomem
# cat /proc/iomem
02b00000-02efffff : msm_hdmi.0
03700000-039fffff : kgsl_phys_memory
03700000-039fffff : kgsl
03a00000-03a3ffff : ram_console
03b00000-03dfffff : msm_panel.0
20000000-2e7fffff : System RAM
20028000-20428fff : Kernel text
2044a000-2058ca13 : Kernel data
30000000-3bffffff : System RAM
a0000000-a001ffff : kgsl_reg_memory
a0000000-a001ffff : kgsl
a0200000-a0200fff : msm_serial_hs_bcm.0
a0300000-a0300fff : msm_sdcc.1
…



                                          19
Problem 2: page_is_ram
• http://lxr.linux.no/#linux+v3.0.4/kernel/resource.
  c#L363
• Missing in Linux kernel on ARM (Android)
• Essentially walks iomem_resource in the kernel
  to find pages in the physical address space that
  are RAM
• Not cool to walk across pages that aren’t RAM
  (likely mapped to I/O devices, etc.)
• Can get the basic idea by looking at /proc/iomem

                                                   20
LiME Forensics
• Linux Memory Extractor
  – Formerly DMD
• Loadable Kernel Module
• Dump Memory directly to the SD card or over
  the network
  – Network dump over adb (Android Debug Bridge)
• Minimizes interaction between userland and
  kernelland
                                                   21
Linux Memory Extractor (LiME)
1. Parsing the kernel’s iomem_resource
   structure to learn the physical memory
   address ranges of system RAM.
2. Performing physical to virtual address
   translation for each page of memory.
3. Reading all pages in each range and writing
   them to either a file (typically on the device’s
   SD card) or a TCP socket.

                                                  22
LiME 1.1 Arguments
• path
   – Either a filename to write on the local system (SD Card) or tcp:<port>

• format
   – raw
         • Simply concatenates all System RAM ranges
   – padded
         • Starting from physical address 0, pads all non-System RAM ranges with 0s
   – lime
         • Each range is prepended with a fixed-sized header which contains address
           space information
         • Volatility address space developed to support this format

• dio (optional)
   – 1 to enable Direct IO attempt (default), 0 to disable

                                                                                      23
LiME (TCP)
$ adb push lime-evo.ko /sdcard/lime.ko
$ adb forward tcp:4444 tcp:4444
$ adb shell
$ su
# insmod /sdcard/lime.ko
“path=tcp:4444 format=lime”
Then on host:
$ nc localhost 4444 > evo.dump


                                         24
LiME (SD Card)
$ adb push lime-evo.ko /sdcard/lime.ko
$ adb shell
$ su
# insmod /sdcard/lime.ko
“path=/sdcard/dump.lime format=lime”




                                         25
Forensics Note
• Writing to SD card requires “violating” a common forensic
  rule of thumb:
• Order of Volatility
   – RAM  on-the-spot live forensics  non-volatile memory
     (hard drives, flash, etc.)  CDs, etc.
• Acquire and preserve most volatile evidence first
• On Android, the only non-volatile removable storage that
  we can use to store memory dump is the SD card
• Commonly underneath the battery
• Removable of battery == power failure for device!
• Solution: Tether Android phone, USB mode, image SD, then
  dump memory to SD

                                                              26
DEMO

Please do what you must to appease
       the Live Demo Gods…



                                     27
Testing for Soundness
1. Use emulator to get RAM snapshot
2. Use LiME to acquire RAM image
3. Compare (1) and (2) for identical pages




                                             28
Not Just Android…
• LiME works on Linux too!




                               29
Analysis
• We’ve got the RAM dumps so now what?
• Volatility
  – https://www.volatilesystems.com/default/volatility
• Andrew Case (@attrc)
  – Worked on Linux port of Volatility
  – Worked on ARM port 
  – Wrote LiME address space into Volatility



                                                         30
Volatility
• The goal is to recreate the set of commands
  that would be run on a Linux system to
  investigate activity and possible compromise




                                                 31
Recovered Process Information
• Process listing (ps aux)
  – Command line arguments are retrieved from
    userland*
• Memory Maps (/proc/<pid>/maps)
  – Can also recover (to disk) specific address ranges*
• Open Files (/proc/<pid>/fd)



                                                      32
Networking Information
•   Network interface information (ifconfig)
•   Open and listening sockets (netstat)
•   ARP tables (arp –a)
•   Routing table (route –n)
•   Routing cache (route –C)
•   Queued Packets
•   Netfilter NAT table (/proc/net/nf_conntrack)
    – Src/Dst IP, # of packets sent, and total bytes for each
      NAT’d connection

                                                                33
Misc. Information
• Kernel debug buffer (dmesg)
• Loaded kernel modules (lsmod)
• Mounted filesystems (mount, /proc/mounts)




                                              34
Historical Information
• kmem_cache
  – Provides a consistent and fast interface to allocate
    objects (C structures) of the same size
  – Keep freelists of previously allocated objects for
    fast allocation
• Walking the freelists provides an orderly
  method to recover previous structures


                                                       35
Historical Information
• Can recover a number of useful structures:
  – Processes
  – Memory Maps
  – Networking Information
• Two limitations:
  – The aggressiveness of the allocator (SLAB / SLUB)
    when removing freelists
  – Needed references being set to NULL or freed on
    deallocation

                                                        36
Other Cool Stuff
• See: Linux Memory Analysis with Volatility
  – 2011 Open Memory Forensics Workshop
  – Andrew Case
  – http://bit.ly/xVnwyP
• Rootkit detection
• Live CD Analysis
• Dalvik Analysis (coming)


                                               37
DEMO 2

If the first demo didn’t work this is
   going to be a really short one…



                                        38
Digital Forensics Solutions, LLC
• Registry Decoder
  – digitalforensicssolutions.com/registrydecoder/
• Scalpel
  – digitalforensicssolutions.com/Scalpel/
• LiME
  – digitalforensicssolutions.com/lime/




                                                     39
Digital Forensics Solutions, LLC
• DARPA Cyber Fast Track Awards (In Progress)
  – “Forensic Capabilities for Embedded File Systems”
  – “Automatically Generated Regular Expression-
    based Signatures for File Carving”
• Registry Decoder Enhancements (In Progress)
• Registry Decoder Training Workshop
  – August 16th
  – September 20th

                                                    40
Questions?
• Joe Sylve
   – joe@digdeeply.com
   – @jtsylve
• “Acquisition and analysis of volatile memory from
  android devices”
   – Digital Investigation (2012)
   – http://bit.ly/xFEPoj
• Digital Forensics Solutions, LLC
   – www.digitalforensicssolutions.com
   – dfsforensics.blogspot.com
   – @dfsforensics


                                                      41

More Related Content

What's hot

Android malware analysis
Android malware analysisAndroid malware analysis
Android malware analysisJason Ross
 
Thick Client Penetration Testing.pdf
Thick Client Penetration Testing.pdfThick Client Penetration Testing.pdf
Thick Client Penetration Testing.pdfSouvikRoy114738
 
Fantastic Red Team Attacks and How to Find Them
Fantastic Red Team Attacks and How to Find ThemFantastic Red Team Attacks and How to Find Them
Fantastic Red Team Attacks and How to Find ThemRoss Wolf
 
Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly
Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly
Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly Sam Bowne
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessNanik Tolaram
 
CNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: ShellcodeCNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: ShellcodeSam Bowne
 
CNIT 121: Computer Forensics Ch 1
CNIT 121: Computer Forensics Ch 1CNIT 121: Computer Forensics Ch 1
CNIT 121: Computer Forensics Ch 1Sam Bowne
 
Digital Forensics
Digital ForensicsDigital Forensics
Digital ForensicsOldsun
 
BadUSB — On accessories that turn evil by Karsten Nohl
BadUSB — On accessories that turn evil by Karsten NohlBadUSB — On accessories that turn evil by Karsten Nohl
BadUSB — On accessories that turn evil by Karsten NohlPriyanka Aash
 
CNIT 127 Ch 1: Before you Begin
CNIT 127 Ch 1: Before you BeginCNIT 127 Ch 1: Before you Begin
CNIT 127 Ch 1: Before you BeginSam Bowne
 
Fundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege EscalationFundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege Escalationnullthreat
 
Hierarchical Storage Management
Hierarchical Storage ManagementHierarchical Storage Management
Hierarchical Storage ManagementJaydeep Patel
 
Sisteme de Operare: Sisteme de fisiere
Sisteme de Operare: Sisteme de fisiereSisteme de Operare: Sisteme de fisiere
Sisteme de Operare: Sisteme de fisiereAlexandru Radovici
 
Windows Threat Hunting
Windows Threat HuntingWindows Threat Hunting
Windows Threat HuntingGIBIN JOHN
 
Study of Digital Forensics on Google Cloud Platform
Study of Digital Forensics on Google Cloud PlatformStudy of Digital Forensics on Google Cloud Platform
Study of Digital Forensics on Google Cloud PlatformSamuel Borthwick
 
127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on Linux127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on LinuxSam Bowne
 

What's hot (20)

Android malware analysis
Android malware analysisAndroid malware analysis
Android malware analysis
 
Thick Client Penetration Testing.pdf
Thick Client Penetration Testing.pdfThick Client Penetration Testing.pdf
Thick Client Penetration Testing.pdf
 
Fantastic Red Team Attacks and How to Find Them
Fantastic Red Team Attacks and How to Find ThemFantastic Red Team Attacks and How to Find Them
Fantastic Red Team Attacks and How to Find Them
 
Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly
Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly
Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
CNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: ShellcodeCNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: Shellcode
 
Mantra & Jap - Bhagwan Sri Ramana Maharshi Teachings in Hindi
Mantra & Jap - Bhagwan Sri Ramana Maharshi Teachings in HindiMantra & Jap - Bhagwan Sri Ramana Maharshi Teachings in Hindi
Mantra & Jap - Bhagwan Sri Ramana Maharshi Teachings in Hindi
 
CNIT 121: Computer Forensics Ch 1
CNIT 121: Computer Forensics Ch 1CNIT 121: Computer Forensics Ch 1
CNIT 121: Computer Forensics Ch 1
 
Android Binder: Deep Dive
Android Binder: Deep DiveAndroid Binder: Deep Dive
Android Binder: Deep Dive
 
Windows forensic artifacts
Windows forensic artifactsWindows forensic artifacts
Windows forensic artifacts
 
Digital Forensics
Digital ForensicsDigital Forensics
Digital Forensics
 
BadUSB — On accessories that turn evil by Karsten Nohl
BadUSB — On accessories that turn evil by Karsten NohlBadUSB — On accessories that turn evil by Karsten Nohl
BadUSB — On accessories that turn evil by Karsten Nohl
 
OSV - Unit - 3 - Concurrency
OSV - Unit - 3 - ConcurrencyOSV - Unit - 3 - Concurrency
OSV - Unit - 3 - Concurrency
 
CNIT 127 Ch 1: Before you Begin
CNIT 127 Ch 1: Before you BeginCNIT 127 Ch 1: Before you Begin
CNIT 127 Ch 1: Before you Begin
 
Fundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege EscalationFundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege Escalation
 
Hierarchical Storage Management
Hierarchical Storage ManagementHierarchical Storage Management
Hierarchical Storage Management
 
Sisteme de Operare: Sisteme de fisiere
Sisteme de Operare: Sisteme de fisiereSisteme de Operare: Sisteme de fisiere
Sisteme de Operare: Sisteme de fisiere
 
Windows Threat Hunting
Windows Threat HuntingWindows Threat Hunting
Windows Threat Hunting
 
Study of Digital Forensics on Google Cloud Platform
Study of Digital Forensics on Google Cloud PlatformStudy of Digital Forensics on Google Cloud Platform
Study of Digital Forensics on Google Cloud Platform
 
127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on Linux127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on Linux
 

Similar to Android Mind Reading: Android Live Memory Analysis with LiME and Volatility

Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsQUONTRASOLUTIONS
 
Mac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityMac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityAndrew Case
 
Live memory forensics
Live memory forensicsLive memory forensics
Live memory forensicsMehedi Hasan
 
Ganesh naik linux_kernel_internals
Ganesh naik linux_kernel_internalsGanesh naik linux_kernel_internals
Ganesh naik linux_kernel_internalsGanesh Naik
 
Ganesh naik linux_kernel_internals
Ganesh naik linux_kernel_internalsGanesh naik linux_kernel_internals
Ganesh naik linux_kernel_internalsnullowaspmumbai
 
Linux Memory Analysis with Volatility
Linux Memory Analysis with VolatilityLinux Memory Analysis with Volatility
Linux Memory Analysis with VolatilityAndrew Case
 
Larson Macaulay apt_malware_past_present_future_out_of_band_techniques
Larson Macaulay apt_malware_past_present_future_out_of_band_techniquesLarson Macaulay apt_malware_past_present_future_out_of_band_techniques
Larson Macaulay apt_malware_past_present_future_out_of_band_techniquesScott K. Larson
 
Android Forensics: Exploring Android Internals and Android Apps
Android Forensics: Exploring Android Internals and Android AppsAndroid Forensics: Exploring Android Internals and Android Apps
Android Forensics: Exploring Android Internals and Android AppsMoe Tanabian
 
PC hardware components ppt slide_week2.ppt
PC hardware components ppt slide_week2.pptPC hardware components ppt slide_week2.ppt
PC hardware components ppt slide_week2.pptvimala elumalai
 
(120513) #fitalk an introduction to linux memory forensics
(120513) #fitalk   an introduction to linux memory forensics(120513) #fitalk   an introduction to linux memory forensics
(120513) #fitalk an introduction to linux memory forensicsINSIGHT FORENSIC
 
(120513) #fitalk an introduction to linux memory forensics
(120513) #fitalk   an introduction to linux memory forensics(120513) #fitalk   an introduction to linux memory forensics
(120513) #fitalk an introduction to linux memory forensicsINSIGHT FORENSIC
 
Case study of BtrFS: A fault tolerant File system
Case study of BtrFS: A fault tolerant File systemCase study of BtrFS: A fault tolerant File system
Case study of BtrFS: A fault tolerant File systemKumar Amit Mehta
 
Memory hierarchy.pdf
Memory hierarchy.pdfMemory hierarchy.pdf
Memory hierarchy.pdfISHAN194169
 
Computer Architecture and organization
Computer Architecture and organizationComputer Architecture and organization
Computer Architecture and organizationBadrinath Kadam
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)MongoDB
 
Memory_Unit Cache Main Virtual Associative
Memory_Unit Cache Main Virtual AssociativeMemory_Unit Cache Main Virtual Associative
Memory_Unit Cache Main Virtual AssociativeRNShukla7
 
Blackhat USA 2016 - What's the DFIRence for ICS?
Blackhat USA 2016 - What's the DFIRence for ICS?Blackhat USA 2016 - What's the DFIRence for ICS?
Blackhat USA 2016 - What's the DFIRence for ICS?Chris Sistrunk
 

Similar to Android Mind Reading: Android Live Memory Analysis with LiME and Volatility (20)

Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra Solutions
 
Mac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityMac Memory Analysis with Volatility
Mac Memory Analysis with Volatility
 
Live memory forensics
Live memory forensicsLive memory forensics
Live memory forensics
 
You suck at Memory Analysis
You suck at Memory AnalysisYou suck at Memory Analysis
You suck at Memory Analysis
 
Ganesh naik linux_kernel_internals
Ganesh naik linux_kernel_internalsGanesh naik linux_kernel_internals
Ganesh naik linux_kernel_internals
 
Ganesh naik linux_kernel_internals
Ganesh naik linux_kernel_internalsGanesh naik linux_kernel_internals
Ganesh naik linux_kernel_internals
 
Linux Memory Analysis with Volatility
Linux Memory Analysis with VolatilityLinux Memory Analysis with Volatility
Linux Memory Analysis with Volatility
 
Larson Macaulay apt_malware_past_present_future_out_of_band_techniques
Larson Macaulay apt_malware_past_present_future_out_of_band_techniquesLarson Macaulay apt_malware_past_present_future_out_of_band_techniques
Larson Macaulay apt_malware_past_present_future_out_of_band_techniques
 
Android Forensics: Exploring Android Internals and Android Apps
Android Forensics: Exploring Android Internals and Android AppsAndroid Forensics: Exploring Android Internals and Android Apps
Android Forensics: Exploring Android Internals and Android Apps
 
PC hardware components ppt slide_week2.ppt
PC hardware components ppt slide_week2.pptPC hardware components ppt slide_week2.ppt
PC hardware components ppt slide_week2.ppt
 
Coa presentation3
Coa presentation3Coa presentation3
Coa presentation3
 
(120513) #fitalk an introduction to linux memory forensics
(120513) #fitalk   an introduction to linux memory forensics(120513) #fitalk   an introduction to linux memory forensics
(120513) #fitalk an introduction to linux memory forensics
 
(120513) #fitalk an introduction to linux memory forensics
(120513) #fitalk   an introduction to linux memory forensics(120513) #fitalk   an introduction to linux memory forensics
(120513) #fitalk an introduction to linux memory forensics
 
Case study of BtrFS: A fault tolerant File system
Case study of BtrFS: A fault tolerant File systemCase study of BtrFS: A fault tolerant File system
Case study of BtrFS: A fault tolerant File system
 
Memory hierarchy.pdf
Memory hierarchy.pdfMemory hierarchy.pdf
Memory hierarchy.pdf
 
Computer Architecture and organization
Computer Architecture and organizationComputer Architecture and organization
Computer Architecture and organization
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)
 
108week2
108week2108week2
108week2
 
Memory_Unit Cache Main Virtual Associative
Memory_Unit Cache Main Virtual AssociativeMemory_Unit Cache Main Virtual Associative
Memory_Unit Cache Main Virtual Associative
 
Blackhat USA 2016 - What's the DFIRence for ICS?
Blackhat USA 2016 - What's the DFIRence for ICS?Blackhat USA 2016 - What's the DFIRence for ICS?
Blackhat USA 2016 - What's the DFIRence for ICS?
 

Recently uploaded

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Recently uploaded (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Android Mind Reading: Android Live Memory Analysis with LiME and Volatility

  • 1. Android Mind Reading: Memory Acquisition and Analysis with LiME and Volatility Joe Sylve joe@digdeeply.com @jtsylve Digital Forensics Solutions, LLC www.digitalforensicssolutions.com
  • 2. About the Speaker • Senior Security Researcher at Digital Forensics Solutions, LLC (New Orleans, La) • GIAC Certified Forensic Analyst • M.S. Computer Science – University of New Orleans 2
  • 3. What We’ll Cover • Live Forensics • Traditional Linux Memory Forensics Overview • Problems with Android • Acquisition Tools (LiME) • Volatility • Demo 3
  • 4. What is Live Forensics? • Traditional Forensics Deals with Non-Volatile Data – Hard Drives – Removable Media – Etc • Live Forensics Deals with Volatile Data – RAM Mostly – Must be collected from a running machine – Not as much control over the environment 4
  • 5. Why Live Forensics? • RAM dump provides both structured and unstructured information • Strings: application data, fragments of communications, encryption keys, etc. • Kernel and application structures • Processes, open files, network structures, etc. 5
  • 6. Why Live Forensics? • Advanced Malware • Encrypted or Temp File Systems • Analysis – FatKit – Memparser – Volatility 6
  • 9. 9
  • 11. Traditional Memory Acquisition • Hardware – JTAG – Firewire – Thunderbolt – Can of Compressed Air • Software – Full Physical Memory • /dev/(k)mem • Fmem • Crash – Process Specific • Ptrace • Core dumps 11
  • 12. Traditional Memory Acquisition (Android Edition) • Hardware – JTAG (unlikely) – Firewire – Thunderbolt – Can of Compressed Air • Software – Full Physical Memory • /dev/(k)mem • Fmem • Crash – Process Specific • Ptrace • Core dumps 12
  • 13. Fmem Internals 1. Obtaining the starting offset specified by the read operation. 2. Checking that the page corresponding to this offset is physical RAM and not part of a hardware device's address space. 3. Obtaining a pointer to the physical page associated with the offset. 4. Writing the contents of the acquired page to the userland output buffer. 13
  • 14. Fmem Internals 1. Obtaining the starting offset specified by the read operation. 2. Checking that the page corresponding to this offset is physical RAM and not part of a hardware device's address space. 3. Obtaining a pointer to the physical page associated with the offset. 4. Writing the contents of the acquired page to the userland output buffer. 14
  • 15. /proc/iomem # cat /proc/iomem 02b00000-02efffff : msm_hdmi.0 03700000-039fffff : kgsl_phys_memory 03700000-039fffff : kgsl 03a00000-03a3ffff : ram_console 03b00000-03dfffff : msm_panel.0 20000000-2e7fffff : System RAM 20028000-20428fff : Kernel text 2044a000-2058ca13 : Kernel data 30000000-3bffffff : System RAM a0000000-a001ffff : kgsl_reg_memory a0000000-a001ffff : kgsl a0200000-a0200fff : msm_serial_hs_bcm.0 a0300000-a0300fff : msm_sdcc.1 … 15
  • 16. Problem 1: dd • dd if=/dev/fmem of=ram.dd count=yyyy skip=xxxx • lseek( unsigned int fd, off_t offset, unsigned int origin) • vfs_llseek(struct file *file, loff_t offset, int origin) • Original Offset: 0x80000000 • Signed Extension: 0xFFFFFFFF80000000 16
  • 17. Problem 1:dd • Not really Fmem’s fault • Problem is in implementation of Android’s dd • However, it would still be suboptimal if dd worked – dd performs a read operation for every block – Context Switches 17
  • 18. Fmem Internals 1. Obtaining the starting offset specified by the read operation. 2. Checking that the page corresponding to this offset is physical RAM and not part of a hardware device's address space. 3. Obtaining a pointer to the physical page associated with the offset. 4. Writing the contents of the acquired page to the userland output buffer. 18
  • 19. /proc/iomem # cat /proc/iomem 02b00000-02efffff : msm_hdmi.0 03700000-039fffff : kgsl_phys_memory 03700000-039fffff : kgsl 03a00000-03a3ffff : ram_console 03b00000-03dfffff : msm_panel.0 20000000-2e7fffff : System RAM 20028000-20428fff : Kernel text 2044a000-2058ca13 : Kernel data 30000000-3bffffff : System RAM a0000000-a001ffff : kgsl_reg_memory a0000000-a001ffff : kgsl a0200000-a0200fff : msm_serial_hs_bcm.0 a0300000-a0300fff : msm_sdcc.1 … 19
  • 20. Problem 2: page_is_ram • http://lxr.linux.no/#linux+v3.0.4/kernel/resource. c#L363 • Missing in Linux kernel on ARM (Android) • Essentially walks iomem_resource in the kernel to find pages in the physical address space that are RAM • Not cool to walk across pages that aren’t RAM (likely mapped to I/O devices, etc.) • Can get the basic idea by looking at /proc/iomem 20
  • 21. LiME Forensics • Linux Memory Extractor – Formerly DMD • Loadable Kernel Module • Dump Memory directly to the SD card or over the network – Network dump over adb (Android Debug Bridge) • Minimizes interaction between userland and kernelland 21
  • 22. Linux Memory Extractor (LiME) 1. Parsing the kernel’s iomem_resource structure to learn the physical memory address ranges of system RAM. 2. Performing physical to virtual address translation for each page of memory. 3. Reading all pages in each range and writing them to either a file (typically on the device’s SD card) or a TCP socket. 22
  • 23. LiME 1.1 Arguments • path – Either a filename to write on the local system (SD Card) or tcp:<port> • format – raw • Simply concatenates all System RAM ranges – padded • Starting from physical address 0, pads all non-System RAM ranges with 0s – lime • Each range is prepended with a fixed-sized header which contains address space information • Volatility address space developed to support this format • dio (optional) – 1 to enable Direct IO attempt (default), 0 to disable 23
  • 24. LiME (TCP) $ adb push lime-evo.ko /sdcard/lime.ko $ adb forward tcp:4444 tcp:4444 $ adb shell $ su # insmod /sdcard/lime.ko “path=tcp:4444 format=lime” Then on host: $ nc localhost 4444 > evo.dump 24
  • 25. LiME (SD Card) $ adb push lime-evo.ko /sdcard/lime.ko $ adb shell $ su # insmod /sdcard/lime.ko “path=/sdcard/dump.lime format=lime” 25
  • 26. Forensics Note • Writing to SD card requires “violating” a common forensic rule of thumb: • Order of Volatility – RAM  on-the-spot live forensics  non-volatile memory (hard drives, flash, etc.)  CDs, etc. • Acquire and preserve most volatile evidence first • On Android, the only non-volatile removable storage that we can use to store memory dump is the SD card • Commonly underneath the battery • Removable of battery == power failure for device! • Solution: Tether Android phone, USB mode, image SD, then dump memory to SD 26
  • 27. DEMO Please do what you must to appease the Live Demo Gods… 27
  • 28. Testing for Soundness 1. Use emulator to get RAM snapshot 2. Use LiME to acquire RAM image 3. Compare (1) and (2) for identical pages 28
  • 29. Not Just Android… • LiME works on Linux too! 29
  • 30. Analysis • We’ve got the RAM dumps so now what? • Volatility – https://www.volatilesystems.com/default/volatility • Andrew Case (@attrc) – Worked on Linux port of Volatility – Worked on ARM port  – Wrote LiME address space into Volatility 30
  • 31. Volatility • The goal is to recreate the set of commands that would be run on a Linux system to investigate activity and possible compromise 31
  • 32. Recovered Process Information • Process listing (ps aux) – Command line arguments are retrieved from userland* • Memory Maps (/proc/<pid>/maps) – Can also recover (to disk) specific address ranges* • Open Files (/proc/<pid>/fd) 32
  • 33. Networking Information • Network interface information (ifconfig) • Open and listening sockets (netstat) • ARP tables (arp –a) • Routing table (route –n) • Routing cache (route –C) • Queued Packets • Netfilter NAT table (/proc/net/nf_conntrack) – Src/Dst IP, # of packets sent, and total bytes for each NAT’d connection 33
  • 34. Misc. Information • Kernel debug buffer (dmesg) • Loaded kernel modules (lsmod) • Mounted filesystems (mount, /proc/mounts) 34
  • 35. Historical Information • kmem_cache – Provides a consistent and fast interface to allocate objects (C structures) of the same size – Keep freelists of previously allocated objects for fast allocation • Walking the freelists provides an orderly method to recover previous structures 35
  • 36. Historical Information • Can recover a number of useful structures: – Processes – Memory Maps – Networking Information • Two limitations: – The aggressiveness of the allocator (SLAB / SLUB) when removing freelists – Needed references being set to NULL or freed on deallocation 36
  • 37. Other Cool Stuff • See: Linux Memory Analysis with Volatility – 2011 Open Memory Forensics Workshop – Andrew Case – http://bit.ly/xVnwyP • Rootkit detection • Live CD Analysis • Dalvik Analysis (coming) 37
  • 38. DEMO 2 If the first demo didn’t work this is going to be a really short one… 38
  • 39. Digital Forensics Solutions, LLC • Registry Decoder – digitalforensicssolutions.com/registrydecoder/ • Scalpel – digitalforensicssolutions.com/Scalpel/ • LiME – digitalforensicssolutions.com/lime/ 39
  • 40. Digital Forensics Solutions, LLC • DARPA Cyber Fast Track Awards (In Progress) – “Forensic Capabilities for Embedded File Systems” – “Automatically Generated Regular Expression- based Signatures for File Carving” • Registry Decoder Enhancements (In Progress) • Registry Decoder Training Workshop – August 16th – September 20th 40
  • 41. Questions? • Joe Sylve – joe@digdeeply.com – @jtsylve • “Acquisition and analysis of volatile memory from android devices” – Digital Investigation (2012) – http://bit.ly/xFEPoj • Digital Forensics Solutions, LLC – www.digitalforensicssolutions.com – dfsforensics.blogspot.com – @dfsforensics 41