Mac OSX TTPs

Table of Contents


Enumeration (T1082)

Gathering System Information Using IOPlatformExpertDevice (T1082)

The ioreg command allows interaction with the I/O Kit registry, and the -c flag specifies the class of devices to list. The IOPlatformExpertDevice class provides information about the platform expert, which includes various system attributes. The -d flag specifies the depth of the search within the device tree.

Exploring Application Bundles (T1083)

Applications on macOS are stored in the /Applications directory. Each application is bundled as a .app file, which is actually a directory with a specific layout. Key components of an application bundle include:

  1. Info.plist: This file contains application-specific configuration, entitlements, tasks, and metadata.

  2. MacOS: This directory contains the Mach-O executable.

  3. Resources: This directory includes icons, fonts, and images used by the application.

Basic System Enumeration (T1082)

Versions:

A basic script for gathering system information using osascript:

Environment Variables:

Home Folders:

Wireless Network:

Users (T1087.001)

The three types of MacOS users are:

  • Local Users — Managed by the local OpenDirectory service, they aren’t connected in any way to the Active Directory

  • Network Users — Volatile Active Directory users who require a connection to the DC server to authenticate

  • Mobile Users — Active Directory users with a local backup for their credentials and files

Last Login (T1087)

This command reads the contents of the login window preferences plist file. This can potentially expose information such as:

  1. Automatic login settings

  2. Display of usernames and other login screen options

  3. Shutdown and restart privileges

  4. Login hooks (scripts that run at login)

Passwords (T1003)

The following one-liner which will dump credentials of all non-service accounts in Hashcat format -m 7100 (macOS PBKDF2-SHA512):

Safari History (T1217)

Retrieve Safari history for user:

Safari Settings (T1217)

To view all the settings for Safari, run:

Output example:

Keychains (T1555.001)

[!TIP] The last command will prompt the user for their password each entry, even if root. This is extremely noisy

Network Services (T1046)

SMB Shares (T1135)

AFP Shares (T1135)

SSH Scanning (T1046)

Browse for all SSH services that are currently advertised on the local network

Network Service Scanning (T1046)

dns-sd: Uses Bonjour to discover network services like AFP, SMB, and more.

System Profiler (T1082)

It is an application created to gather detailed information about the Mac on which it is running.

Persistence (T1543.001)

Extended Attributes (T1564.004)

Extended attributes (EAs) on macOS can be used maliciously by attackers to hide data, evade detection, or persist malicious code, since EAs are not visible through typical file inspection methods

LaunchAgent Backdoors (T1543.001)

LaunchAgent plists are a common target because they provide persistent access that survives reboots. Take this Grammarly helper, for example:

We could modify the ProgramArguments array to execute malicious commands instead of or alongside the legitimate Grammarly helper:

The RunAtLoad and KeepAlive keys make this particularly dangerous because the malicious payload would execute automatically at login and restart if it crashes. The MachServices configuration also provides inter-process communication capabilities that could be exploited.

Last updated