MITRE ATT&CKsub-technique
T1037.002 Login Hook
- Domain
- enterprise
- Tactics
- Persistence, Privilege Escalation
- Platforms
- macOS
- Version
- 2.0
- Created
- 2020-01-10
Description
Adversaries may use a Login Hook to establish persistence executed upon user logon. A login hook is a plist file that points to a specific script to execute with root privileges upon user logon. The plist file is located in the /Library/Preferences/com.apple.loginwindow.plist file and can be modified using the defaults command-line utility. This behavior is the same for logout hooks where a script can be executed upon user logout. All hooks require administrator permissions to modify or create hooks.
Adversaries can add or insert a path to a malicious script in the com.apple.loginwindow.plist file, using the LoginHook or LogoutHook key-value pair. The malicious script is executed upon the next user login. If a login hook already exists, adversaries can add additional commands to an existing login hook. There can be only one login and logout hook on a system at a time.
Note: Login hooks were deprecated in 10.11 version of macOS in favor of Launch Daemon and Launch Agent
Related
Subtechnique of · MITRE ATT&CK (1)
- T1037 Boot or Logon Initialization Scripts technique
Referenced by MITRE ATT&CK · mitigates (1)
- M1022 Restrict File and Directory Permissions mitigation
Referenced by Compliance · mitigates (7)
- NIST-AC-3 Access Enforcement NIST 800-53 control
- NIST-CA-7 Continuous Monitoring NIST 800-53 control
- NIST-CM-2 Baseline Configuration NIST 800-53 control
- NIST-CM-6 Configuration Settings NIST 800-53 control
- NIST-SI-3 Malicious Code Protection NIST 800-53 control
- NIST-SI-4 System Monitoring NIST 800-53 control
- NIST-SI-7 Software, Firmware, and Information Integrity NIST 800-53 control
References
- https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CustomLogin.html Login Scripts Apple Dev
- https://developer.apple.com/documentation/devicemanagement/loginwindowscripts LoginWindowScripts Apple Dev
- https://taomm.org/PDFs/vol1/CH%200x02%20Persistence.pdf Wardle Persistence Chapter
- https://www.sentinelone.com/blog/how-malware-persists-on-macos/ S1 macOs Persistence