DEV Community

Josh Brown
Josh Brown

Posted on

macOS Apps should need User Permission before being able to Autostart

macOS has significantly beefed up security recently with the addition of privacy access prompts. Since macOS Mojave 10.4, mac apps need explicit permission before accessing things like microphone, camera, and the full disk. Permission can be easily revoked through system preferences.

Screen Shot 2021-03-11 at 5.59.19 PM

Prompt example for Chrome to access camera on Big Sur

System Preferences privacy tab

As you can see, Discord can currently access my microphone, however, I can instantly revoke that access.

This limits malware and other nefarious program's ability to automatically access privacy features.

However, macOS has no such prompt for adding auto-launch scripts called LaunchAgents and LaunchDaemons. Any application, once opened, can automatically make itself start on login or on boot. macOS apps can also hide themselves from the dock, allowing applications to run automatically in the background without user knowledge.

macOS provides no GUI means to remove LaunchAgents/LaunchDaeomons. The only way to remove them is to find the plist file and manually trash it. What's worse is there are 5 possible locations they can exist making it nearly impossible for the average user to stop an app from auto-starting:

  • /Library/LaunchAgents/
  • /Library/LaunchDaemons/
  • /System/Library/LaunchAgents/
  • /System/Library/LaunchDaemons/
  • ~/Library/LaunchAgents/

(Technically without SIP disabled it couldn't exist in /System/, but that still leaves 3 possible locations)

For legitimate apps, Apple provides the ability for users to add and remove "Login Items" through System Preferences. But LaunchAgents and LaunchDaeomons completely bypass this menu.

This isn't just an issue for malware and other malicious software. Legitimate apps such as Spotify have taken advantage of this and auto-start by default. Spotify gives the ability to disable it but the setting is listed deep in their "advanced" settings section. Notice how auto-start is enabled in Spotify but is not listed in System Preferences:

Spotify and System Preferences

Therefore, macOS should add a prompt requirement for adding LaunchAgents and LaunchDaemons. They should also replace the "Login Items" menu in System Preferences with a consolidated GUI interface to manage startup scripts, giving users the ability to remove existing scripts and add new ones. Maybe even add the ability to schedule times to auto-open applications.

Top comments (1)

Collapse
 
payelsenapati1 profile image
Payel Senapati

This feature has always been in Ubuntu, please read wiki.ubuntu.com/SecurityPermissions