Aftermath is a Swift-based, open-source incident response framework.
Aftermath can be leveraged by defenders in order to collect and subsequently analyze the data from the compromised host. Aftermath can be deployed from an MDM (ideally), but it can also run independently from the infected user’s command line.
Aftermath first runs a series of modules for collection. The output of this will either be written to the location of your choice, via the
--output option, or by default, it is written to the
Once collection is complete, the final zip/archive file can be pulled from the end user’s disk. This file can then be analyzed using the
--analyze argument pointed at the archive file. The results of this will be written to the
The administrator can then unzip that analysis directory and see a parsed view of the locally collected databases, a timeline of files with the file creation, last accessed, and last modified dates (if they’re available), and a storyline which includes the file metadata, database changes, and browser information to potentially track down the infection vector.
To build Aftermath locally, clone it from the repositorygit clone https://github.com/jamf/aftermath.git
cd into the Aftermath directorycd <path_to_aftermath_directory>
Build using Xcodexcodebuild -scheme “aftermath”
cd into the Release foldercd build/Release
Run aftermathsudo ./aftermath
Aftermath needs to be root, as well as have full disk access (FDA) in order to run. FDA can be granted to the Terminal application in which it is running.
The default usage of Aftermath runssudo ./aftermath
To specify certain optionssudo ./aftermath [option1] [option2]
Examplessudo ./aftermath -o /Users/user/Desktop –deepsudo ./aftermath –analyze <path_to_collection_zip>
Users have the ability to pass Aftermath a text file of unified log predicates using the
-l arguments. The file being passed to Aftermath is required to be a text file and each predicate needs to be newline-separated.
In addition, each line item will be a dictionary object. The key in the dictionary will whatever the user desires to call this predicate.
For example, if you want to see all login events, we will create a predicate and title it
login_events: processImagePath contains "loginwindow" and eventMessage contains "com.apple.sessionDidLogin tcc: process == "tccd"
tcpdump run on additional threads and the goal is to collect as much data from them as possible, they exit when aftermath exits. Because of this, the last line of the eslogger json file or the pcap file generated from tcpdump may be truncated.
There is an Aftermath.pkg available under Releases. This pkg is signed and notarized. It will install the aftermath binary at
This would be the ideal way to deploy via MDM. Since this is installed in
bin, you can then run aftermath likesudo aftermath [option1] [option2]
To uninstall the aftermath binary, run the
AftermathUninstaller.pkg from the Releases. This will uninstall the binary and also run
aftermath --cleanup to remove aftermath directories.
If any aftermath directories reside elsewhere, from using the
--output command, it is the responsibility of the user/admin to remove said directories.
--analyze -> analyze the results of the Aftermath results usage: --analyze <path_to_aftermath_collection_file> --collect-dirs -> specify locations of (space-separated) directories to dump those raw files usage: --collect-dirs <path_to_dir> <path_to_another_dir> --deep or -d -> perform a deep scan of the file system for modified and accessed timestamped metadata WARNING: This will be a time-intensive, memory-consuming scan. --disable -> disable a set of aftermath features that may collect personal user data Available features to disable: browsers -> collecting browser information | browser-killswitch -> force-closes browers | -> databases -> tcc & lsquarantine databases | filesystem -> walking the filesystem for timestamps | proc-info -> collecting process information via TrueTree and eslogger | all -> all aforementioned options usage: --disable browsers browser-killswitch databases filesystem proc-info slack --disable all --es-logs -> specify which Endpoint Security events (space-separated) to collect (defaults are: create exec mmap). To disable, see --disable es-logs usage: --es-logs setuid unmount write --logs -> specify an external text file with unified log predicates (as dictionary objects) to parse usage: --logs /Users/<USER>/Desktop/myPredicates.txt -o or --output -> specify an output location for Aftermath collection results (defaults to /tmp) usage: -o Users/user/Desktop --pretty -> colorize Terminal output --cleanup -> remove Aftermath folders from default locations ("/tmp", "/var/folders/zz/)