macOS Lockdown (mOSL)
Bash script to audit and fix macOS Mojave (10.14.x) security settings
Warnings
- Always run the latest release, not the code in master!
- This script will only ever support the latest macOS release
- This script requires your password to invoke some commands with sudo
Threat Model(ish)
The main goal is to enforce already secure defaults and apply more strict non-default options.
It aims to reduce attack surface but it is pragmatic in this pursuit. The author utilizes Bluetooth for services such as Handoff so it is left enabled.
There is no specific focus on enhancing privacy.
Finally, mOSL will not protect you from the FSB, MSS, DGSE, or FSM.
Full Disk Access
PermissionIn macOS Mojave certain application data is protected by the OS. For example, if Example.app wishes to access Contacts.app data Example.app must be given explicit permission via System Preferences > Security & Privacy > Privacy. However, some application data cannot be accessed via specific permission. Access to this data requires Full Disk Access permission.
mOSL requires that Terminal.app be given the Full Disk Access permission. It needs this permission to audit/fix the following settings:
- disable mail remote content
- disable_auto_open_safe_downloads
These are currently the only settings which require Full Disk Access.
It is not possible to programmatically get or prompt for this permission, it must be manually given by the user.
To give Terminal.app Full Disk Access:
System Preferences > Security & Privacy > Privacy > Full Disk Access > Add Terminal.app
Once you are done with mOSL you can revoke Full Disk Access for Terminal.app. There’s a small checkbox next to Terminal which you can uncheck to revoke the permission without entirely removing Terminal.app from the list.
More info on macOS’s new permission model:
- Working with Mojave’s Privacy Protection by Howard Oakley
- TCC Round Up by Carl Ashley
- WWDC 2018 Session 702 Your Apps and the Future of macOS Security
Settings that can be audited/ fixed:
[0] enable automatic system updates
[1] enable automatic app store updates
[2] enable gatekeeper
[3] enable firewall
[4] enable admin password preferences
[5] enable terminal secure entry
[6] enable sip
[7] enable filevault
[8] disable firewall builin software
[9] disable firewall downloaded signed
[10] disable ipv6
[11] disable mail remote content
[12] disable remote apple events
[13] disable remote login
[14] disable auto open safe downloads
[15] set airdrop contacts only
[16] set appstore update check daily
[17] set firmware password
[18] check kext loading consent
[19] check efi integrity
[20] check if standard user
Changelog v3.2.1
fix
: Removed reference tono_fix_commands
variable which would causefix
mode to error withunbound variable
when callingcheck_if_standard_user
(c0e30d1)
Download
Copyright (c) 2018 0xmachos