Skip to content
Digital Forensics

MAC Device Forensics

MAC device forensics involves analyzing Mac systems to recover evidence, including system logs, user activity, and deleted files. It focuses on understanding macOS-specific artifacts such as plist files, keychains, and Time Machine backups. Investigators use specialized tools to extract and interpret data unique to Apple's operating system.

3 min read
How to Forensics a MAC Device

🔍 MAC Device Forensics

Forensics on macOS devices involves understanding macOS-specific artifacts, retrieving deleted data, and analyzing system logs. Below is a detailed guide covering tools, techniques, and methodologies for conducting MAC device forensics.


🖥️ Key Analysis Areas

  1. macOS Logs: Logs related to user activities and system behavior.
  2. Browser History: Accessed sites, cached data, and downloads.
  3. OS Update History: Tracking updates and system changes.
  4. Installed Applications: Programs and associated artifacts.
  5. Plist Files: Configuration files containing user and system data.
  6. Browser Extensions: Potential malware through extensions.
  7. Email Artifacts: Stored emails and attachments.

🗂️ macOS Forensic Artifacts

TCC Database

The TCC database contains user consent records for applications accessing privacy-protected data:

  • /Library/Application Support/com.apple.TCC/TCC.db
  • ~/Library/Application Support/com.apple.TCC/TCC.db

Plist Files

Plist files store preferences and settings:

  • ~/Library/Preferences/com.apple.universalaccessAuthWarning.plist

Application Directories

  • Installed applications:
    • ~/Applications
    • /Applications

Persistence Mechanisms

Cron Jobs:

  • /etc/crontab
  • /usr/lib/cron/tabs
  • /private/etc/crontab

Launch Daemons:

  • $HOME/Library/LaunchAgents
  • /Library/LaunchDaemons
  • /Library/LaunchAgents

Unix Startup Configurations:

  • /etc/rc.*
  • .bashrc
  • .profile

Kernel Extensions

  • /System/Library/Extensions
  • /Library/Extensions

enter image description here

🌐 Browser Artifacts

Chrome

  • Profile directories:
    • ~/Library/Application Support/Google/Chrome/Default
    • ~/Library/Application Support/Google/Chrome/Profile N (N = Profile Number)
  • Extensions:
    • ~/Library/Application Support/Google/Chrome/Default/Extensions

Tools:
Use Liya for analyzing SQLite files.

Safari

  • Relevant files:
    • /Users/<username>/Library/Safari

✉️ Email Artifacts

Apple Mail stores emails and attachments in:

  • /Library/Mail
  • ~/Library/Mail

🔎 Useful Scripts for Forensics

Search Encrypted Archives

#!/bin/bash
root_dir="/path/to/folder"
find $root_dir -name "*.zip" | while read x
do
    echo $x
    7z l -slt "$x" | grep "Encrypted"
done

Detect Macros in Excel Files

#!/bin/bash
root_dir="/path/to/folder"
i=0
find $root_dir -name "*.xls*" | while read x
do
    echo $x
    unzip "$x" -d "out_dir/dir_$i"
    ((i++))
done

Run: find out_dir -name "vbaProject.bin"


🧩 User Activity Analysis

Active Users

  • Use Activity Monitor: /Applications/Utilities/Activity Monitor

Command-Line Options

  • List logged-in users:
    last

  • Filter specific users:
    last | grep USERNAME

  • Currently logged-in users:
    who


Forensics Tools

enter image description here

🔐 Malware Blocking with DNS

Malware-Blocking DNS

  • 1.1.1.2
  • 1.0.0.2

Malware and Adult Content Blocking DNS

  • 1.1.1.3
  • 1.0.0.3

🛠️ Forensic Tools for macOS

Essential Tools

ToolPurpose
MalwarebytesMalware detection and removal.
VeraCryptDisk encryption for securing sensitive files.
GNU Privacy GuardEncryption for files and emails.

🔧 Uninstall Scripts

Remove Visual Studio

sudo rm -rf "/Applications/Visual Studio.app"
rm -rf ~/Library/Caches/VisualStudio
rm -rf ~/Library/Preferences/VisualStudio
rm -rf "~/Library/Preferences/Visual Studio"
rm -rf ~/Library/Logs/VisualStudio

Remove Xamarin

sudo rm -rf /Developer/MonoDroid
rm -rf ~/Library/MonoAndroid
sudo pkgutil --forget com.xamarin.android.pkg

🔗 Additional Resources



🚀 Advanced Forensic Techniques for macOS

To extract and analyze macOS artifacts, advanced techniques often require specialized tools and in-depth knowledge of the file system.

📂 Time Machine Backups

Time Machine maintains a history of files, which can be invaluable for forensic analysis.

  • Default location: /Volumes/<backup_drive>/Backups.backupdb/

Use the tmutil command to manage Time Machine backups:

tmutil listbackups
tmutil compare /path/to/file

🔍 Spotlight Database

Spotlight indexes files and metadata, which can provide information about user activity.

  • Spotlight database location:
    • /private/var/db/Spotlight-V100/
    • ~/.Spotlight-V100/

Use mdls to query metadata:

mdls /path/to/file

🔑 Keychain Analysis

The macOS Keychain securely stores user credentials and passwords. Forensic tools like Keychain Dumper can extract this data (requires root access).

Keychain files are located at:

  • ~/Library/Keychains/
  • /Library/Keychains/

🌐 Network Forensics on macOS

Monitoring network activity and identifying connections can help trace unauthorized access or data exfiltration.

🔗 Useful Commands

CommandDescription
nettopReal-time network activity monitoring.
tcpdumpPacket capture for network analysis.
lsof -iList open files associated with network sockets.
iftopMonitor bandwidth usage in real time.

Example: Capture all HTTP traffic using tcpdump:

sudo tcpdump -i en0 -nn port 80

📑 macOS Log Files

Log files contain critical information about system events, errors, and user activities.

Log File LocationDescription
/var/log/system.logSystem-wide logs.
/var/log/install.logSoftware installation history.
~/Library/Logs/User-specific logs.
/private/var/log/asl/Apple System Logger logs.

Use the log command to query logs:

log show --predicate 'eventMessage contains "login"' --info

🛡️ Securing Evidence

Write-Blocker

Always use a write-blocker to ensure forensic integrity when analyzing storage devices.

File Hashing

Generate hashes to verify the integrity of copied files:

shasum -a 256 /path/to/file

🔧 macOS-Specific Forensic Tools

ToolPurpose
BlackLightComprehensive macOS forensic analysis.
Recon LABAutomated macOS artifact extraction.
MacQuisitionImaging and analyzing macOS devices.

💡 Forensic Best Practices

  1. Preserve Evidence: Use write-blockers and document all actions.
  2. Analyze Backups: Don’t overlook Time Machine and iCloud backups.
  3. Verify Timestamps: Cross-reference file timestamps with log files.
  4. Leverage Automation: Use scripts and tools for consistent analysis.

🔗 Further Learning and Resources

  1. macOS Forensics Cheat Sheet
  2. DFIR Training Resources
  3. Digital Forensics and Incident Response Blog

Unlock the full potential of macOS forensics with a blend of tools, scripts, and best practices. 🔍🖥️✨


Share article

Subscribe to my newsletter

Receive my case study and the latest articles on my WhatsApp Channel.