Forensic Memory Analysis for Apple OS X Andrew F
Total Page:16
File Type:pdf, Size:1020Kb
Air Force Institute of Technology AFIT Scholar Theses and Dissertations Student Graduate Works 6-14-2012 Forensic Memory Analysis for Apple OS X Andrew F. Hay Follow this and additional works at: https://scholar.afit.edu/etd Part of the Computer Sciences Commons Recommended Citation Hay, Andrew F., "Forensic Memory Analysis for Apple OS X" (2012). Theses and Dissertations. 1118. https://scholar.afit.edu/etd/1118 This Thesis is brought to you for free and open access by the Student Graduate Works at AFIT Scholar. It has been accepted for inclusion in Theses and Dissertations by an authorized administrator of AFIT Scholar. For more information, please contact [email protected]. FORENSIC MEMORY ANALYSIS FOR APPLE OS X THESIS Andrew F. Hay AFIT/GCO/ENG/12-17 DEPARTMENT OF THE AIR FORCE AIR UNIVERSITY AIR FORCE INSTITUTE OF TECHNOLOGY Wright-Patterson Air Force Base, Ohio APPROVED FOR PUBLIC RELEASE; DISTRIBUTION UNLIMITED The views expressed in this thesis are those of the author and do not reflect the official policy or position of the United States Air Force, Department of Defense, or the United States Government. This material is declared a work of the United States Government and is not subject to copyright protection in the United States. AFIT/GCO/ENG/12-17 FORENSIC MEMORY ANALYSIS FOR APPLE OS X THESIS Presented to the Faculty Department of Electrical and Computer Engineering Graduate School of Engineering and Management Air Force Institute of Technology Air University Air Education and Training Command In Partial Fulfillment of the Requirements for the Degree of Master of Science Andrew F. Hay, BS June 2012 APPROVED FOR PUBLIC RELEASE; DISTRIBUTION UNLIMITED AFIT/GCO/ENG/12-17 FORENSIC MEMORY ANALYSIS FOR APPLE OS X Andrew F. Hay, BS Approved: AFIT/GCO/ENG/12-17 Abstract Analysis of raw memory dumps has become a critical capability in digital forensics because it gives insight into the state of a system that cannot be fully represented through traditional disk analysis. Interest in memory forensics has grown steadily in recent years, with a focus on the Microsoft Windows operating systems. However, similar capabilities for Linux and Apple OS X have lagged by comparison. The volafox open source project has begun work on structured memory analysis for OS X. The tool currently supports a limited set of kernel structures to parse hardware information, system build number, process listing, loaded kernel modules, syscall table, and socket connections. This research addresses one memory analysis deficiency on OS X by introducing a new volafox module for parsing file handles. When open files are mapped to a process, an examiner can learn which resources the process is accessing on disk. This listing is useful for determining what information may have been the target for exfilitration or modification on a compromised system. Comparing output of the developed module and the UNIX lsof (list open files) command on two version of OS X and two kernel architectures validates the methodology used to extract file handle information. iv Acknowledgments I would like to thank my research advisor, Dr. Gilbert Peterson, for sharing his extensive knowledge throughout this process and always freely offering advice when I needed it most. Without his support for my eccentric research interests this work would not have been possible. Andrew F. Hay v Table of Contents Page Abstract .............................................................................................................................. iv Acknowledgments ................................................................................................................v List of Figures .................................................................................................................. viii List of Tables ..................................................................................................................... ix I. Introduction ......................................................................................................................1 1.1 Research Objectives and Assumptions ...................................................................3 1.2 Methodological Approach ......................................................................................4 1.3 Research Implications ............................................................................................5 II. Literature Review ............................................................................................................7 2.1 Digital Forensics .....................................................................................................7 2.2 Incident Response ...................................................................................................9 2.3 Memory Forensics ................................................................................................13 2.4 Mac Memory Acquisition .....................................................................................18 2.5 Structured Memory Analysis ................................................................................21 2.6 Summary ...............................................................................................................30 III. Methodology ...............................................................................................................31 3.1 System Design ......................................................................................................32 3.2 Key Kernel Structures ..........................................................................................36 3.3 Project Volafox .....................................................................................................44 3.4 File Handle Module Implementation ....................................................................48 3.5 Open Issues ...........................................................................................................64 3.6 Summary ...............................................................................................................71 IV. Results and Analysis ....................................................................................................72 4.1 Module Evaluation Methodology .........................................................................72 4.2 Results ..................................................................................................................83 4.3 Summary ...............................................................................................................95 vi V. Conclusions and Recommendations ............................................................................96 5.1 Research Conclusions ...........................................................................................96 5.2 Significance of Research ......................................................................................99 5.3 Recommendations for Future Research ..............................................................100 5.4 Summary .............................................................................................................102 Appendix A. Regular Builds OS X 10.4.4 – 10.7.3 .........................................................103 Appendix B. Full Structure Diagram ...............................................................................105 Appendix C. Python struct Library ............................................................................106 Appendix D. Full UML Diagram .....................................................................................108 Appendix E. Full Test Results .........................................................................................109 Appendix F. Hardware Capture Summary .......................................................................123 Appendix G. Complete Source Code: lsof.py ............................................................124 Bibliography ....................................................................................................................150 vii List of Figures Page Figure 1. mach_kernel executable. .............................................................................. 27 Figure 2. Volatility linux_list_open_files output (Cohen & Collett, 2008). .... 32 Figure 3. UNIX list open files (lsof) command. ........................................................... 33 Figure 4. C struct relationship overview. .......................................................................... 36 Figure 5. Symbol table and process list. ........................................................................... 37 Figure 6. Memory-mapped files (txt). ............................................................................ 38 Figure 7. File descriptor table. .......................................................................................... 39 Figure 8. Virtual node (vnode). ...................................................................................... 41 Figure 9. struct proc. ................................................................................................ 43 Figure 10. Abstraction crossover. ..................................................................................... 44 Figure 11. volafox package diagram. ................................................................................ 45 Figure 12. UML 1 – process list and file descriptors. ....................................................... 50 Figure 13. UML 2