GuardDutyがlog4j脆弱性を利用した攻撃の検出をサポートしました

Log4J2 脆弱性を狙う攻撃の検出をサポートしたGuardDuty、当ブログサイトの攻撃に利用されていたLDAPサーバ宛の通信を再現して試してみました。
2021.12.30

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

AWSチームのすずきです。

Amazon GuardDuty が 2021年12月21日のアップデートで log4j2 の脆弱性 (CVE-2021-44228, CVE-2021-45046) を利用した攻撃の検出をサポートしました。

その動作について確認する機会がありましたので紹介させて頂きます。

Change Description Date
Updated the finding types to help identify issues related to log4j Amazon GuardDuty has updated the following finding types to help identify and prioritize issues related to CVE-2021-44228 and CVE-2021-45046: Backdoor:EC2/C&CActivity.B; Backdoor:EC2/C&CActivity.B!DNS; Behavior:EC2/NetworkPortUnusual. 22-Dec-21

環境

AWSアカウント

AWSより連絡を受ける可能性に備え、個人で直契約のアカウントを用意しました。

リージョン

東京リージョンを利用しました。

GuardDuty

30日の無料期間を利用して GuardDuty を有効化しました。

EC2

デフォルトVPC に EC2インスタンス(OS: Amazon Linux2)を起動。

当ブログサイトへの Log4J 脆弱性を狙う攻撃に利用されていたLDAPサーバの 名前解決とポート疎通を試みました。

コマンド抜粋

  • dig コマンドで名前解決を試みました。
  • nc (netcat)をインストール、ポート疎通を試みました。
$ sudo yum -y install nc
$ dig +short ##.y.##.com
#.#.#.150
$ nc -zv ##.y.##.com 1389
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connection refused.

結果

GuardDuty の「結果」として、検証に利用した EC2インスタンス から Log4J2 脆弱性を狙う攻撃に利用されていたLDAPサーバへの通信が検出できました。

Backdoor:EC2/C&CActivity.B

An EC2 instance is querying an IP that is associated with a known command and control server.

sh-4.2$ nc -zv #.#.#.185 1389
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to #.#.#.185:1389.
Ncat: 0 bytes sent, 0 bytes received in 0.12 seconds.

Backdoor:EC2/C&CActivity.B!DNS

An EC2 instance is querying a domain name that is associated with a known command and control server.

sh-4.2$ dig +short ##.y.##.com
#.#.#.150
sh-4.2$ nc -zv ##.y.##.com 1389
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connection refused.

まとめ

GuardDuty を利用する事で、Log4J2 脆弱性を利用した攻撃の被害を早期検出できる可能性があります。

Log4J 脆弱性(Log4Shell) の影響を受ける可能性がある場合、GuardDuty を設定して高い重要度の通知を受け取る体制を取ることをおすすめします。