Trusted Design

T1159 - Launch Agent

概要

Per Apple’s developer documentation, when a user logs in, a per-user launchd process is started which loads the parameters for each launch-on-demand user agent from the property list (plist) files found in /System/Library/LaunchAgents, /Library/LaunchAgents, and $HOME/Library/LaunchAgents (Citation: AppleDocs Launch Agent Daemons) (Citation: OSX Keydnap malware) (Citation: Antiquated Mac Malware). These launch agents have property list files which point to the executables that will be launched (Citation: OSX.Dok Malware).

Adversaries may install a new launch agent that can be configured to execute at login by using launchd or launchctl to load a plist into the appropriate directories (Citation: Sofacy Komplex Trojan) (Citation: Methods of Mac Malware Persistence). The agent name may be disguised by using a name from a related operating system or benign software. Launch Agents are created with user level privileges and are executed with the privileges of the user when they log in (Citation: OSX Malware Detection) (Citation: OceanLotus for OS X). They can be set up to execute when a specific user logs in (in the specific user’s directory structure) or when any user logs in (which requires administrator privileges).

管理者によるコメント

T1159は「Launch Agent(ローンチエージェント)」として定義されていた、macOS環境における極めて代表的な自動実行・潜伏手法です。

macOSのサービス管理フレームワークである launchd の仕様を悪用し、ユーザーがOSにログインしたタイミングでマルウェアを自動起動させる手法です。主に「永続化(Persistence)」と「特権昇格(Privilege Escalation)」のために利用されます。

1. 「Launch Agent(ローンチエージェント)」とは?

macOSにおいて、バックグラウンドで動くプログラム(エージェント)をログイン時に自動起動するための正規の仕組みです。 設定は .plist(プロパティリスト) というXML形式のファイルで記述され、特定のフォルダに配置されます。ユーザーがMacにログインすると、OSの根幹である launchd プロセスがこれらの .plist を読み込み、指定されたプログラムを自動的に立ち上げます。

2. 攻撃の流れ

Launch Agentは、基本的には「ログインしたユーザーの権限(一般ユーザー権限)」で動作します。そのため、攻撃者は管理者権限がなくても、侵入初期の段階からこの手法を仕掛けることができます。

  1. マルウェアの配置:
    攻撃者は遠隔操作用ツール(RAT)などのバイナリやスクリプトを、目立たないフォルダ(例: ~/Library/Containers/ など)に隠密に配置します。

  2. 悪意あるPlistの作成と配置:
    ユーザー自身の権限で書き込みが可能な、以下の「ローンチエージェント用フォルダ」に、新しい .plist ファイルを作成して設置します。

    • 配置先: ~/Library/LaunchAgents/ (現在のユーザー用)

.plist の中には、以下のような条件(トリガー)を書き込みます。

* `RunAtLoad`: `true`(ログイン時に自動実行する)
* `ProgramArguments`: (手順1で置いたマルウェアのパスを指定する)
  1. 潜伏と自動実行:
    Macが再起動されたり、ユーザーが一度ログアウトして再ログインした瞬間、launchd がこの設定ファイルを読み込み、バックグラウンドでマルウェアを自動起動させます。

3. 防御・対策

「Plistファイルが置かれるフォルダの常時監視」が最も確実なディフェンスです。

4. 重要ポイント

5. 関連する主なCWE

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

macOSを狙うほぼすべてのマルウェア(標的型スパイ、アドウェア、ランサムウェアなど)が、一等地の永続化ポイントとして真っ先に悪用します。

実務上のアドバイス

Macの動きが重い、または不審な外部通信が発生している疑いがある場合、ターミナルを開いて launchctl list コマンドを実行するか、ls -la ~/Library/LaunchAgents/ を実行して中身を確認してください。正規のベンダー名(com.google...com.microsoft... など)ではない、ランダムな英数字や、アップル公式を装った怪しい名前のファイルがあれば、そのplist内に記載されている「実行ファイル(ProgramArguments)のパス」を最優先で調査する必要があります。

分析

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

関連する CVE

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


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