Login Hook

T1037.002

Sub-technique of T1037 Boot or Logon Initialization Scripts.View on attack.mitre.org

About this technique

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

Detection rules1

Rules on DetectionCode tagged with T1037.002.

Sigma0

No Sigma rules are mapped to this technique yet.

Splunk1

RuleTypeRiskData source
MacOS LoginHook PersistenceTTPNULLOsquery Results

Groups0

None recorded.

Software0

None recorded.

Campaigns0

None recorded.

Procedure examples0

No procedure examples are recorded for this technique.

References4

  1. Login Scripts Apple Dev Open source
    Apple. (2016, September 13). Customizing Login and Logout. Retrieved April 1, 2022.
  2. LoginWindowScripts Apple Dev Open source
    Apple. (n.d.). LoginWindowScripts. Retrieved April 1, 2022.
  3. S1 macOs Persistence Open source
    Stokes, P. (2019, July 17). How Malware Persists on macOS. Retrieved March 27, 2020.
  4. Wardle Persistence Chapter Open source
    Patrick Wardle. (n.d.). Chapter 0x2: Persistence. Retrieved April 13, 2022.

Data from MITRE ATT&CK® (Enterprise). ATT&CK® is a registered trademark of The MITRE Corporation.