June 21, 2007
A Guide for the Forensically Sound Examination of a Macintosh Computer
Part 1 of 2
Ryan R. Kubasiak, Investigator – New York State Police
Reprinted with the kind permission of the author.
About The Author – Ryan R. Kubasiak, Investigator – New York State Police
I began my foray into the world of computers in 7th grade. Our school laboratory was using Commodore 64 computers and the BASIC programming language. Soon, my parents purchased an Apple IIc for our home and I continued writing in BASIC, and now “Apple Logo” as well. My intrigue continued thru high school developing my skills in BASIC and the Pascal programming languages. Ultimately, I achieved Advanced Placement in Computer Science my senior year, yielding college credits.
I went on to the State University of New York at Buffalo and earned a Bachelor of Science in Com>puter Science and a Concentration in Mathematics. All of my schooling was done on the Macintosh LC, VAX/VMS and Sun Solaris based systems. We utilized Modula-2 and C as programming languages. C++ just wasn’t prevalent enough during my college years. One of my favorite achievements of college was writing from scratch, an Assembly language code compiler. I also wrote a multi-tasking operating system for a fictitious Robot, and a dating service front and back end for a fictitious customer.
During school, and immediately after graduation, I worked for SUNY at Buffalo in the LAN Sys-tems group. I went from a student assistant to full time employee and totaled 4 1/2 years with the university as an employee. As a LAN Administrator, I was charged with the setup, maintenance and upgrading of 4 public computing laboratories with hundreds of PC and Macintosh computers, and many office “node” sites with multiple PC and Macintosh computers. Along with the desktops, I also was charged with the operation and maintenance of Novell Netware and Microsoft NT based servers. I was a part of the team that also setup and maintained Remote Access Services and Tape Backups. The experience was invaluable towards the world of forensics, but didn’t begin to educate me on the intricacies of a forensic examination.
I moved on from SUNY at Buffalo in 1998 to become a New York State Trooper. After 5 years “on the road”, I was selected as a new member to the Computer Crime Unit. I have received two certifications, Encase Certified Examiner and Certified Computer Examiner. I hold multiple certifi-cates from classes I have completed and have “expert witness” status in the criminal court system.
My passion in computing has always been the Apple platform. Starting with my first computer, the Apple IIc, I have owned a Mac LC, LCIII, Centris 650, PowerMac 8500AV, iMac G4 and Macbook Pro. I have been installing and configuring the operating system since “System 6” and I maintain a membership with the Apple Developer Network. I routinely following the develop-ment of the operating system itself with great interest.
I continue today to enhance my education, training, and investigative skills. My goal is to share some of what I have learned within this writing.
This is the first of what I hope to be many iterations of MacOS X information for the forensic investigator. In order to keep this relevant, I look forward to hearing from anyone and everyone!
Here are a few of the ways you can get in touch with me:
1220 Washington Avenue, Building 30
Albany, NY 12226
About This Document
This document is to guide a digital forensic examination of a Macintosh computer in the simplest yet sound manner. In order to accomplish this writing, you will notice a rather extensive bibliography. There are many great resources on the internet, in the local bookstore and via training sessions. It seems there is no “one” resource that begins to consolidate this information to create a reference. It is highly recommend that as a digital forensic examiner, you take advantage of the most current information available, utilizing this document and the sources cited. The most informative site on MacOS specifics will always be Apple Inc. You will see throughout that specific Apple Document reference numbers have been included for both credibility as well as future use when new technologies replace what is written here. Apple Inc. does not delete the texts posted on their site. Use this site and others for independent sources of what you plan to testify to.
There will never exist a complete guide to a forensic examination of any platform. There are near infinite directions a case may lead, as well as the fact that technology changes as quick as this document is being written. The goal of this first writing is to get solid, sound practices out to the Macintosh forensic community, and to follow up with additional documents that continue with these techniques, and include more in-depth looks at technologies not able to be noted here.
Images in this document are either created via screen capture on a live MacOS X system, or via the trademarked icons thru Apple Inc. All mentions of companies and their technologies are copyright/trademark of the respective entity.
References from the Apple Inc. Developer website or Support website are noted at the beginning of the appropriate section. The document number is supplied for direct reference to the original writing.
No part of this document may be reproduced or utilized in any way without the express written permission of the author.
Tools Needed and Requirements of the Document
Target machine is assumed to be a Macintosh!
This guide is going to cover three different techniques to forensically “look” at the data of the target machine. Two techniques will involve directly using the target machine itself, while one will use another machine attached. To achieve all three of these forensic examinations, you will need to have with you:
- Macintosh OS X based laptop for mobile forensics, preferably an Intel for greater flexibility.
- Macintosh OS X based desktop for laboratory forensics, preferably an Intel system.
- MacOS X 10.4 (or current) with the XCode tools installed.
- LiveCD for both PowerPC and Intel.
- Firewire cable with appropriate adapters.
- USB Flash Drive, minimum of 1GB in size (4GB for creating a bootable USB drive).
- Examination Notes information sheet.
This document will focus on OS X, heavily on version 10.4. Other versions will be mentioned and noted throughout.
Digital Examination Overview
Although crimes themselves have not changed, the methodology of committing them is everchanging. Our challenge is to keep pace with the digital aspect to all crimes. Investigations nowmust include a digital aspect as well as the traditional methods. Crimes of all levels are being plotted, planned or perpetrated with computers, PDAs, cell phones, USB flash drives, wrist watches,electronic pens, and others. The examiner needs to be cognizant of this, and trained to recognizethese items. Specialized Examiners need to be continually educated and trained on current forensic techniques to analyze the data on these high tech devices. It simply is not acceptable to turn ona computer and see what is there!
First Responders are critical in initial actions taken such as on-site viewing of evidence and/or thesecuring of digital evidence. For this person, a checklist is not acceptable. An understanding ofwhat needs to be done so one can adapt to the unique situations that present themselves is necessary. A loss of data or worse, corruption of data, at this point can severely jeopardize any case or situation.
Employers need to understand the importance of training, certification, and court presentation. Awell qualified examiner, whether a First Responder or Specialized Examiner, will constantly stay upto date in technology advancements and training. For law enforcement, the National White CollarCrime Center offers excellent courses for the perfect price, free. There are many other options fortraining, most of which will be a financial investment. “Investment” is stressed because taking acourse once is not good enough. Repeated training on newly emerging technology will be a must. Multiple colleges and universities have recognized and developed digital forensic classes, as well asdegree programs. Also, software companies such as Black Bag Technologies, Guidance Software,and Access Data offer classes that concentrate on their specific software, yet teach useful skills inanalysis. Courses and certifications that are publicly available vs. law enforcement only classes arepreferred. Techniques that can be reproduced by the digital forensic community at large are morerevered in a courtroom setting.
The conditions, in criminal circumstances, to consider a limited scope examination rather thanutilize a full laboratory analysis are:
- Facilitate Arrest – You have a search warrant and need to find evidence at the crime scene to facilitate and arrest of the target.
- Consent Search – You don’t have anything more than permission from the target to look, but the permission is the look on-premises only.
- Exigent circumstances such as a missing person.
Field forensics is NEVER a substitute for a full-fledged, digital forensic laboratory. Working in anopen environment such as a target’s home or office presents dangers as well as opportunity formissed information. With that in mind, this guide is designed to safely and soundly guide the FirstResponder or Specialized Examiner to the data in a quick and forensically sound manner.
Three techniques are available to examine the target Macintosh. First, the Macintosh desktop/laptop/server can be booted into “single-user” mode. This state, as describe in-depth later, is a forensically sound state and allows for information to be gathered. In single-user mode, however, athorough working knowledge of UNIX will be needed. Second, the same target machine can bebooted from a LiveCD, such as MacOS X boot disk, a Knoppix distribution or Ubuntu LiveCD,and view the contents of the hard drive from it. Third, the target computer can be booted intoFirewire Disk Mode (Target Disk Mode) and viewed from a secondary computer. Each of thesetechniques have benefits as well as pitfalls.
Single-User Mode utilizes an already installed operating system, features established by Apple, andgreatest speed of previewing data. It also is command line driven, very much a manual process forsetup, and potentially has been shut off or maliciously altered. Using the suspect’s own operatingsystem is almost always a bad idea, leading to potentially mistaken results.
LiveCD offers a known boot media with a known operating system each and every time you conduct a preview. It offers a well-known, always available set of tools for each and every limited scopeexamination conducted. It also is RAM intensive, will not always work with the latest hardware, ormay not boot at all. Blackbag Technologies offers a subscription for a forensically sound Macintoshboot disk. It is also possible to create your own bootable disk that is both forensically sound andhas specific utilities installed. The downside to creating your own disk is the lack of support forfuture machines. Apple Inc. does tweak the operating system to take advantage of newer hardware.The specific changes from Apple come on a DVD with the specific computer. For instance, as ofthis writing, the MacOS X 10.4 box set available for purchase is for PowerPC Macintoshes only andwill NOT boot Intel based systems.
Target Disk Mode offers the greatest flexibility. You are able to use your laptop (or desktop) withchoice of operating system to look at the target machine. It yields the greatest speed and the widest variety of tools for examination. It also may not function at all on the target computer. Thistechnology is discussed further, later in the document.
Every digital examination should involve the following steps:
- Physically secure evidence or conduct on-site preview (Collection)
- Acquisition of digital media
- Verification of acquired data
- Archive of acquired data with verification
- Analysis of acquired data
- Reporting of results
Only the first two allow for the usage of original evidence. Special care is taken during these stepsto insure original evidence is not altered. This document is written entirely based on that care. Ifyou do not wander outside of the scope of this document, you will not be altering original evidence.All techniques outside of this document should be well tested in a controlled environment for forensic soundness before attempting use on evidence.
A on-site examination typically will yield only a fraction of the evidence on a target computer. Itmay yield 0% evidence. It is NOT a substitute for a full, in-laboratory analysis. Just because it wasnot found during a limited scope examination, doesn’t mean it’s not there.
“Absence of evidence is not evidence of absence.”
Apple has always been a very unique company, hence the operating system, file systems, and applications are also unique. Some basics to know and understand before looking at a Macintosh include the following:
HFS+ (and the older HFS) are the two predominant file systems found on any Macintosh. Without “something” to recognize this file system, you will be left looking at a seemingly unallocated drive with raw data only. Tools such as Encase from Guidance Software and BBT Forensic Suite fromBlackBag Technologies can appropriately interpret this file system and display the contents in auser friendly way. Also, the Macintosh itself knows how to display its own file system, and we usethis fact when using Single-User mode, LiveCD, or the target disk mode.
A Macintosh may contain other file systems, just as any other computer. With the release of “BootCamp” from Apple, Intel based systems could very well have NTFS, FAT32, EXT3, etc. The Intelbased Macintosh computers are very capable of running multiple operating systems with multiplefile systems. Always be aware of this when using techniques, and be aware of consequences.
MacOS X and MacOS 9 are the two dominant operating systems that will be found on any Macintosh. With the release of “Boot Camp” from Apple, any operating system that operates on Intelhardware can be successfully installed and run. Just because an “Apple Logo” is displayed on theside of the computer doesn’t mean an Apple operating system with be used. Apple has releasedWindows XP Service Pack 2 drivers as well as Windows Vista drivers, so expect those more often. Many hack websites have figured out how to use Boot Camp to install other operating systems andsuccessfully boot. Just as common will be virtualization software such as Parallels, VMWare or VirtualPC. With these, you will encounter a “file” that actually contains an entire hard drive worth ofdata from a different operating system.
With that said, an extremely high percentage of Macs will be running OS X or OS 9. This document’s focus will mostly be on the OS X based machines. OS X based PowerPC Macintoshes havethe possibility of containing OS 9 “within” the OS X installation. It is referred to as “Classic” andis run simultaneously to the OS X environment.
The Macintosh has used for several years, two “forks” to any file. They are the Resource fork andthe Data fork. Apple has recommended to developers to discontinue the use of the Resource fork. If a Macintosh file is copied to a File System that doesn’t support Resource forks, the fork will belost. As an examiner, this is extremely important to know. If a file with a Resource fork is copied to a Fat32 volume, for instance, the MacOS will handle the resource fork and open the file appropriately. However, the way in which it is handled is thru a hidden file. With an example file named “test.txt”, one will notice a hidden file in the same directory named “._test.txt”. This is the resource fork. MacOS X will copy this file from FAT32 correctly when the “test.txt” file is copied. Moving over to an operating system that doesn’t recognize this, such as Microsoft Windows, thesame copy will lose the Resource fork data. Resource forks can best be equated to Alternate DataStreams in the NTFS world.
Macintosh application files (or .app files) are actually not a single file at all. They are a folder, thatis displayed via the Finder as single custom icon, and appropriately launched. If you Control-Clickon an application file, you will notice the choice to “Show Package Contents”. This will actuallyopen the folder rather than launch the application. The contents have a small chance of being evidentiary in value, but the user data associated with an application is typically in the Home directory. Any folder can be made into an application by simply adding the “.app” extension to thename. However, when you double-click a self-made application, the Finder will likely give an errormessage because the application is not truly an application yet. Since an application is really just aspecialized folder, problems occur if it is copied to a File System and opened within another operating system. Viewing MyApplication.app in a Windows environment will show a folder with thename of MyApplication.app. Further, the folder will open in windows and the Package contentswill be seen, much like the “Show Package Contents” command.
Some applications actually use this package concept to create the data file. iWork has two applications, Keynote and Pages. They each save files in a Package format, and not a single flat file. Looking at MyDocument.pages on a FAT32 volume through Microsoft Windows will again result in afolder with the name MyDocument.pages and the folder will open when double-clicked. Be awareof this operation, and expect it when sharing files between operating systems.
Even more importantly, if you are examining a MacOS based system with a Windows tool, youWILL see package files differently than the intended view AND functionality. Certain portions ofa forensic examination of a MacOS based system will require a Macintosh. Plan accordingly!
One of the BEST features of each MacOS X based system is the help available. Specifically, theMAN pages available are perfect support documentation for any case. When you use a commandline function, consider making the MAN page for that command a part of your report. The MANpages are updated as system updates come out, making the output of the MAN page on the day ofusage important. An easy way to do this is an output redirect. For example, if you are about to usethe `dd’ command line utility, output the MAN page to a text file.
man dd > DD_MANPages.txt
This will output the MAN page entry to a text file. Save this text file in your case notes area forfuture reference. The best reference material an investigator can have is the materials supplied bythe company itself!
Mac OS X has some very robust technologies behind the Graphical User Interface. The operatingsystem is UNIX derived, which gives us the power and support of a huge online community. Theoperating system has both a GUI and command line available. Within the OS, Applescript andshell scripting can be done, both allowing for the automation of processes and tasks.
Bonjour, formerly Rendezvous, is a technology developed by Apple to make network configurationand setup seamless to the end-user.
Defined by Apple:
Bonjour, also known as zero-configuration networking, enables automatic discovery of computers, devices, andservices on IP networks. Bonjour uses industry standard IP protocols to allow devices to automatically discovereach other without the need to enter IP addresses or configure DNS servers. Bonjour is installed by default on OS X based machines running 10.3 or later. It is also available fordownload for Windows 2000 or XP based computers.
AES-128 encryption. FileVault automatically encrypts and decrypts the contents of your home directory on the fly. FileVault is off by default after initial setup or installation, but can be easily enabled. More about this technology later in the document.
Spotlight is the indexing engine and search technology used to keep track of files and their metadata. A hidden file is created called “.Spotlight-V100” and contains the indexing data. Spotlightis enabled by default, and is not easily turned off for the entire system. More on Spotlight later in this document.
UNIX and the FreeBSD System
MacOS X, all versions, utilize the UNIX subsystem. This means, that for the first time, the MacOS is not only a GUI based system, but also is command line driven. This brings immense powerand flexibility, along with the time tested stability of UNIX to the operating system. When researching How-To’s on the MacOS X system, you can usually include generic UNIX information, aswell as Linux equivalents. Many times, a Linux source code will be able to compile on the Macintosh with little changes.
Microsoft Windows on a Mac?
Yes. If the Macintosh is an Intel based system, a beta of the software called “Boot Camp” may be
installed and Microsoft Windows XP SP2 or Vista may be installed. In addition, on both PowerPCand Intel based Macintoshes, emulation and virtualization software can be run allowing for otheroperating systems to run. Microsoft VirtualPC (formerly Connectix) is for the PowerPC based systems. The software was recently discontinued (but can still be purchased) because PowerPC Macintoshes have been discontinued. Newer software for the Intel Macintoshes such as SWSoft’s Parallels Desktop or VMWare Fusion can run multiple, concurrent virtualized operating systems. These technologies will be discussed further.
Disk Arbitration is a daemon in OS X that mounts file systems. This is the feature that automatically mounts and displays your USB Flash drive when you plug it in for instance. Disk Arbitrationwill mount volumes read/write, which is bad in the forensic world. When utilizing an OS X basedMacintosh to preview another computer, Disk Arbitration needs to be “off “.
Activate/Deactivate Disk Arbitration
- Make a backup of the file “/etc/mach_init.d/diskarbitrationd.plist”
- “sudo cp /etc/mach_init.d/diskarbitrationd.plist /Backup/”
- Remove /etc/mach_init.d/diskarbitrationd.plist
- “sudo rm /etc/mach_init.d/diskarbitrationd.plist”
- I HOPE YOU MADE THE BACKUP!
- Reboot your system and Disk Arbitration is now off.
- To turn Disk Arbitration back on, copy the original file back to its original location
- “sudo cp /Backup/diskarbitrationd.plist /etc/mach_init.d/”
- Reboot your system and Disk Arbitration is now on.
As stated directly from the MAN pages:
||BSD System Manager’s Manual
||diskarbitrationd — disk arbitration daemon
diskarbitrationd listens for connections from clients, notifies clients of the appearance of disks and filesystems, and governs the mounting of filesystems and the claiming of disks amongst clients. diskarbitrationd is accessed via the Disk Arbitration framework.
-d Report detailed information in /var/log/diskarbitrationd.log. This option forces diskarbitrationd to run in the foreground. The file /etc/fstab is consulted for user-defined mount points, indexed by filesystem, in the mount point determination for a filesystem. Each filesystem can be identified by its UUID or by its label, using the con structs “UUID” or “LABEL”, respectively. For example:
UUID=DF000C7E-AE0C-3B15-B730-DFD2EF15CB91 /export ufs ro
UUID=FAB060E9-79F7-33FF-BE85-E1D3ABD3EDEA none hfs rw,noauto
LABEL=The\040Volume\040Name\040Is\040This none msdos ro
||July 18, 2004
Results from a preview or analysis are only useful if everything has been conducted under forensically sound procedures. We must insure that everything done from start to finish guarantees unaltered data OR in a worst case scenario, results that are documentable, known changes to the targetmachine. We will NOT be purposefully trying to achieve the latter! The known changes anddocumentation should only be for a procedure attempted that did not result in the desired outcome. For instance, if you attempt to boot a target machine with a LiveCD and instead, the MacOS boots, you must document what happened.
||Target Disk Mode
(Apple Document 58583)
Target Disk Mode is a technology that allows a Macintosh computer to act as an external, firewiredisk. The computer will not access the file system or other data in this state until user interactioncauses this. Its an extremely useful tool for us. A separate note from Apple on this states:
Tip: FireWire Target Disk Mode works on internal ATA drives only. Target Disk Mode only connects to themaster ATA drive on the Ultra ATA bus. It will not connect to Slave ATA, ATAPI or SCSI drives.
This means we cannot access multiple installed drives with this method. If you know there are 2 ormore drives in the target computer, consider the LiveCD method.
In addition, the following models support the use of Target Disk Mode:
- iMac (Slot Loading) with Firmware version 2.4 or later
- iMac (Summer 2000) and all models introduced after July 2000
- eMac (all models)
- Mac mini (all models)
- Power Mac G4 (AGP Graphics) with ATA drive
- Power Mac G4 Cube
- Power Mac G4 (Gigabit Ethernet) and all models introduced after July 2000
- Power Mac G5 (all models)
- iBook (FireWire) and all models introduced after September 2000
- MacBook (all models)
- PowerBook G3 (FireWire)
- PowerBook G4 (all models)
- MacBook Pro (all models)
Target Disk Mode Procedure
To use Target Disk Mode in a forensically sound manner, use the following steps:
- Make sure that the target computer is turned off. If you are using a laptop as the target computer, you should also plug in its AC power adapter.
- Boot the target computer while holding down the Option key. This will yield one of two results. Either you will see a list of bootable devices (partitions) or you will see a prompt to enter the Firmware password. If the latter occurs, you CANNOT use Target Disk Mode.
- Use a FireWire cable to connect the target computer to your computer. The forensic Macintosh (your computer) does not need to be turned off.
- Start up the target computer and immediately press and hold down the T key until the FireWire icon appears. The hard disk of the target computer should become available to the host computer and will likely appear on desktop.
- When you are finished with the examination, drag the target computer’s hard disk icon to the Trash or select Put Away from the File menu (Mac OS 9) or Eject from the File menu(Mac OS X).
- Press the target computer’s power button to turn it off.
- Unplug the FireWire cable.
To remain forensically sound, the Macintosh being used to view the Target should have DiskArbitration turned OFF.
If your examination machine is Windows based, be VERY cognizant of the possible writes beingmade to any FAT or NTFS partitions. The firewire connection is not write blocked in any way. Forthis reason, it is not recommended to use Target Disk Mode with a Windows based computer.
The Macintosh Boot Process
[The following section has wording taken verbatim from the Apple Developer website]
Open Firmware and Extensible Firmware Interface
Open Firmware and Extensible Firmware Interface are similar to the function of BIOS and are used on PowerPC and Intel based Macintoshes respectively.
When the power to a Macintosh computer is turned on, the BootROM firmware is activated.BootROM (which is part of the computer’s hardware) has two primary responsibilities: it initializessystem hardware and it selects an operating system to run. BootROM has two components to helpit carry out these functions:
- POST (Power-On Self Test) initializes some hardware interfaces and verifies that sufficientmemory is available and in a good state.
- On PowerPC-based Macintosh computers, Open Firmware initializes the rest of the hardware, builds the initial device tree (a hierarchical representation of devices associated withthe computer), and selects the operating system to use. On Intel-based Macintosh computers, EFI does basic hardware initialization and selects which operating system to use.
If multiple installations of Mac OS X are available, BootROM chooses the one that was last selected by the Startup Disk System Preference. The user can override this choice by holding downthe Option key while the computer boots, which causes Open Firmware or EFI to display a screenfor choosing the boot volume.
Note: On some legacy hardware, the same version of BootROM can start either Mac OS 9 or Mac OS X.Most current hardware can start only Mac OS X.
(Apple Document 106178)
Startup Manager was introduced with these Apple computers and is present on these and all latermodels (including all Intel-based Macs):
- iMac (Slot Loading)
- PowerBook (FireWire)
- Power Mac G4 (AGP Graphics)
- Power Mac G4 Cube
BootX, boot.efi, and System Initialization
[The following section is taken verbatim from the Apple Developer website]
Once BootROM is finished and a Mac OS X partition has been selected, control passes to theBootX (PowerPC) or boot.efi (Intel) boot loader. The principal job of this boot loader is to load thekernel environment. As it does this, the boot loader draws the “booting” image on the screen.
BootX and boot.efi can be found in the /System/Library/CoreServices directory on the root partition. In addition, a copy of boot.efi can be found at /usr/standalone/i386/boot.efi.
In “exotic” boot situations such as booting from a UFS volume, a software RAID volume, and soon, a copy of the boot loader is stored on a separate HFS+ “helper” volume to get the system started. In some versions of Mac OS X, a copy of the kernel and mkext cache are also included on the helper volume. In these cases, the booter and other components on the root volume are unused.
The boot loader first attempts to load a pre-linked version of the kernel that includes all devicedrivers that are involved in the boot process. This pre-linked kernel is located in/System/Library/Caches/com.apple.kernelcaches. By linking these drivers into the kernel ahead oftime, boot time is reduced.
If the pre-linked kernel is missing, out-of-date, or corrupt, the boot loader attempts to load thatsame set of device drivers all at once in the form of a single, compressed archive called an mkextcache.
If this cache is also out-of-date, missing, or corrupt, the boot loader searches /System/Library/
Extensions for drivers and other kernel extensions whose OSBundleRequired property is set to avalue appropriate to the type of boot (for example, local or network boot).
For more information on how drivers are loaded, see I/O Kit Fundamentals.
Once the kernel and all drivers necessary for booting are loaded, the boot loader starts the kernel’sinitialization procedure. At this point, enough drivers are loaded for the kernel to find the root device. Also from this point, on PowerPC-based Macintosh computers, Open Firmware is no longer accessible (quiesced).
The kernel initializes the Mach and BSD data structures and then initializes the I/O Kit. The I/OKit links the loaded drivers into the kernel, using the device tree to determine which drivers tolink. Once the kernel finds the root device, it roots(*) BSD off of it.
Note: As a terminology aside, the term “boot” was historically reserved for loading a bootstrap loader and kernel off of a disk or partition. In more recent years, the usage has evolved to allow a second meaning: theentire process from initial bootstrap until the OS is generally usable by an end user. In this case, the term isused according to the former meaning.
As used here, the term “root” refers to mounting a partition as the root, or top-level, filesystem. Thus, while theOS boots off of the root partition, the kernel roots the OS off of the partition before executing startup scriptsfrom it.
Prior to Mac OS X v10.4, the remaining system initialization was handled by the mach_init and init processes. During the course of initialization, these processes would call various system scripts (including /etc/rc), run startup items, and generally prepare the system for the user. While many of thesame scripts and daemons are still run, the mach_init and init processes have been replaced bylaunchd in Mac OS X v10.4 and later. This change means that launchd is now the root system process.
In addition to initializing the system, the launchd process coordinates the launching of systemdaemons in an orderly manner. Like the inetd process, launchd launches daemons on-demand.Daemons launched in this manner can shut down during periods of inactivity and be relaunched asneeded. (When a subsequent service request comes in, launchd automatically relaunches the daemon to process the request.)
This technique frees up memory and other resources associated with the daemon, which is worthwhile if the daemon is likely to be idle for extended periods of time. More importantly, however,this guarantees that runtime dependencies between daemons are satisfied without the need formanual lists of dependencies.
Next, launchd(8) starts SystemStarter(8), which starts any non-launch-on-demand daemons.
Note: While launchd does support non-launch-on-demand daemons, this use is not recommended. Thelaunchd daemon was designed to remove the need for dependency ordering among daemons. If you do notmake your daemon be launch-on-demand, you will have to handle these dependencies in another way, suchas by using the legacy startup item mechanism.
For more information about launch-on-demand and SystemStarter daemons and how to launch them, see “Daemons”.
As the final part of system initialization, launchd launches loginwindow. The loginwindow programcontrols several aspects of user sessions and coordinates the display of the login window and theauthentication of users.
Note: By default, Mac OS X boots with a graphical boot screen. For debugging the boot process, it is oftenuseful to disable this, revealing the text console underneath. This mode is known as verbose boot mode. Toenable verbose boot mode, simply hold down command-v after the boot chime.
Boot EFI Utilities
Apple does not offer any direct tools for accessing EFI. There is no key sequence available to enter EFI upon boot. There are, however, utilities available to access this. One such tool, rEFIt is available on Sourceforge.net. The link at the time of this writing is http://refit.sourceforge.net/
The utility can be run on a Live Macintosh, but is not available without installation. In our case,the more useful option is to boot from a bootable disk with the utility installed and gather theneeded information. Typically, this information is the system date and time along with any otherlow-level information your agency elects to include. You will need to have created a forensicallysound boot disk (external hard drive, USB drive, DVD, etc.) and have this tool included.
Because of the lack of EFI documentation, single-user mode is probably the better way to gatherinformation such as date and time at this point.
Booting a Macintosh from the LiveCD
Booting from a LiveCD on a Macintosh is a rather straight-forward process, yet have many different paths that can be followed. We will not be discussing the specific directions for each LiveCD offered on a Macintosh. Your agency should develop specific operating guides for the tool(s) used. An internet search for Knoppix, Linux, and the likes on a Macintosh will yield many variations thatmight boot the target Macintosh. Be careful when selecting a LiveCD. You want to know what happens when the LiveCD is running. Some LiveCDs have the potential to alter the target disk, justas if you booted from the target disk itself. Do not make your first test during an actual limited scope examination.
Some available distributions:
- PowerPC – Ubuntu LiveCD (discontinued development as of 02/2007)
- Intel – Ubuntu LiveCD
- Intel – Helix LiveCD
- PowerPC and Intel – BBT Macquisition CD
From a LiveCD that is Linux based, the DD utility will allow for a bit for bit, forensic copy of theoriginal device. You will need to familiarize yourself with the console and GUI of each distribution. Each will have their own nuances that can potentially change what you are accustomed toseeing as output.
Imaging a Target Macintosh
Once it has been determined that you wish to make an image of the target Macintosh vs. collecting certain files and folders, steps need to be taken to insure the result is as expected. The steps that need to be taken will highly depend on the method/path chosen. We will deal with this here. We are going to use in this outline, the tools available from the typical install, and NOT specialized,downloaded tools. There are tools that will make some of these steps easier, or in fact combine thesteps creating shorter acquisition times altogether. Explore these tools after you are comfortablewith the well-known, established results of the steps taken here.
Target Disk Mode
In target disk mode, the target computer acts as an external firewire hard drive. The steps to acquire such a device are the same as any other firewire hard drive. Windows will alter a Macintoshin this mode if any writable partitions exist (FAT32, NTFS). Because of this, and the lack of upfront knowledge of whether or not these exist, it is recommended an acquisition of this type bedone with a forensic Macintosh. It is also possible to use Linux and image the drive with DD (diskdump). The procedure varies only slightly.
The specific steps for a Target Disk Mode acquisition with a forensic Macintosh are as follows:
- Turn off DiskArbitration on your forensic Macintosh (alternately, use a specific partition on your forensic Macintosh that always has DiskArbitration off) [see Activate/Deactivate DiskArbitration]
- Shut down your forensic Macintosh.
- Start the target Macintosh following the Target Disk Mode Procedure outlined earlier.
- Connect the target Macintosh to your forensic Macintosh via a firewire cable.
- Boot your forensic Macintosh either to your forensic partition or with DiskArbitration turned off.
- If all is well, you will see your boot drive on the desktop, but nothing else (because DiskArbitration is off).
- Enter the Terminal and check for your attached Target Disk Mode Macintosh “hdiutil info” will yield device information [or] “ls /dev/disk?” to get a listing of recognized devices
- Determine which disk you will acquire and create a digital fingerprint of the target device by running MD5 hash. Assuming the disk you will acquire is disk1, use the MD5 command as follows:
md5 /dev/disk0 > /Evidence/targetMacintosh.md5_start
- A “raw” disk, or rdisk, will acquire faster than is buffered disk counterpart. Assuming the disk
you will acquire is “disk1”, use dd to make the acquisition of the raw disk as follows:
dd if=/dev/rdisk1 conv=noerror,sync of=/Evidence/targetMacintosh.dd
- The dd utility will not give an progress reporting, and will simply exit when it is finished. A notice on screen stating the number of blocks in and blocks out will be reported. They shouldmatch if everything was copied bit for bit as expected.
- Create a second digital fingerprint of the target device to show nothing has been altered by the dd process.
md5 /dev/disk0 > /Evidence/targetMacintosh.md5_end
- Power down your forensic Macintosh.
- Power down the target Macintosh by holding down it’s Power button.
- Disconnect the firewire cable and you are finished.
Possible failures of this method include: lack of drive space on your forensic Macintosh to acquire,faulty firewire cable, or a physically failing target Macintosh.
Other tools to consider for this method would include DCFLDD and BBT Forensic Suite.
A LiveCD method for acquisition of a Macintosh is sometimes the preferred method. This involves booting the target Macintosh with a known, forensically sound CD. LiveCD’s can include acustom tailored Linux distribution such as Helix, SMART or a Knoppix variant. It can also include paid-for tools like BBT Macquisition.
Physical drive removal sometimes is the most complicated part of a Macintosh examination. Thecases of some Macintosh computers will seem like a security barrier as you try to open them. Others will open within seconds and present the internal drives very neatly. When choosing thismethod, you will likely want to use a physical write blocking device for the acquisition. Many companies offer a great selection of just such devices. The appropriate steps to take will be determinedby the physical write blocking device you choose to use. Once the disk drive is physically writeblocked, an imaging process can begin with any tool of your choosing, on any operating system.
Possible failures of this method include: a bad cable between the drive and the physical write blocking device, bad cable from the physical write blocking device to the forensic computer, and the imaging tool can’t recognize the file system of the target Macintosh hard drive and displays the disk asunallocated space.
Apple Partition Map
Macintosh computers will likely use one of two partitioning schemes. From the factory, PowerPCbased Macintoshes come with the Apple Partition Map. An Intel based Macintosh, however, willutilize the new GUID partition scheme. Do not confuse this with the file system of HFS or HFS+.The partitioning scheme is the basic definition of how a hard drive or other media is laid out for afile system to be applied. Here is a look at the disk structure of a typical PowerPC based Macintosh:
Disk Utility – Apple Partition Map
The image shows a 149.1 GB hard drive with model number ST3160023AS with a user given nameof “Moof ‘s House”. The Volume Scheme shows the drive having only one partition, and the format used is Mac OS Extended (Journaled). Note at the bottom, Apple Partition Map is the partition scheme used. What does all of this mean?
The left window pane shows us physical storage devices. Physical storage could also include aDMG that has been mounted as well. On this computer, only one hard drive is connected. Looking at the lower portion of the window, the drive is a Serial ATA or SATA drive. The VolumeScheme section gives information on the number and types of partitions available. The currentpartition map shows one large partition across the entire available drive. It has been named “Moof ‘s House” and is formatted using HFS+ with journaling enabled. More to come on Journaling later.
Now, let’s look at the same disk through the Terminal window using “
Terminal Window – Apple Partition Map
The command used to give this view was “
hdiutil partition /dev/disk0“. Notice the extra information we are now seeing as compared to the output of Disk Utility. Sector 0 is the boot sector witha size of 1 sector. Sectors 1 thru 64 is the Apple Partition Map defining the layout of the disk. Apple Free is a “padding” defined as being available for future use. The data section for a forensicanalysis finally shows up at the Apple HFS partition starting at sector 262208 and having a lengthof 3,122,319,590 sectors. There is one more Apple Free partition with a length of 10 sectors, againused as padding.
The Apple Free area is not normally where data will be found. It is not easily accessed by the casualuser. However, nothing prevents a more savvy user from hiding information there with the righttools. Also, information could be left over in these areas from a previous partition scheme.
GUID Partition Table
Next, let’s look at an Intel based Macintosh. Here is the Disk Utility information window.
Disk Utility – GUID Partition Table
The image shows a 74.5 GB hard drive with model number ST98823AS with a user given name of “Kubasiak World”. The Volume Scheme shows the drive having only one partition, and the format used is Mac OS Extended (Journaled). Note at the bottom, GUID Partition Table is the partitionscheme used. What does all of this mean?
The left window pane shows us physical storage devices. On this computer, only one hard drive isconnected. Looking at the lower portion of the window, the drive is a Serial ATA 2 or SATA2 drive.
The Volume Scheme section gives information on the number and types of partitions available. The current partition map shows one large partition across the entire available drive. It has beennamed “Kubasiak World” and has been formatted using HFS+ with journaling enabled. Again, more to come on Journaling later.
Now, let’s look at the same disk through the Terminal window using “
Terminal Window – GUID Partition Table
The command used to give this view was “
hdiutil partition /dev/disk0“. Notice the extra information we are now seeing as compared to the output of Disk Utility. Sector 0 is the boot sector witha size of 1 sector. Sector 1 is the Primary GUID Partition Table Header and sector 2 thru 34 contains GUID Partition Table data defining the layout. Notice that these two partitions are replicated at the end of the drive in reverse order. We will recognize the Apple Free partition and thefunction is similar in nature. The data we are interested in for an exam lies within the Apple HFS partition starting at sector 409,640.
For an even more in-depth look at this topic, read “Technical Note 2166 – Secrets of the GPT” on the Apple Developer website.
(Apple Document 107249)
“Journaling” is a feature that helps protect the file system against power outages or hardware component failures, reducing the need for repairs. Journaling was first introduced in Mac OS X Server 10.2.2, then to thenon-server OS in Mac OS X 10.3 Panther. This document explains some of the benefits of using this featureand how it works.
Journaling for the Mac OS Extended (HFS Plus) file system enhances computer availability and fault resilience, which is especially noteworthy for servers. Journaling protects the integrity of the file system on Xserveand other computers using Mac OS X Server in the event of an unplanned shutdown or power failure. It alsohelps to maximize the uptime of servers and connected storage devices by expediting repairs to the affectedvolumes when the system restarts.
Journaling is a technique that helps protect the integrity of the Mac OS Extended file systems on Mac OS Xvolumes. It both prevents a disk from getting into an inconsistent state and expedites disk repair if the serverfails.
When you enable journaling on a disk, a continuous record of changes to files on the disk is maintained in thejournal. If your computer stops because of a power failure or some other issue, the journal is used to restore the disk to a known-good state when the server restarts.
With journaling turned on, the file system logs transactions as they occur. If the server fails in the middle of anoperation, the file system can “replay” the information in its log and complete the operation when the serverrestarts.
Although you may experience loss of user data that was buffered at the time of the failure, the file system is returned to a consistent state. In addition, restarting the computer is much faster. Always remember to backup your data as frequently as necessary.
What does this mean for us as digital forensic investigators? Two thoughts need to be consideredwith every case:
- Do I shut down this Macintosh normally or pull the plug?
- Booting a forensically restored version of a Macintosh that has journaling will result in automatic correction to corruption.
The answers to these questions will depend on how you or your agency establish policies.
FileVault and MacOS X Security
FileVault Preference Pane
FileVault is the security technology available in MacOS 10.4 to secure a user’s home directory. When turned on, the user’s home directory will be encrypted using 128 bit AES encryption to a Sparseimage DMG file.
Security Preference Pane
The window shows the available security features from the Security Preference Pane. A description of each follows.
Master Password – This is the master password used to unlock a FileVault sparseimage when theuser has forgotten the password.
Turn On FileVault – Clicking on this button will enable FileVault for the currently logged in account. The sparseimage of the user’s home directory will be created and the user will be loggedout.
Require password to wake this computer from sleep or screen saver – will cause the computer toprompt for the currently logged in user’s password to wake or unlock the screen saver
Disable automatic login – Causes the Login Window to appear during the boot sequence. Whenthis is not checked, the selected user will automatically login during the boot sequence.
Require password to unlock each secure system preference – Forces a password to be entered before changes to security can be made.
Log out after X minutes of inactivity – Will cause automatic log of the currently logged in user (orusers) after the specified number of minutes.
Use secure virtual memory – causes the /var/vm/swapfile0 and other subsequent page files to be encrypted. When this is not checked, all pages of memory to disk are in clear text, offering an abundant source of user information. The swapfiles are deleted during boot, and NOT at shutdown orlogout!
It is important for a full analysis to include items such as the options listed above. For instance, itis not the same story when a system has the auto-login feature on vs. off. Having to know a password to get into the system narrows down the number of people that may have used a computerimmediately. In order to gain this information, “plist” files will need to be examined. A likely areafor system-wide setting to be stored is /Library/Preferences. Here is an example of the loginwindowplist file.
Property List Editor – com.apple.loginwindow.plist
Here we see that the Auto Login setting has been set, and the user moof will be used (UID 501).
sparseimage and User Home Directory
FileVault and the sparseimage file created is simply a DMG file that has been encrypted with 128bit AES encryption using the user’s login password. A sparseimage also will expand and compact assize requirements change for the “disk”. That is different from a DMG where the entire size is allocated up front. It will be named username.sparseimage and will be located in the user’s home directory. This file can be manipulated like any other file, and can be successfully mounted if thepassword is known. As with any DMG file, you should “Lock” the file before using it. This will ensure Read-Only privileges regardless of the level of account being used. Even “root” will not haveprivilege to write to this file when the HFS+ “Lock” is used. Here is a screen capture of a user’shome directory after FileVault has been turned on.
Terminal Window – User Home Directory with FileVault Enabled
In this example, the user dogcow has FileVault turned on. The home directory now contains only asingle file, dogcow.sparseimage is a DMG sparseimage that has been 128 bit AES encrypted. Youcan see that user 505 is the owner and its size is currently 71,430,144 bytes large. This file can becopied to another drive as any other file could. You will need an admin account to access anotheruser’s directory, and you will need the encryption password (login password) of the user dogcow tomount this file.
Acquire the Encrypted User Home Directory
When copying this file, do not forget to immediately set the “Locked” property in the Finder. Thiswill prevent any changes occurring to the file. Here are the steps to successfully acquire this file.
- Open a shell in the terminal with root privileges. (BE CAREFUL!)
Example “sudo sh”
- Copy the file from its present location to your Evidence Collection directory.
Example “cp /Users/dogcow/dogcow.sparseimage /Evidence”
- Take ownership of the file.
Example “chown yourusername /Evidence/dogcow.sparseimage”
- Set the Locked flag to prevent any changes to this file.
Example “chflags uchg /Evidence/dogcow.sparseimage”
Terminal Window – Forensically Copy sparseimage
Looking at the /Evidence directory after the steps have been completed will result in the following output.
Terminal Window – Attributes of sparseimage Properly Copied
Prior to mounting the sparseimage, looking at the contents will result in nothing but gibberish. Nothing useful can be gathered from the image itself except for one fact. The header of a sparseimage will show as follows:
Terminal – XXD View of sparseimage Header
Every sparseimage will have the header “encrcdsa”.
You should now be able to mount the Disk Image file in your evidence directory. If you have taken each of the steps from above, double-clicking on the file will result in the following dialog:
Finder – Authentication Dialog
Entering the login password for dogcow will result in the image mounting on your desktop.
If you get the following dialog instead:
Finder – Image Mounting Error Dialog
then you have not appropriately taken ownership of the image file with the “chown” command.
Once the Disk Image is mounted, you will recognize the user’s home directory:
Finder – dogcow User Home Directory
The image is locked, and can be verified with a Get Info from the Finder. All searches and file examinations are read-only at this point.
To be more complete in this examination, hash values should be computed prior to mounting theimage file, and after ejecting the image file.
DiskUtility and DMG Files
Disk Utility – Help Window
Disk Utility is a powerful application included with every Macintosh running MacOS X. If youhaven’t already, look at the Help file for this program and familiarize yourself with its many function. We are going to talk about a few specific areas of forensic value in this application. In orderfor Disk Utility to function, DiskArbitration needs to be enabled. As an examiner, you will want tohave acquired your image of the target first, then, with your examination computer, you can reenable DiskArbitration.
DMG vs. sparseimage
There are many types of “image” files. DD is a UNIX (or linux) utility that creates a Disk Dumpof the given device. Guidance Software’s Encase creates E01 files for it’s output. Disk Utilitynatively will create the DMG file or Disk Image file, as well as the sparseimage file. It has the ability to deal with many other file types that will not be dealt with here. The MAN page on hdiutilwill give you a wealth of knowledge on current and historical image file types. The biggest difference between the DMG file and sparseimage file is initial file size. A DMG file will have the filesize allocated up front in creation. For instance, when creating a DMG file of size 40MB, 40MBof disk space will used right away. When creating the sparseimage file of 40MB in size, about 10MB will be used initially, and the file will grow (or shrink) as necessary up to the maximum of 40MB.
Encrypted vs. Unencrypted
The encryption provided thru the Disk Utility program is AES 128 bit encryption. It is used by default when a user’s home directory is encrypted with FileVault, and can also be selected during thecreation of a DMG file. An encrypted DMG file or sparseimage file is near useless in today’s computing environment. A brute force attack with a dictionary or rainbow table may yield good results,but likely will give you what you started with, nothing. This section is not written to discourageyou from obtaining encrypted DMG or sparseimage files. It is to encourage you to pursue otherinvestigative measures in obtaining the password. The best encryption in the world is easilycracked with the password written on a sticky note.
DD and Raw Images
DD or Disk Dump is an old UNIX utility that was used to back up systems to tape drives originally. It turns out that DD creates a forensically sound image of a device for us. There are specialized versions of this program, such as DCFLDD that extend the original capabilities of DD. Manyprograms use DD as their underlying basis of operation. A DD image file is considered a raw imagebecause it will match the original device, but for bit, with no compression. Mounting a DD imagefile for analysis will show that the file is indistinguishable from the original and will produce thesame MD5 hash value. There is a known flaw with DD running on linux with certain versions ofthe kernel code. The flaw simply causes DD to miss the last sector of some odd-total-sector drives.This is rare to find, but worth noting in this section.