【アップデート】AWS Security Hub が検出結果のリージョン集約に対応しました

AWS Security Hubの検出結果を楽ちんリージョン集約
2021.10.21

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

はじめに

AWS Security Hub が 検出結果のリージョン集約 に対応しました。 これで通知設定がとても楽ちんに設定できます。

AWS Security Hub now allows you to designate an aggregation Region and link some or all Regions to that aggregation Region. This gives you a centralized view of all your findings across all of your accounts and all of your linked Regions.

(訳) AWS Security Hubでは 集約リージョンを指定して、 一部またはすべてのリージョンをその集約リージョンにリンクできるようになりました。 これにより、すべてのアカウントとリンクされたすべてのリージョンの すべての調査結果を一元的に見ることができます。

何が嬉しいのか

▼ これが (アプデ前)

img

▼ こうなります (アプデ後)

img

もう少し詳しく

AWS Security Hub はセキュリティイベントを集約するためのサービスです。 主要機能の 1つとして『セキュリティ基準』があります。 AWS環境のセキュリティチェックを行うことが出来ます。

セキュリティ基準の 1つに AWS 基礎セキュリティのベストプラクティス v1.0.0 があります。 この基準はアップデートでどんどんチェックできる項目が増えて、 今では AWS環境の包括的なチェックができるようになっています。 そのため多くのケースにおいて、Security Hub を(できれば全リージョンで) 有効化して このセキュリティ基準を活用していくことが推奨されています。

さて、セキュリティチェック環境自体は簡単に構築できますが、 通知設定 は少々面倒でした。 Security Hub はリージョン単位のサービスなので通知設定もリージョン単位で行う必要があります。 具体的にいうと以下のような設定を各リージョン(Security Hubを有効化しているリージョン)に展開する必要がありました。

  • EventBridgeルール … Security Hub 検出結果のフィルタ設定、ターゲット設定
  • ターゲット設定 … SNSトピックなど

これがアプデ前です。 (追記: もしくは EventBridgeのリージョン間イベント連携を活用して頑張って集約させる)

img

今回のアップデートでできるようになったことは以下です。

  • 集約リージョン を 1つ指定する
  • リンクされたリージョン を複数選択する
    • ※ 全てのリージョン(+ 将来追加されるリージョン) も選択可能
  • 「リンクされたリージョン」の検出結果を 「集約リージョン」で表示・管理可能

これがアプデ後です。明らかに通知設定が楽になりましたね。

img

マルチアカウント環境で Security Hub を利用している場合も同様の恩恵があります。 もともとは 『メンバーアカウントの検出結果を、 管理アカウントの各リージョン上で管理 』でしたが、 今回のアップデートで 『全てのメンバーアカウント・全てのリンクされたリージョンの検出結果を、 管理アカウントの集約リージョン上で管理 』となりました。

1点注意として、今日(2021/10/21)現在 セキュリティ基準の画面のスコアなどは、まだクロスリージョン未対応です。

セキュリティスコア、コントロール、および標準のページはクロスリージョン未対応です。 これらはクロスリージョン対応となる予定です。

https://ap-northeast-1.console.aws.amazon.com/securityhub/home?region=ap-northeast-1#/whats-new

やってみる

集約設定

集約したいリージョン(今回は東京) の Secrity Hub のページに [リージョン] タブがあります。 [検出結果の集約を設定] を選択しましょう。

img

以下のような設定画面がでます。『集約リージョンの 有り/無し』設定と『リンクされたリージョン』設定 を行います。 リンクされたリージョンは 全てのリージョン、および将来のリージョン としました。

img

img

[保存] を選択します。以下のような設定値になればOKです。

img

確認(マネコン)

検出結果一覧を見てみます。 他のリージョンからの結果が集約されていることが早速分かりました。

img

セキュリティ基準のページ自体は 今日(2021/10/21) 現在は集約表示には対応していませんが、 右上に ap-northeast-1 の結果のみ表示している旨が分かる表記がありました。

img

確認(通知設定)

集約リージョン(東京) にて EventBridgeルール/SNSトピック を作成して 検出結果をメール通知するようにしています。

シンガポールリージョン(ap-southeast-1) で SSHフルオープンなセキュリティグループを作ってみると、 数分後に以下のような JSON が飛んできました。

