What are Atomic Test Harnesses?
Atomic Test Harnesses provide a way to understand in-depth coverage of a given MITRE ATT&CK® technique. In the most simple terms, Atomic Test Harnesses streamline the execution of attack technique variations and validate that the expected telemetry surfaces in the process. It has been a valuable tool in determining whether a technique is being detected correctly.
Originally, AtomicTestHarness was a PowerShell module designed only for Windows. We are excited to announce AtomicTestHarness support for both macOS and Linux. Leveraging Python instead of PowerShell, the POSIX suite can be installed using
How do they differ from Atomic Red Team tests?
Atomic Red Team tests focus on highlighting the end behaviors (procedural examples) of ATT&CK techniques. By contrast, Atomic Test Harnesses provide a comprehensive programmatic implementation of an ATT&CK technique agnostic of adversarial behaviors. In other words, regular atomics exercise single, atomic behavior, whereas test harnesses seek to demonstrate all the different ways an adversary can execute a given technique.
Why do we need them for macOS and Linux?
Over time, we saw the benefit of Atomic Test Harnesses on Windows. We were able to provide a much deeper analysis of a given ATT&CK technique and gained insight into our detection abilities. In the past few years, we have seen a significant rise in the amount of malware targeted towards macOS and Linux. We felt a strong need to bring Atomic Test Harnesses to those platforms in order to stay ahead of the emerging threats that we are seeing.
How do the POSIX Atomic Test Harnesses work?
When we were designing the macOS and Linux versions of Atomic Test Harnesses we wanted to use a language that was accessible to as many people as possible that could also work across multiple platforms. We also wanted to use a language that was easy to understand and modify for ease of user customization. It was for these reasons that we chose Python. Similar to how the Windows Atomic Test Harnesses use Pester to orchestrate tests and verify correct execution of the test, we used
pytest as a test runner.
Let’s look at an example of how one would install and run a test using the POSIX version of Atomic Test Harness. The easiest way to get up and running is to install the
posixath Python package with either:
pip install posixath
pipenv install posixath
Once the package is installed, users can run
python -m posxiath –help to see the list of available commands as well as examples of how to run the tests. For more extensive documentation, there is a docs folder in the GitHub repo that houses a set of Markdown files for each attack technique. These can be viewed locally by following the instructions in the README.
To run a test there are two fields that are required: the platform (i.e., macOS or Linux) and the attack technique to run. Below is an example run of T1018: Remote System Discovery:
python -m posixath linux -t t1018
/usr/bin/osascript platform binary), but might not detect programmatic execution via the OSAKit framework.
- Install the POSIX AtomicTestHarness suite
a. Install Python on macOS. To do this we recommend using pyenv.
b. Install the POSIX AtomicTestHarness suite:
python -m pip install posixath
- Before running the AtomicTestHarnesses, start a system monitor of some kind. We will monitor ESF directly, but additional options include:
/usr/bin/eslogger for an ESF logging platform binary. (macOS 13 Ventura and greater)
Activity Monitor.app for generic high level system activity
Console.app for the unified system log (with private logging enabled)
d. Osquery: Free endpoint behavioral monitoring
e. Utilities from The Mitten Mac and Objective-See.
- Run the tests for AppleScript and JXA:
python -m posixath macos -t T1059_002
python -m posixath macos -t T1059_007
- Stop the recording of system events or start hunting using the the tool chosen in step #2.
Brandon Dalton demonstrated these tests and more in our recent Detection Series webinar:
Interpretation of these results is dependent on the EDR product chosen. While most EDR products targeting macOS leverage ESF, there isn’t feature parity among all vendors. Using the data below, keep in mind whether your endpoint security solution can see the same data. If data is missing, you’ve found a gap in applied detections.