Trusted Design

T1168 - Local Job Scheduling

概要

On Linux and macOS systems, multiple methods are supported for creating pre-scheduled and periodic background jobs: cron, (Citation: Die.net Linux crontab Man Page) at, (Citation: Die.net Linux at Man Page) and launchd. (Citation: AppleDocs Scheduling Timed Jobs) Unlike Scheduled Task/Job on Windows systems, job scheduling on Linux-based systems cannot be done remotely unless used in conjunction within an established remote session, like secure shell (SSH).

cron

System-wide cron jobs are installed by modifying /etc/crontab file, /etc/cron.d/ directory or other locations supported by the Cron daemon, while per-user cron jobs are installed using crontab with specifically formatted crontab files. (Citation: AppleDocs Scheduling Timed Jobs) This works on macOS and Linux systems.

Those methods allow for commands or scripts to be executed at specific, periodic intervals in the background without user interaction. An adversary may use job scheduling to execute programs at system startup or on a scheduled basis for Persistence, (Citation: Janicab) (Citation: Methods of Mac Malware Persistence) (Citation: Malware Persistence on OS X) (Citation: Avast Linux Trojan Cron Persistence) to conduct Execution as part of Lateral Movement, to gain root privileges, or to run a process under the context of a specific account.

at

The at program is another means on POSIX-based systems, including macOS and Linux, to schedule a program or script job for execution at a later date and/or time, which could also be used for the same purposes.

launchd

Each launchd job is described by a different configuration property list (plist) file similar to Launch Daemon or Launch Agent, except there is an additional key called StartCalendarInterval with a dictionary of time values. (Citation: AppleDocs Scheduling Timed Jobs) This only works on macOS and OS X.

管理者によるコメント

T1168は「Local Job Scheduling(ローカルジョブスケジューリング)」として定義されていた、LinuxおよびmacOS環境における極めて一般的な自動実行・永続化手法です。

LinuxやmacOSに標準搭載されているジョブスケジュール機能(cronat など)を悪用し、特定の時間や一定の間隔(例:毎日深夜2時、または1時間ごと)でマルウェアを自動実行させる手法です。

1. 概要

この手法で攻撃者は、「24時間365日、自分が端末の前にいなくても、システムが勝手にバックドアを起動してC2サーバーへ接続してくれる環境」を構築します。

何を実現できるのか

2. 主な悪用対象

① Cronの悪用

LinuxやmacOSで最も一般的に使われる常駐型の定期実行システムです。

② Atの悪用

cron が「定期的(繰り返し)」に実行するのに対し、at は「指定した未来の時刻に1回だけ」実行するコマンドです。

3. 攻撃の流れ

一般ユーザー権限でもそのユーザー自身のスケジュール(crontab)は書き換えられますが、root権限を奪取した後はより強固な仕込みが行われます。

  1. 侵入:
    脆弱性を突くなどして、Linux/macOSサーバーに侵入します。

  2. スケジュールの改ざん:

    • 一般ユーザー権限:
      crontab -e を裏で実行し、自身のホームディレクトリ内にあるマルウェアを定期実行するよう追記。

    • 管理者権限(root):
      システム全体の共通フォルダである /etc/cron.hourly/(毎時実行)や /etc/cron.daily/(毎日実行)の中に、悪意あるシェルスクリプトを直接設置。

  3. 自動実行と通信の維持:
    攻撃者が接続を切った後も、OSの cron デーモンが設定を忠実に守り、定刻になるとバックグラウンドでマルウェアを起動してC2サーバーへとリバースシェルを繋ぎにいきます。

4. 防御・対策

「設定ファイルの変更監視」と「スケジュール機能の利用制限」が有効です。

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

Linux環境を狙うサイバー犯罪(特に仮想通貨の不正マイニングやDDoSボット)における絶対的な定番手口です。

実務上のアドバイス

Linuxサーバーの調査(フォレンジック)で「プロセスをキルしても、なぜか定期的に復活してくる」という怪奇現象に遭遇した場合、原因の9割はこの T1168 / T1053(主にcron)です。

まずは落ち着いて crontab -l(現在のユーザーの確認)を実行し、さらに管理者権限で ls -la /var/spool/cron/crontabs//etc/cron* を確認して、システム内に埋め込まれた「定期実行のタイマー」を解除することが初動対応の鉄則となります。

分析

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

関連する CVE

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

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


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