{
  "version": "0",
  "id": "81d313ec-7a79-7a2d-64df-4826d5373fee",
  "detail-type": "Security Hub Findings - Imported",
  "source": "aws.securityhub",
  "account": "123456789012",
  "time": "2021-10-20T22:58:53Z",
  "region": "ap-northeast-1",
  "resources": [
    "arn:aws:securityhub:ap-southeast-1::product/aws/securityhub/arn:aws:securityhub:ap-southeast-1:123456789012:subscription/aws-foundational-security-best-practices/v/1.0.0/EC2.19/finding/5ece71f8-da6c-4ed7-9e31-6f9c01e2bf9c"
  ],
  "detail": {
    "findings": [
      {
        "ProductArn": "arn:aws:securityhub:ap-southeast-1::product/aws/securityhub",
        "Types": [
          "Software and Configuration Checks/Industry and Regulatory Standards/AWS-Foundational-Security-Best-Practices"
        ],
        "Description": "This control checks whether unrestricted incoming traffic for the security groups is accessible to the specified ports [3389, 20, 23, 110, 143, 3306, 8080, 1433, 9200, 9300, 25, 445, 135, 21, 1434, 4333, 5432, 5500, 5601, 22 ] that have the highest risk. This control passes when none of the rules in a security group allow ingress traffic from 0.0.0.0/0 for the listed ports.",
        "Compliance": {
          "Status": "FAILED"
        },
        "ProductName": "Security Hub",
        "FirstObservedAt": "2021-10-20T22:58:39.569Z",
        "CreatedAt": "2021-10-20T22:58:39.569Z",
        "LastObservedAt": "2021-10-20T22:58:46.987Z",
        "CompanyName": "AWS",
        "FindingProviderFields": {
          "Types": [
            "Software and Configuration Checks/Industry and Regulatory Standards/AWS-Foundational-Security-Best-Practices"
          ],
          "Severity": {
            "Normalized": 70,
            "Label": "HIGH",
            "Product": 70,
            "Original": "HIGH"
          }
        },
        "ProductFields": {
          "StandardsArn": "arn:aws:securityhub:::standards/aws-foundational-security-best-practices/v/1.0.0",
          "StandardsSubscriptionArn": "arn:aws:securityhub:ap-southeast-1:123456789012:subscription/aws-foundational-security-best-practices/v/1.0.0",
          "ControlId": "EC2.19",
          "RecommendationUrl": "https://docs.aws.amazon.com/console/securityhub/EC2.19/remediation",
          "RelatedAWSResources:0/name": "securityhub-vpc-sg-restricted-common-ports-18560cc4",
          "RelatedAWSResources:0/type": "AWS::Config::ConfigRule",
          "StandardsControlArn": "arn:aws:securityhub:ap-southeast-1:123456789012:control/aws-foundational-security-best-practices/v/1.0.0/EC2.19",
          "aws/securityhub/ProductName": "Security Hub",
          "aws/securityhub/CompanyName": "AWS",
          "aws/securityhub/annotation": "Security group allows a port that is blocked.",
          "Resources:0/Id": "arn:aws:ec2:ap-southeast-1:123456789012:security-group/sg-example",
          "aws/securityhub/FindingId": "arn:aws:securityhub:ap-southeast-1::product/aws/securityhub/arn:aws:securityhub:ap-southeast-1:123456789012:subscription/aws-foundational-security-best-practices/v/1.0.0/EC2.19/finding/5ece71f8-da6c-4ed7-9e31-6f9c01e2bf9c"
        },
        "Remediation": {
          "Recommendation": {
            "Text": "For directions on how to fix this issue, consult the AWS Security Hub Foundational Security Best Practices documentation.",
            "Url": "https://docs.aws.amazon.com/console/securityhub/EC2.19/remediation"
          }
        },
        "SchemaVersion": "2018-10-08",
        "GeneratorId": "aws-foundational-security-best-practices/v/1.0.0/EC2.19",
        "RecordState": "ACTIVE",
        "Title": "EC2.19 Security groups should not allow unrestricted access to ports with high risk",
        "Workflow": {
          "Status": "NEW"
        },
        "Severity": {
          "Normalized": 70,
          "Label": "HIGH",
          "Product": 70,
          "Original": "HIGH"
        },
        "UpdatedAt": "2021-10-20T22:58:39.569Z",
        "WorkflowState": "NEW",
        "AwsAccountId": "123456789012",
        "Region": "ap-southeast-1",
        "Id": "arn:aws:securityhub:ap-southeast-1:123456789012:subscription/aws-foundational-security-best-practices/v/1.0.0/EC2.19/finding/5ece71f8-da6c-4ed7-9e31-6f9c01e2bf9c",
        "Resources": [
          {
            "Partition": "aws",
            "Type": "AwsEc2SecurityGroup",
            "Details": {
              "AwsEc2SecurityGroup": {
                "GroupName": "ssh-open",
                "OwnerId": "123456789012",
                "VpcId": "vpc-example",
                "IpPermissions": [
                  {
                    "FromPort": 22,
                    "ToPort": 22,
                    "IpProtocol": "tcp",
                    "IpRanges": [
                      {
                        "CidrIp": "0.0.0.0/0"
                      }
                    ]
                  }
                ],
                "IpPermissionsEgress": [
                  {
                    "IpProtocol": "-1",
                    "IpRanges": [
                      {
                        "CidrIp": "0.0.0.0/0"
                      }
                    ]
                  }
                ],
                "GroupId": "sg-example"
              }
            },
            "Region": "ap-southeast-1",
            "Id": "arn:aws:ec2:ap-southeast-1:123456789012:security-group/sg-example"
          }
        ]
      }
    ]
  }
}

※1: 注意点としてリージョンを取得する際は .region ではなくて .detail.findings[0].Region を参照するようにしましょう。(検出結果は集約リージョンへレプリケートされる仕様)

※2: 具体的な Security Hub の通知設定/フィルタリングは以下ブログ参照ください

今すぐ設定して管理を楽ちんに

Security Hub の嬉しいアップデート紹介でした。 これで検出結果管理や通知設定が楽ちんになりますね。

参考

AWS Security Hub adds support for cross-Region aggregation of findings to simplify how you evaluate and improve your AWS security posture

Security Hub 周りの役立ち情報