Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Adversaries may use a Login Hook to establish persistence executed upon user logon.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 7% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 24% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 40% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 26% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 32% | 0% |
> Sub-technique of: T1037
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 <code>/Library/Preferences/com.apple.loginwindow.plist</code> file and can be modified using the <code>defaults</code> 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 <code>com.apple.loginwindow.plist</code> file, using the <code>LoginHook</code> or <code>LogoutHook</code> 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
Platforms: macOS
The following tests are from Atomic Red Team and provide actionable ways to test this technique:
Mac logon script
Supported Platforms: macos
If Atomic Red Team tests are not applicable, manually verify the technique by:
Restrict write access to logon scripts to specific administrators.
| Finding | Severity | Impact | | ------------------------------- | -------- | ----------- | | Login Hook technique applicable | High | Persistence |
| CWE ID | Title | | ------- | ----------------------------- | | CWE-276 | Incorrect Default Permissions |
Other measured skills in the registry, with their headline benchmark lift.