Trusted Design

T1162 - Login Item

概要

MacOS provides the option to list specific applications to run when a user logs in. These applications run under the logged in user's context, and will be started every time the user logs in. Login items installed using the Service Management Framework are not visible in the System Preferences and can only be removed by the application that created them (Citation: Adding Login Items). Users have direct control over login items installed using a shared file list which are also visible in System Preferences (Citation: Adding Login Items). These login items are stored in the user's ~/Library/Preferences/ directory in a plist file called com.apple.loginitems.plist (Citation: Methods of Mac Malware Persistence). Some of these applications can open visible dialogs to the user, but they don’t all have to since there is an option to ‘Hide’ the window. If an adversary can register their own login item or modified an existing one, then they can use it to execute their code for a persistence mechanism each time the user logs in (Citation: Malware Persistence on OS X) (Citation: OSX.Dok Malware). The API method SMLoginItemSetEnabled can be used to set Login Items, but scripting languages like AppleScript can do this as well (Citation: Adding Login Items).

管理者によるコメント

T1162は「Login Item(ログインアイテム)」として定義されていた、macOS環境における自動実行・永続化手法です。

T1159(Launch Agent)や T1160(Launch Daemon)が設定ファイル(.plist)をベースにする手法だったのに対し、T1162(Login Item)は「macOSのGUIや公式API、あるいはAppleScriptの仕組みを悪用して、ユーザーがログインした際にアプリやスクリプトを自動起動させる」手法です。

1. 「Login Item(ログインアイテム)」とは?

Macユーザーには馴染みの深い、システム設定の「ログイン項目」そのものです。ユーザーがMacにサインインした際、メールアプリやチャットツールを自動的に立ち上げるための正規機能です。

攻撃者はこの仕組みを悪用し、マルウェア(遠隔操作ツールなど)をログイン項目へと滑り込ませます。実行権限はログインしたユーザーのものになるため、管理者権限(root権限)を持たない初期侵入の段階から利用できるという特徴があります。

2. 攻撃者が Login Item を好む「2つのルート」

攻撃者がこの自動起動を仕込む際、主に以下の2つのアプローチ(API/スクリプト)が使われます。それぞれ検知の難易度が異なります。

① Shared File List ルート(可視化されるが手軽)

macOSの「LaunchServices」という機能を使い、ログイン時に開くファイルのリスト(共有ファイルリスト)にマルウェアのパスを追加します。

applescript tell application "System Events" to make login item at end with properties {path:"/path/to/malware", hidden:true}

② Service Management Framework ルート(ステルス性が極めて高い)

アプリ開発者向けの公式APIである SMLoginItemSetEnabled を悪用する高度な手口です。

3. 攻撃の流れ

  1. 侵入とマルウェア設置:
    フィッシングメールなどを経由してMacに侵入し、ユーザーのホームディレクトリ内など(例: ~/Library/Application Support/)にバックドアを設置します。

  2. 自動起動の登録:

    • 一般ユーザー権限のまま、AppleScript(osascript コマンド)を実行して共有ファイルリストに登録する。
    • もしくは、あらかじめヘルパーを内包した不正アプリを実行させ、API経由でサイレント登録する。
  3. 継続的なアクセス:
    ユーザーがMacを再起動したり、ログアウト後に再ログインするたびに、バックドアが自動的に起動し、C2サーバーへの接続を確立します。

4. 防御・対策

設定ファイルや不審なコマンドの動きを捉える必要があります。

5. 関連する代表的な事例

実務上のアドバイス

T1159(Launch Agent)とT1162(Login Item)は、どちらも「ユーザーログイン時」に動くため混同されがちですが、「plistという設定ファイルを書くか(Agent)」「OSのLaunchServicesやAPIに直接登録するか(Login Item)」 という実装の違いがあります。

調査の際は、不審なplistがないからと安心せず、backgrounditems.btm の改ざんや、アプリ bundle 内に隠された隠しログインアイテムの有無まで目を光らせるのがセオリーです。

分析

この攻撃手法を利用する脅威アクター

この攻撃手法を利用する脅威アクターは登録されていません。

関連する CVE

この攻撃手法に関連する CVE は登録されていません。

攻撃手法 – 脅威アクター Graph


← Technique一覧に戻る ← Tactics一覧に戻る