LoginSignup
1
0

Falco Ruleを紹介するシリーズ - Launch Sensitive Mount Container

Posted at

本シリーズでは、ランタイム脅威検知のデファクトスタンダードであるFalcoの検知Ruleを、1つの記事で1つ簡単に紹介していきます。
ランタイムセキュリティやFalco自体の概要を知りたい方はこちらのブログ記事をご参照ください。
今回ご紹介する検知Ruleは「Launch Sensitive Mount Container」です。

Rule記述

- rule: Launch Sensitive Mount Container
  desc: >
    Detect the initial process started by a container that has a mount from a sensitive host directory
    (i.e. /proc). Exceptions are made for known trusted images.
  condition: >
    container_started and container
    and sensitive_mount
    and not falco_sensitive_mount_containers
    and not user_sensitive_mount_containers
  output: Container with sensitive mount started (user=%user.name command=%proc.cmdline %container.info image=%container.image.repository:%container.image.tag mounts=%container.mounts)
  priority: INFO
  tags: [container, cis, mitre_lateral_movement]

Rule概要

コンテナ内で、ホストの要注意ディレクトリをマウントする初期プロセスが起動したことを検知します。
例として、ホストの/etcディレクトリをコンテナにマウントし、crontabを編集して悪意あるbashスクリプトの定期的なダウンロードと実行を試みることで、コンテナレベルアクセスからホストレベルアクセスを実現しようとする攻撃などが観測されています。詳細はこちらのブログ記事をご参照ください。
このようなコンテナからホストへのエスケープにつながる振る舞いも、このRuleを使うことで検知可能です。

Condition(条件)

container_started and container
コンテナが起動し、

and sensitive_mount
ホストの要注意ディレクトリをマウントし、

かつ

and not falco_sensitive_mount_containers
Falcoがあらかじめ定義したマウントではなく、

and not user_sensitive_mount_containers
ユーザーがあらかじめ定義したマウントでもない場合


sensitive_mountの対象ディレクトリはマクロとして以下のように定義されています。

- macro: sensitive_mount
  condition: (container.mount.dest[/proc*] != "N/A" or
              container.mount.dest[/var/run/docker.sock] != "N/A" or
              container.mount.dest[/var/run/crio/crio.sock] != "N/A" or
              container.mount.dest[/var/lib/kubelet] != "N/A" or
              container.mount.dest[/var/lib/kubelet/pki] != "N/A" or
              container.mount.dest[/] != "N/A" or
              container.mount.dest[/home/admin] != "N/A" or
              container.mount.dest[/etc] != "N/A" or
              container.mount.dest[/etc/kubernetes] != "N/A" or
              container.mount.dest[/etc/kubernetes/manifests] != "N/A" or
              container.mount.dest[/root*] != "N/A")

container.mount.dest[] != "N/A"
マウント対象ディレクトリが"N/A"ではない場合

Output(出力)

要注意ディレクトリをマウントしたコンテナが起動しました。

%user.name
ユーザー名

%proc.cmdline
コマンドライン

%container.info
コンテナ情報

%container.image.repository
コンテナイメージリポジトリ

%container.image.tag
コンテナイメージタグ

%container.mounts
コンテナマウント

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0