1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Falco Ruleを紹介するシリーズ - Create Disallowed Pod

Posted at

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

Rule記述

- rule: Create Disallowed Pod
  desc: >
    Detect an attempt to start a pod with a container image outside of a list of allowed images.
  condition: kevt and pod and kcreate and not allowed_k8s_containers
  output: Pod started with container not in allowed list (user=%ka.user.name pod=%ka.resp.name ns=%ka.target.namespace images=%ka.req.pod.containers.image)
  priority: WARNING
  source: k8s_audit
  tags: [k8s]

Rule概要

Kubernetes Audit Events Pluginプラグインをインストールすることで使用可能になるルールです。
あらかじめ指定した、許可されたイメージ一覧以外のイメージからのPod起動の試みを検知します。
コンテナの雛形になるイメージは、Docker Hubなどのパブリックなコンテナレジストリから入手可能ですが、 Docker Hub にあるイメージの半分には、少なくとも 1 つのセキュリティ脆弱性が含まれています。また、攻撃者が意図的に悪意のあるイメージをアップロードし、疑うことを知らないユーザーを引きつけるような名前(mysqlimageやnginxappなど)にしている場合もあります。
このため、信頼できるイメージのみを使用することがとても重要になります。
悪意のあるイメージを使用した攻撃の例として、こちらのブログ記事もご参照ください。

Condition(条件)

kevt and pod and kcreate and
Pod作成のK8s Auditイベントで、

not allowed_k8s_containers
許可されたK8sコンテナ一覧に含まれていない場合


podマクロの内容は以下となります。

- macro: pod
  condition: ka.target.resource=pods and not ka.target.subresource exists

ka.target.resource=pods and
K8sのターゲットリソースがpodsで、

not ka.target.subresource exists
ターゲットオブジェクトのサブリソースが存在しない場合

Output(出力)

許可されたコンテナリストに含まれていないコンテナによってPodが起動しました

%ka.user.name
K8sユーザー名

%ka.resp.name
K8sレスポンスオブジェクト名

%ka.target.namespace
K8sターゲットネームスペース名

%ka.req.pod.containers.image
コンテナイメージ名

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?