Adversaries may use Event Monitor Daemon (emond) to establish persistence by scheduling malicious commands to run on predictable event triggers. Emond is a Launch Daemon that accepts events from various services, runs them through a simple rules engine, and takes action. The emond binary at /sbin/emond will load any rules from the /etc/emond.d/rules/ directory and take action once an explicitly defined event takes place. The rule files are in the plist format and define the name, event type, and action to take. Some examples of event types include system startup and user authentication. Examples of actions are to run a system command or send an email. The emond service will not launch if there is no file present in the QueueDirectories path /private/var/db/emondClients, specified in the Launch Daemon configuration file at/System/Library/LaunchDaemons/com.apple.emond.plist.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019)
Adversaries may abuse this service by writing a rule to execute commands when a defined event occurs, such as system start up or user authentication.(Citation: xorrior emond Jan 2018)(Citation: magnusviri emond Apr 2016)(Citation: sentinelone macos persist Jun 2019) Adversaries may also be able to escalate privileges from administrator to root as the emond service is executed with root privileges by the Launch Daemon service.
T1519はmacOS環境におけるイベントモニターデーモンを悪用したテクニックである「Emond」です。
macOSに標準で備わっている(隠れた)イベントログ監視・処理エンジンである「emond(Event Monitor Daemon)」のルールファイルを改ざん・新規作成し、特定のイベント(システムの起動やユーザー認証など)が発生した瞬間に、悪意あるコマンドを最高権限(root)で自動実行させる手法です。
この手法で攻撃者は、「macOSの標準的な永続化チェックツール(Launchdの監視など)の目を盗みつつ、システムが起動した瞬間に自動的に最高権限(root)のバックドアを発動させること」を実現します。
強力な防御回避(ステルス性): macOSの永続化といえば LaunchAgents や LaunchDaemons(plistファイル)を設置するのが定番ですが、セキュリティソフトや管理者はここを真っ先に監視します。一方、「Emond」は普段ほぼ使われていないマイナーなデーモンであるため、監視の死角になりやすいという特徴があります。
特権昇格(Administrator から root へ): Emondサービス自体は、システム起動時に root 権限で動作するLaunch Daemon(com.apple.emond.plist)として設計されています。そのため、管理者が悪意あるルールを仕込むだけで、トリガー発動時に自動的に root権限(システム最高権限) でプログラムを実行させることができます。
Emondは /etc/emond.d/rules/ にあるXML(plist形式)のルールファイルを読み込んで動作します。攻撃者はここに罠を仕掛けます。
初期侵入と管理者権限の確保: 攻撃者はmacOS端末に侵入し、ルールファイルが置かれるシステム領域に書き込みを行うため、事前に管理者権限(sudo権限など)を確保します。
Emond起動用のダミーファイル作成:
モダンなmacOSでは、特定のディレクトリ(/private/var/db/emondClients)が空の場合、電力を節約するためにEmondサービス自体が起動しない仕様になっています。攻撃者はまず、このフォルダにダミーのファイルを1つ作成し、次回起動時にEmondが必ず立ち上がるように「呼び水」を仕込みます。
悪意あるルール(plist)の作成:
/etc/emond.d/rules/ ディレクトリ配下に、新しいルールファイル(例: malicious.plist)を作成します。
自動実行と特権昇格の発動(トリガー):
端末が再起動されるか、ユーザーがログイン(認証)した瞬間に、OS裏側で sbin/emond が起動します。Emondは仕込まれたルールを読み込み、条件に合致したため、内部に書かれていた攻撃者のコマンドを root権限 で自動実行します。
Emond関連の特定のディレクトリおよびプロセスの動きを注視することが重要です。
特定ディレクトリの整合性監視(最重要):
EDRやファイル監視システムを用いて、以下の2つのパスに対する不審なファイル作成・変更を厳重に監視します。一般的なmacOSの運用やアプリのインストールで、ここにファイルが追加されることは通常ありません。
/etc/emond.d/rules/(ルールファイル)/private/var/db/emondClients(起動用トリガーフォルダ)プロセスの親子関係と実行権限の監視:
/sbin/emond プロセスを親プロセスとして、そこから不審なシェル(sh, bash, zsh)や、一時フォルダ(/tmp/)から見覚えのないバイナリが実行されていないかを監視します。
Emond機能自体の無効化:
もし組織内でEmondを一切使用していない(多くの企業環境が該当します)のであれば、構成定義ファイル(/System/Library/LaunchDaemons/com.apple.emond.plist)を削除または無効化し、サービス自体が絶対に起動しないようにしてしまうことが最も安全な緩和策です。
Emondの悪用は、macOSの「正規のイベント駆動機能」の仕様を逆手に取ったものであるため、EmondそのものにCVE番号が割り当てられた脆弱性があるわけではありません。
しかし、攻撃者がルールを書き換えるための「管理者権限」を手に入れるため、あるいはAppleが施しているシステム保護機能(SIP: System Integrity Protection)をすり抜けるために、以下のようなmacOSの脆弱性と組み合わせて悪用されることがあります。