
macOS Hardening: Practical Security Configuration
macOS hardening guide covering FileVault, SIP, Gatekeeper, application firewall, Lockdown Mode, and Objective-See tools.
Introduction
A small market share no longer keeps Macs out of attackers' sights. Intel 471 counted roughly twice as many threat actors targeting Apple devices in 2023-2024 as in the period before, from commodity infostealers to nation-state tooling. MacStealer and ShadowVault, both sold on dark web forums, pull Keychain data, browser cookies and documents off fully patched Apple Silicon machines. NotLockBit, a LockBit-style encryptor written in Go, showed that ransomware on macOS is a real deployment option.
Apple's built-in controls are good. XProtect got 29 signature updates in 2024 and its rule set grew by 170%. T2 and Apple Silicon enforce code signing in hardware from the boot ROM up. Those controls only hold when SIP is intact, Gatekeeper is configured correctly and software is current. Getting from a default Mac to a hardened one is a short list of specific settings you can verify.
This note is that list: what to turn on, what to turn off, how to check each setting, and what an attacker looks for when a default is left in place.
Authorization required
This note describes defensive configuration for systems you own or are authorized to administer. Disabling SIP or modifying security baselines on systems without explicit authorization is unauthorized access in most jurisdictions. All verification commands are read-only unless otherwise noted.
Impact
On a Mac left at its defaults, this is what an attacker can count on:
- Infostealers (MacStealer, ShadowVault, Atomic Stealer) reading the Keychain, browser credential stores and session cookies
- LaunchAgent or LaunchDaemon persistence that survives reboots and that nobody notices, because nothing monitors those paths
- SSH, Screen Sharing or Remote Management left running, often without the user knowing, which gives a path for lateral movement
- SIP bypass through unpatched vulnerabilities (CVE-2024-44243 is a recent example, patched December 2024)
- On systems before Sequoia, running unsigned code by right-clicking it in Finder and confirming one Gatekeeper prompt
- Exfiltration over outbound connections, since nothing filters outbound traffic by default
- On Intel Macs without a firmware password, booting from arbitrary media
Technical details
Patch cadence and XProtect
Apple pushes XProtect, XProtect Remediator and Gatekeeper Configuration Data updates silently through CloudKit, separately from OS updates. macOS 15 (Sequoia) reworked this pipeline so updates arrive more often than OS releases. You won't know when they land, so check the installed versions directly.
XProtect matches known malware signatures before execution. XProtect Remediator, which replaced the older MRT (Malware Removal Tool), scans periodically and removes known infections afterwards. Neither is behavioral detection, and both need to be current. Missing a full macOS point release means missing firmware fixes, kernel patches, and security framework updates that XProtect signatures cannot compensate for.
In an enterprise, use MDM (Jamf, Kandji, Mosyle) to enforce a minimum OS version and push updates on a defined SLA. A common split is 30 days for routine releases and 72 hours for actively exploited CVEs.
FileVault full-disk encryption
FileVault uses XTS-AES-128 with a 256-bit key. On T2 and Apple Silicon the encryption runs in hardware, so the performance cost is negligible. The key is derived from the user's login password and the hardware UID fused into the Secure Enclave. Without both, the disk can't be decrypted offline.
Enabling FileVault generates a recovery key. Managed fleets should escrow it to MDM. Personal devices can use iCloud key recovery instead. Lose the password and the recovery key and the data is gone, by design.
FileVault does nothing for a running, logged-in system. It protects against offline access to the disk after theft or seizure, and that's all.
Time Machine disks and external volumes need their own encryption. APFS encrypted volumes can be created natively, and HFS+ encrypted volumes through Disk Utility. An unencrypted backup of an encrypted Mac throws the protection away.
System Integrity Protection (SIP)
SIP stops anyone, root included, from modifying /System, /usr, /bin, /sbin and several other protected paths. It also blocks unsigned kernel extensions, stops runtime injection into system processes, and protects NVRAM. Turning SIP off means booting into Recovery Mode. A running process can't disable it, whatever its privileges.
CVE-2024-44243 (patched December 2024, written up by Microsoft) was a SIP bypass through storagekitd, an Apple daemon that holds the com.apple.rootless.install.heritable entitlement. An attacker already running as root drops a third-party file system bundle into /Library/Filesystems and starts a disk repair or erase, and storagekitd runs the bundle's binary with that entitlement inherited. Microsoft used it to override the kernel extension exclusion list, which allows loading third-party kernel extensions. There is no kernel memory corruption involved, and that kind of entitlement abuse is where recent SIP bypasses come from. Restrict kext loading and patch promptly.
Most macOS post-exploitation frameworks check SIP status first. On an assessment, SIP disabled is a high-value finding.
Gatekeeper and notarization
Gatekeeper validates code signatures and notarization status before allowing execution of downloaded files. Notarization requires Apple to have scanned the binary for known malware and confirm it's signed with a registered Developer ID. Gatekeeper checks occur at first-run and on subsequent launches if the binary has been modified.
macOS Sequoia (15.0) closed the most abused Gatekeeper bypass: Control-click (right-click) "Open" in Finder no longer overrides Gatekeeper for unsigned or unnotarized apps. Before Sequoia, one right-click and one confirmation ran unnotarized software, and phishing-delivered malware told users to do exactly that. In Sequoia the user has to go to System Settings → Privacy & Security and allow the app there, which is enough friction to stop most drive-by executions.
The spctl command-line tool manages Gatekeeper policy. spctl --assess -v /Applications/AppName.app evaluates whether Gatekeeper would allow execution. The assessment source (Developer ID Application, Mac App Store, notarized) is returned in the output.
Network firewall and outbound controls
macOS ships with pf (packet filter) and the higher-level Application Firewall (socketfilterfw). The Application Firewall controls inbound connections per application and can't filter outbound traffic at all. It is off on a fresh install.
Stealth mode, set through socketfilterfw, stops the system answering ICMP probes and connection attempts on closed ports, so the host looks offline to a scanner. On untrusted networks that cuts down what a scan reveals.
Outbound filtering needs a third-party tool. LuLu (Objective-See) applies per-process outbound rules through the Network Extension framework. The first time an application connects out, LuLu prompts. Allowed rules persist, and a denied rule blocks that process from then on. This is how you notice an infostealer exfiltrating data or an implant calling its C2, both of which are silent by default.
Little Snitch does the same with a richer rule engine and a traffic view, for a license fee. Enterprises usually filter outbound traffic at the network layer (proxy, next-gen firewall), but a host-based filter still helps where the network can't see the traffic.
Persistence monitoring with Objective-See tools
Most macOS malware persists through LaunchAgents (~/Library/LaunchAgents, /Library/LaunchAgents) and LaunchDaemons (/Library/LaunchDaemons). These plists tell launchd to run a binary at login or at boot. Less common options are Login Items, kernel extensions, cron jobs and shell profile changes.
BlockBlock (Objective-See) watches those locations through kernel file system notifications. When a process writes a new persistent item, BlockBlock prompts with the binary, its signing status and the persistence mechanism, and the user allows or blocks it. A LaunchAgent install gets caught at write time, before it ever runs.
KnockKnock lists every persistent item currently registered (LaunchAgents, LaunchDaemons, Login Items, kexts, browser extensions and more) and checks each one against VirusTotal. It's a point-in-time audit, not a monitor. Run it now and then to find persistence that predates BlockBlock or came in through a mechanism BlockBlock doesn't watch.
OverSight alerts when a process turns on the microphone or camera, with the process name and signing identity. That catches meeting-recording malware and RATs that collect audio or video. Check that OverSight supports your macOS version before rolling it out.
User account hygiene
macOS separates standard users from administrators. Administrators can install software, change system settings and run sudo. Standard users can't. If the daily account is an administrator, anything that compromises it (a malicious attachment, a trojanized app) has admin rights with no privilege escalation needed.
Keep a separate admin account for administrative tasks and do daily work as a standard user. Most infostealers and trojans run with the privileges of the user they compromised, so this limits what they get.
Disable auto-login. A physical attacker with boot access and auto-login enabled bypasses authentication entirely. The Guest user account should be disabled unless the device serves a specific kiosk or shared-access function.
Turn on two-factor authentication for the Apple ID. Apple ID recovery can get into devices and reset FileVault through iCloud, so an Apple ID without 2FA is close to physical access for whoever takes it over. Hardware security keys (YubiKey via USB-C or NFC) are supported as 2FA for Apple ID as of iOS 16.3/macOS 13.2.
mSCP compliance baselines
The macOS Security Compliance Project (mSCP) publishes configuration profiles, audit scripts and remediation guidance based on NIST SP 800-219, with Apple engineers among the maintainers. It maps controls to NIST 800-53, DISA STIGs and CIS Benchmarks. Organizations that must meet FISMA, FedRAMP or CIS Level 1/2 can generate profiles with mSCP and deploy them through MDM.
Outside an enterprise, the public CIS macOS Benchmark covers the settings that matter most without needing MDM. CIS Level 1 includes: disable auto-login, require a password after the screensaver, enable FileVault, enable the firewall, disable Remote Login, disable Bluetooth if unused, enable Gatekeeper.
MDM (Jamf, Kandji, Mosyle) is the strongest way to enforce all of this. Profiles apply at enrollment, drift gets detected and corrected automatically, and compliance status can be reported. MDM can also enforce a minimum OS version, require FileVault key escrow and restrict which applications can be installed.
Assessment tools
These are the tools for checking a Mac's security settings on an authorized engagement.
# Check Gatekeeper global policy
spctl --status
# Assess a specific application
spctl --assess -v /Applications/Firefox.app
# List all developer ID exceptions (apps allowed despite policy)
spctl --list
# Remove a specific rule (by rule number from --list output)
spctl --remove --rule 1Expected output for a properly signed app:
/Applications/Firefox.app: accepted
source=Notarized Developer ID
origin=Developer ID Application: Mozilla Corporation (43AQ936H96)Detection
macOS generates security-relevant events across several log sources. Unified Logging (log show, log stream) is the primary collection mechanism.
| Event | Log source | Query / event ID |
|---|---|---|
| SIP disabled | Security subsystem | log show --predicate 'subsystem == "com.apple.MobileFileIntegrity"' |
| LaunchAgent installed | File system events | ESF / BlockBlock alert on ~/Library/LaunchAgents write |
| Unsigned kext load | kernel | log show --predicate 'process == "kextd"' --info |
| Gatekeeper block | GK subsystem | log show --predicate 'subsystem == "com.apple.gatekeeper"' |
| TCC access | TCC daemon | log show --predicate 'subsystem == "com.apple.TCC"' |
| SSH login | auth.log / OpenSSH | /var/log/auth.log or log show --predicate 'process == "sshd"' |
| Firewall block | ALF | log show --predicate 'process == "socketfilterfw"' |
In an enterprise, Santa (Google) adds binary allowlisting with central logging: every execution decision (ALLOW or DENY) is logged with the binary hash, signing identity and user. JAMF Protect and CrowdStrike Falcon for Mac consume Endpoint Security Framework (ESF) events and map them to MITRE ATT&CK. ESF is Apple's API for observing process, file and network events. It needs a system extension with specific entitlements, so it's no good for ad hoc use, but it's what commercial EDR products build on.
Remediation
Apply these settings in order of impact.
Patching
- Enable automatic macOS updates: System Settings → General → Software Update → Automatic Updates (all options on)
- For MDM: enforce minimum OS version with a 30-day grace period for non-critical releases, 72 hours for actively exploited CVEs
FileVault
sudo fdesetup enable -user $(whoami)
# Outputs recovery key: store this securely before proceedingSIP (verify only, do not disable)
csrutil status
# Must return: System Integrity Protection status: enabled.Gatekeeper
# Allow apps from App Store and identified developers only
sudo spctl --master-enable
# Verify
spctl --status
# Expected: assessments enabledApplication Firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode onDisable unnecessary services
# Disable Remote Login (SSH)
sudo systemsetup -setremotelogin off
# Disable Remote Management (ARD/VNC)
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -stop
# Verify no unexpected listeners
sudo lsof -i -P -n | grep LISTENUser account settings
# Disable auto-login
sudo defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser -bool false
# Disable guest user
sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool false
# Require password immediately after screensaver
defaults write com.apple.screensaver askForPasswordDelay -int 0Lockdown Mode
Enable it only for high-risk users (journalists, executives, targets of nation-state actors).
System Settings → Privacy & Security → Lockdown Mode → Turn On Lockdown ModeLockdown Mode disables: JIT compilation in Safari, wired device connections when locked, configuration profiles (unless MDM-enrolled before enabling), message attachment previews, and several communication features. Per-site and per-app exceptions can be configured in Sequoia via System Settings → Lockdown Mode.
Objective-See tools
# LuLu: outbound firewall
brew install --cask lulu
# BlockBlock: persistence monitor
brew install --cask blockblock
# KnockKnock: persistence audit
brew install --cask knockknockAfter installing BlockBlock, run KnockKnock once to list the persistent items already present and confirm none are unknown. BlockBlock only sees new ones.
Verification
Run these checks to confirm the hardening state of a system.
#!/bin/bash
echo "=== macOS Hardening Verification ==="
# SIP
echo -n "[SIP] "; csrutil status
# FileVault
FV=$(fdesetup status 2>/dev/null)
echo "[FileVault] $FV"
# Firewall
FW=$(/usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate 2>/dev/null)
echo "[Firewall] $FW"
# Stealth Mode
SM=$(/usr/libexec/ApplicationFirewall/socketfilterfw --getstealthmode 2>/dev/null)
echo "[Stealth Mode] $SM"
# Gatekeeper
GK=$(spctl --status 2>/dev/null)
echo "[Gatekeeper] $GK"
# Auto-login
AL=$(defaults read /Library/Preferences/com.apple.loginwindow autoLoginUser 2>/dev/null || echo "disabled")
echo "[Auto-login] $AL"
# Guest user
GU=$(defaults read /Library/Preferences/com.apple.loginwindow GuestEnabled 2>/dev/null || echo "0")
echo "[Guest user enabled] $GU (0=disabled)"
# Remote Login
RL=$(sudo systemsetup -getremotelogin 2>/dev/null)
echo "[Remote Login] $RL"
# Screensaver password delay
PD=$(defaults read com.apple.screensaver askForPasswordDelay 2>/dev/null || echo "unknown")
echo "[Screensaver password delay (seconds)] $PD"
# XProtect version
XP=$(defaults read /Library/Apple/System/Library/CoreServices/XProtect.bundle/Contents/Info.plist CFBundleShortVersionString 2>/dev/null)
echo "[XProtect version] $XP"
# Current OS version
sw_versExpected output on a hardened system:
[SIP] System Integrity Protection status: enabled.
[FileVault] FileVault is On.
[Firewall] Firewall is enabled. (State = 1)
[Stealth Mode] Stealth mode enabled
[Gatekeeper] assessments enabled
[Auto-login] disabled
[Guest user enabled] 0 (0=disabled)
[Remote Login] Remote Login: Off
[Screensaver password delay (seconds)] 0References
MITRE ATT&CK techniques
- T1059.004 - Command and Scripting Interpreter: Unix Shell
- T1543.004 - Create or Modify System Process: Launch Daemon
- T1553.001 - Subvert Trust Controls: Gatekeeper Bypass
Tool documentation
- Objective-See BlockBlock: persistence location monitor
- Objective-See LuLu: outbound network firewall
- Objective-See KnockKnock: persistent component enumerator
- Objective-See OverSight: microphone and camera monitor
- macOS Security Compliance Project (mSCP): nIST-mapped compliance baselines
- Google Santa: binary allowlisting for macOS
- Apple Security Releases: official CVE and update history
- Microsoft: Analyzing CVE-2024-44243 SIP Bypass: SIP bypass through storagekitd and third-party file system bundles
- Intel 471: macOS Threat Actor Report: threat actor targeting trends
- SentinelOne: 2024 macOS Malware Review: infostealer and APT campaign analysis
Next steps
macOS Security
macOS security hardening, attack surface analysis, and endpoint security guides for Apple silicon and Intel Macs.
Mobile Application Security
Mobile application penetration testing for Android and iOS, covering static and dynamic analysis, runtime instrumentation with Frida and Objection, and bypassing common protections like SSL pinning and root detection.