LoginSignup
2
2

Sysdig Serverless Agentで保護しているAWS Fargateに対する脅威検知テスト

Last updated at Posted at 2023-07-27

Sysdig Serverless Agentで保護しているAWS Fargateに対する脅威検知テストとして、下記Security Playgroundイメージから作成したFargateタスクを使用する方法をご紹介します。

Security Playgroundでは、外部からcurlコマンドを介してコンテナ上で任意のコマンド実行が可能です。これをリモートコード実行の脆弱性を有するアプリケーションを模擬した被害者コンテナとして使用します。

SysdigのFargateランタイムセキュリティに関して詳しく知りたい方は、当社が7/28に実施したウェビナーの録画もご参照ください。

環境のデプロイ

Terraformで以下をデプロイします。
● Sysidig Orchastrator Agent
● Security Playground(擬似アタック被害コンテナ) + Sysdig Workload Agent

Security Playgroundを使ったサンプルのTerraformファイルは以下になります。

必ずTerraformファイルの記述をよく確認し、ご自身の環境で使用しても問題ないことをご確認ください。Sysdig Serverless Agentのドキュメントは下記になります。
https://docs.sysdig.com/en/docs/installation/sysdig-secure/install-agent-components/ecs-on-fargate/

上記Terraformファイルを使用すると、以下のような構成でデプロイされます(Internet gatewayおよびNAT gatewayは含みません)。デプロイ先のサブネットは変数設定で指定可能です。
image.png

変数の設定

Terraformファイルのvariables.tfの値を、ご自身の環境に合わせて修正してください。

variables.tf
# AWS Region
variable "region" {
  default = "ap-northeast-1"
}

variable "vpc_id" {
  default = "vpc-xxxxxxxxxxxx"
}

variable "subnet_a_id" {
  default = "subnet-xxxxxxxxxxxx"
}

variable "subnet_b_id" {
  default = "subnet-xxxxxxxxxxxx"
}

# タスクにPublic IPをアサインするか否か。Private Subnetにデプロイする場合はfalseに設定してください
variable "public_ip" {
  default = "true"
}

# Sysdig Access key
variable "access_key" {
  default = ""
}

# Sysdig Secure API Token
variable "secure_api_token" {
  default = ""
}

# ご自身のSysdig SaaSリージョンの値を入力してください(下記はus4の場合)
variable "collector_url" {
  default = "ingest.us4.sysdig.com"
}

# ご自身のSysdig SaaSリージョンの値を入力してください(下記はus4の場合)
variable "sysdig_secure_url" {
  default = "https://app.us4.sysdig.com"
}

# タスク名などの前につけるプレフィックス
variable "prefix" {
  default = "test"
}

# Curlコマンドを打って疑似アタックを実行する端末のIPアドレスを入力してください
# このIPアドレスからWorkloadタスクに対する8080ポート接続を許可するSecurity Group設定を作成します
variable "source_ip" {
  default = "192.168.0.100/32"
}

collector_urlsysdig_secure_urlの値はご利用のSysdig SaaSリージョンにより異なります。下記ドキュメントをご参照ください。
https://docs.sysdig.com/en/docs/administration/saas-regions-and-ip-ranges/

デプロイ実施

terraform init & terraform apply

デプロイが完了すると、Orchestrator AgentをSysdig UI上で確認できます。
Integrations > Data Sources > Sysdig Agents に移動します。
Deployment Type が fargate のSysdig Agentが接続されていることを確認します。
image.png

脅威検知テスト

脅威検知では、以下のような経路でSysdig UIに検知イベント結果が表示されます。
image.png

下記curlコマンドの引数にFargate workload taskのPublicもしくはPrivate IPアドレスを指定します。

攻撃例1:shadowファイルの読み込み

curl <Workload_Task_IP>:8080/etc/shadow

※FalcoルールでException指定されているcat /etc/shadowではないので検知します

攻撃例2:/dev配下へのファイル書き込み

curl -X POST <Workload_Task_IP>:8080/exec -d 'command=touch /dev/bbb'

名称未設定.png

Sysdig UIにログインし、Eventsに検知イベントが表示されていることを確認します。
図1.png

まとめ

Security Playgroundイメージを使用することで、Sysdig Serverless Agentで保護しているAWS Fargateに対する脅威検知テストを、簡単に実施できることが確認できました。

2
2
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
2
2