Detection of Unauthorized Local Account Creation on macOS
This brief details the detection of local account creation on macOS systems, a technique often used by adversaries to establish persistence or facilitate privilege escalation through administrative utilities.
Monitoring the creation of new local user accounts on macOS is a critical defense requirement, as this activity is frequently associated with persistence establishment, lateral movement, or unauthorized privilege escalation. Attackers often leverage built-in administrative utilities such as sysadminctl, dscl, dseditgroup, or createhomedir to add accounts or modify group memberships silently. While these tools are essential for legitimate system administration and endpoint management, their use outside of defined lifecycle windows - such as initial provisioning or authorized maintenance - often signals malicious intent. Detection engineers should focus on identifying these process executions to prevent long-term system compromise. The provided detection logic is intended for integration within environments using Osquery for endpoint telemetry, requiring the deployment of the TA-OSquery add-on to ensure proper mapping to common data models.
Attack Chain
- Adversary gains initial access to a macOS endpoint.
- Adversary identifies the need for persistent or elevated access.
- Adversary executes a command-line tool, such as
sysadminctl -addUser, to create a new local account. - Adversary may use
dseditgroupto add the newly created account to the 'admin' group for elevated privileges. - Adversary uses
dscl -createto further configure user attributes or metadata for the account. - Account is successfully created on the local system, providing a backdoor for future access.
- Adversary uses the new credentials to authenticate to the machine and perform further post-exploitation activities.
Impact
Unauthorized creation of local accounts allows attackers to maintain persistent access to a compromised system, effectively bypassing temporary credential expirations or single-use access tokens. This can lead to full host compromise, exfiltration of sensitive organizational data, and the facilitation of lateral movement throughout the network. If left undetected, persistent accounts may remain active for extended periods, complicating remediation efforts and increasing the total scope of an incident.
Recommendation
- Implement monitoring for administrative processes on macOS endpoints using Osquery.
- Deploy the TA-OSquery add-on to all indexers and universal forwarders to ensure endpoint data is correctly ingested into the Enterprise Security data models.
- Establish a baseline for authorized account creation activity to minimize false positives from standard endpoint management software.
- Investigate any occurrences of
sysadminctl,dscl, ordseditgroupexecution on endpoints that do not originate from authorized deployment or administration process trees.
Immediate actions
Deploy TA-OSquery and enable monitoring for administrative process execution
Threat Hunt
Search for historical instances of sysadminctl or dscl account creation to establish a baseline
Data: Process creation events from Osquery/Endpoint logs
Mitigations
Enforce strict Least Privilege policies on endpoints
Privilege escalation via new accounts
Gaps
- Telemetry gap if endpoint management tools do not properly report process arguments