Security Hub 自動修復ソリューションの修復内容をまとめてみた(v1.5.0)

2022.07.07

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

みなさんこんにちは、杉金です。
AWS Security Hubの自動修復ソリューションの修復内容をまとめてみました。
プレイブック一覧としては以下の実装ガイドに記載されているのですが、概要のみの記述です。SSMドキュメントを参考にして、もう少し具体的な設定内容や作成されるリソースについてコメントしていきます。

前提条件、注意事項

今後のソリューションアップデートやSSMドキュメントのバージョンアップによって内容が変わる可能性があります。あくまで参考程度にご覧いただき、最新の状態は実際のSSMドキュメントからご確認下さい。

  • 自動修復ソリューションのバージョン:1.5.0
  • 各SSMドキュメントのバージョン:1.0.0

SSMドキュメントの確認方法

AWSマネジメントコンソール→AWS Systems Manager→ドキュメントから確認します。自動修復ソリューション用のドキュメントは「自己所有」タブから確認できます。

修復用SSMドキュメント

以降で各SSMドキュメントについてコメントしていきます

  • SSMドキュメント名:SHARR-で始まる名前
  • ドキュメントの概要:プレイブック一覧に記載の概要
  • 修復内容のコメント:対象SSMドキュメントの内容をもとにした私のコメント

SHARR-EnableAutoScalingGroupELBHealthCheck

ドキュメントの概要

Auto Scaling groups associated with a load balancer should use load balancer health checks

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

UpdateAutoScalingGroup APIを使って、対象のAutoScalingグループのELBヘルスチェックを有効にする。

参考情報

SHARR-CreateCloudTrailMultiRegionTrail

ドキュメントの概要

CloudTrail should be activated and configured with at least one multi-Region trail

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

マルチリージョン証跡が有効なCloudTrailを作成する。(新規に証跡が作成されます)

  • CLoudTrail証跡名:multi-region-cloud-trail
    • マルチリージョンの証跡:true
    • ログファイルの検証:true
    • グローバルサービスイベントのログ記録:true
  • S3バケット名:so0111-aws-cloudtrail-[AWSアカウントID]
  • S3バケット名(アクセスログ用):so0111-access-logs-[リージョン名]-[AWSアカウントID]
  • CMKのエイリアスはSSMパラメータストアの値:/Solutions/SO0111/CMK_REMEDIATION_ARN

参考情報

SHARR-EnableCloudTrailEncryption

ドキュメントの概要

CloudTrail should have encryption at rest activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CloudTrailの暗号化を有効にする。
CMKのエイリアスはSSMパラメータストアの値:/Solutions/SO0111/CMK_REMEDIATION_ARN

SHARR-EnableCloudTrailLogFileValidation

ドキュメントの概要

Ensure CloudTrail log file validation is activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

UpdateTrail APIを使って、CloudTrail証跡のログファイル検証を有効にする。

SHARR-EnableCloudTrailToCloudWatchLogging

ドキュメントの概要

Ensure CloudTrail trails are integrated with Amazon CloudWatch Logs

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CloudTrail用のCloudWatchロググループを作成する。
ロググループ名:CloudTrail/[対象のCloudTrail証跡名]

SHARR-ReplaceCodeBuildClearTextCredentials

ドキュメントの概要

CodeBuild project environment variables should not contain clear text credentials

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CodeBuildプロジェクトのクリアテキストの資格情報を含む環境変数をSSMパラメータストアに格納する。
SSMパラメータストア格納先:/CodeBuild/[CoudBulidのプロジェクト名]/env/[環境変数名]

SHARR-EnableAWSConfig

ドキュメントの概要

Ensure AWS Config is activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

AWS Configを有効にする。

  • 記録するリソースタイプ
    • このリージョンでサポートされているすべてのリソースを記録します
    • グローバルリソース (AWS IAM リソースなど) を含める
  • CMKのエイリアスはSSMパラメータストアの値:/Solutions/SO0111/CMK_REMEDIATION_ARN
  • S3バケット名:so0111-aws-config-[リージョン名]-[AWSアカウントID]
  • S3バケット名(アクセスログ用):so0111-accesslogs-[AWSアカウントID]-[リージョン名]
  • SNSトピック名:SO0111-SHARR-AWSConfigNotification
  • デフォルトのサービスリンクロール名:aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig

SHARR-MakeEBSSnapshotsPrivate

ドキュメントの概要

Amazon EBS snapshots should not be publicly restorable

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

該当AWSアカウントのPublicなEBSスナップショットに対してModifySnapshotAttribute APIでGroup:allの許可を削除する。

SHARR-RemoveVPCDefaultSecurityGroupRules

ドキュメントの概要

VPC default security group should prohibit inbound and outbound traffic

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

VPCのデフォルトセキュリティグループから、すべてのインバウンドルールおよびアウトバウンドルールを削除する。

SHARR-EnableVPCFlowLogs

ドキュメントの概要

VPC flow logging should be enabled in all VPCs

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

VPCフローログを作成する。ログ出力先としてCloudWatch logsを設定する。

  • フローログ名:VPCFlowLogs/[対象のVPC ID]
    • ResourceType:VPC
    • TrafficType:REJECT
  • ロググループ名:VPCFlowLogs/[対象のVPC ID]
  • CMKのエイリアスはSSMパラメータストアの値:/Solutions/SO0111/CMK_REMEDIATION_ARN

SHARR-EnableEbsEncryptionByDefault

ドキュメントの概要

EBS default encryption should be activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

EnableEbsEncryptionByDefault APIを使って、対象リージョンのEBSデフォルト暗号化を有効にする。

SHARR-RevokeUnrotatedKeys

ドキュメントの概要

IAM users' access keys should be rotated every 90 days or less

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

(使いどころは非常に要注意!!)

UpdateAccessKey APIを使って、90日以上ローテートされていないアクティブなIAMアクセスキーを無効にする。

SHARR-SetIAMPasswordPolicy

ドキュメントの概要

IAM default password policy

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

以下のパスワードポリシーを設定する。(AFSBP、CIS、PCIDSS共通)

  • AllowUsersToChangePassword: true
  • HardExpiry: true
  • MaxPasswordAge: 90
  • MinimumPasswordLength: 14
  • RequireSymbols: true
  • RequireNumbers: true
  • RequireUppercaseCharacters: true
  • RequireLowercaseCharacters: true
  • PasswordReusePrevention: 24

SHARR-RevokeUnusedIAMUserCredentials

ドキュメントの概要

IAM user credentials should be turned off if not used within a pre-defined number of days

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

90日以上使用されていないIAMパスワードとアクティブなアクセスキーを失効させる。
UpdateAccessKey APIを使用して対象のアクセスキーを無効化し、DeleteLoginProfile APIを使用して対象のIAMユーザーのパスワードを削除する。

SHARR-RemoveLambdaPublicAccess

ドキュメントの概要

Lambda functions should prohibit public access

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

対象Lambdaのリソースベースのポリシーから、Principalで "*"{"AWS": "*"} を指定しているポリシーステートメントを削除する

SHARR-MakeRDSSnapshotPrivate

ドキュメントの概要

RDS snapshots should prohibit public access

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

ModifyDBSnapshotAttribute API or ModifyDBClusterSnapshotAttribute API を使ってrestore属性の値からallを削除

SHARR-DisablePublicAccessToRDSInstance

ドキュメントの概要

RDS DB Instances should prohibit public access

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

  • ModifyDBInstance APIでPubliclyAccessiblefalseに設定する
  • Apply Immediately :指定なし(デフォルト次回メンテ時)
  • 対象RDSインスタンスの状態が起動中でないと設定変更できずに処理に失敗する

SHARR-EncryptRDSSnapshot

ドキュメントの概要

RDS cluster snapshots and database snapshots should be encrypted at rest

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

  • 元のスナップショット名に「-encrypted」をつけた形で暗号化済みスナップショットを作成する。元の暗号化されていないスナップショットは削除される。
  • デフォルトのKMSエイリアス:aws/rds

SHARR-EnableMultiAZOnRDSInstance

ドキュメントの概要

RDS DB instances should be configured with multiple Availability Zones

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

  • ModifyDBInstance APIでMultiAZtrueに設定する
  • Apply Immediately:false
  • 対象RDSインスタンスの状態が起動中でないと設定変更できずに処理に失敗する

SHARR-EnableEnhancedMonitoringOnRDSInstance

ドキュメントの概要

Enhanced monitoring should be configured for RDS DB instances and clusters

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

  • ModifyDBInstance APIでメトリクス収集間隔(詳細度)を60秒に設定する
  • 対象RDSインスタンスの状態が起動中でないと設定変更できずに処理に失敗する
  • (ちなみに)ModifyDBInstance APIで0以外を設定すると拡張モニタリングが有効になる。 設定可能な値は(0、1、5、10、15、30、60)

SHARR-EnableRDSClusterDeletionProtection

ドキュメントの概要

RDS clusters should have deletion protection activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

  • ModifyDBCluster APIでDeletionProtectiontrueに設定する
  • Apply Immediately:指定なし(デフォルト次回メンテ時)
  • 対象RDSクラスターの状態が起動中でないと設定変更できずに処理に失敗する。

SHARR-EnableRDSInstanceDeletionProtection

ドキュメントの概要

RDS DB instances should have deletion protection activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

  • ModifyDBInstance API でDeletionProtectiontrueに設定する
  • Apply Immediately:false

SHARR-EnableMinorVersionUpgradeOnRDSDBInstance

ドキュメントの概要

RDS automatic minor version upgrades should be activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

  • ModifyDBInstance APIでAutoMinorVersionUpgradetrueに設定する。
  • Apply Immediately:指定なし(デフォルト次回メンテ時)
  • 対象RDSインスタンスの状態が起動中でないと設定変更できずに処理に失敗する

SHARR-EnableCopyTagsToSnapshotOnRDSCluster

ドキュメントの概要

RDS DB clusters should be configured to copy tags to snapshots

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

  • ModifyDBCluster APIでCopyTagsToSnapshottrueに設定する
  • 対象RDSクラスターの状態が起動中でないと設定変更できずに処理に失敗する。

SHARR-DisablePublicAccessToRedshiftCluster

ドキュメントの概要

Amazon Redshift clusters should prohibit public access

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

  • ModifyCluster APIでPubliclyAccessiblefalseに設定する

SHARR-EnableAutomaticSnapshotsOnRedshiftCluster

ドキュメントの概要

Amazon Redshift clusters should have automatic snapshots activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

  • ModifyCluster APIでAutomatedSnapshotRetentionPeriodを設定する
  • 保存期間:7日間

SHARR-EnableRedshiftClusterAuditLogging

ドキュメントの概要

Amazon Redshift clusters should have audit logging activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

Redshiftデータベース監査ログを作成する。

  • 自動修復ソリューションインストール時に指定したバケット名が使用される。(以下のSSMパラメータの値からバケット名を取得している)

/Solutions/SO0111/afsbp/1.0.0/REDSHIFT.4/S3BucketNameForAuditLogging

SHARR-EnableAutomaticVersionUpgradeOnRedshiftCluster

ドキュメントの概要

Amazon Redshift should have automatic upgrades to major versions activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

ModifyCluster APIでAllowVersionUpgradetrueに設定する。

SHARR-ConfigureS3PublicAccessBlock

ドキュメントの概要

S3 Block Public Access setting should be activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

対象AWSアカウントのS3ブロックパブリックアクセスを設定する。

  • RestrictPublicBuckets:true
  • BlockPublicAcls:true
  • IgnorePublicAcls:true
  • BlockPublicPolicy:true

SHARR-ConfigureS3BucketPublicAccessBlock

ドキュメントの概要

S3 buckets should prohibit public read access

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

対象S3バケットのS3ブロックパブリックアクセスを設定する。

  • RestrictPublicBuckets:true
  • BlockPublicAcls:true
  • IgnorePublicAcls:true
  • BlockPublicPolicy:true

SHARR-EnableDefaultEncryptionS3

ドキュメントの概要

S3 buckets should have server-side encryption activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

対象S3バケットのデフォルト暗号化を有効にする。

  • サーバー側の暗号化
  • 暗号化キータイプ:Amazon S3 マネージドキー (SSE-S3)

SHARR-SetSSLBucketPolicy

ドキュメントの概要

S3 buckets should require requests to use SSL

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

対象のS3バケットでHTTPS通信のみ許可させる。以下のバケットポリシーが追加される。
(バケットポリシーが空の場合は新規追加、既存ポリシーが存在する場合は追記)

{
    "Sid": "AllowSSLRequestsOnly",
    "Action": "s3:*",
    "Effect": "Deny",
    "Resource": [
        'arn:aws:s3:::{bucket_name}',
        'arn:aws:s3:::{bucket_name}/*'
    ],
    "Condition": {
        "Bool": {
            "aws:SecureTransport": "false"
        }
    },
    "Principal": "*"
}

SHARR-S3BlockDenylist

ドキュメントの概要

Amazon S3 permissions granted to other AWS accounts in bucket policies should be restricted

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

特定のセンシティブなAPIコールへのクロスアカウントアクセスを防ぐために、バケットポリシーに明示的なDENYを追加する。

対象のAPIコール

  • s3:DeleteBucketPolicy
  • s3:PutBucketAcl
  • s3:PutBucketPolicy
  • s3:PutEncryptionConfiguration
  • s3:PutObjectAcl

バケットポリシーにどのように反映されるか

例えば以下のようなクロスアカウントの通信を許可するバケットポリシーを設定します。

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Statement1",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::123456789012:root"
            },
            "Action": [
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Resource": "arn:aws:s3:::{bucket_name}/*",
            "Condition": {
                "StringEquals": {
                    "s3:x-amz-acl": "public-read"
                }
            }
        },
        {
            "Sid": "Statement2",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::123456789012:root"
            },
            "Action": "s3:DeleteBucketPolicy",
            "Resource": "arn:aws:s3:::{bucket_name}"
        }
    ]
}

修復実行後、ポリシーは以下のように更新され、DENYステートメントが追加されます。

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Statement1",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::123456789012:root"
            },
            "Action": [
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Resource": "arn:aws:s3:::{bucket_name}/*",
            "Condition": {
                "StringEquals": {
                    "s3:x-amz-acl": "public-read"
                }
            }
        },
        {
            "Sid": "Statement2",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::123456789012:root"
            },
            "Action": "s3:DeleteBucketPolicy",
            "Resource": "arn:aws:s3:::{bucket_name}"
        },
        {
            "Effect": "Deny",
            "Principal": {
                "AWS": "arn:aws:iam::123456789012:root"
            },
            "Action": [
                "s3:DeleteBucketPolicy",
                "s3:PutBucketAcl",
                "s3:PutBucketPolicy",
                "s3:PutObjectAcl",
                "s3:PutEncryptionConfiguration"
            ],
            "Resource": [
                "arn:aws:s3:::{bucket_name}",
                "arn:aws:s3:::{bucket_name}/*"
            ]
        }
    ]
}

明示的な許可より明示的な拒否の方が優先されるため、該当APIコールに対するアクセスは拒否されます。

参考情報

IAMポリシーの評価論理は以下のページが参考になります。

やんわり押さえるには、こちらの記事が参考になります。

SHARR-ConfigureS3BucketPublicAccessBlock

ドキュメントの概要

Ensure the S3 bucket CloudTrail logs to is not publicly accessible

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CloudTrail用S3バケットに対してサーバーアクセスのログ記録を有効にする。

  • サーバーアクセスログ記録用S3バケット名:so0111-cloudtrailaccesslogs-[AWSアカウントID]-[リージョン名]
  • デフォルト暗号化:有効

SHARR-EnableKeyRotation

ドキュメントの概要

Ensure rotation for customer-created CMKs is activated

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

EnableKeyRotation APIを使って、KMS対称キーのキーマテリアルの自動ローテーションを有効にする。

参考情報

SHARR-CreateLogMetricFilterAndAlarm

特定のAPIコールに対するロググループのメトリクスフィルターを作成し、メトリクスに対するアラームを設定する。 3.1〜3.14までこのSSMドキュメントを共通利用している。

共通の設定

  • ロググループ名はSSMパラメータストアの値:/Solutions/SO0111/Metrics_LogGroupName
    (aws-security-hub-automated-response-and-remediation)
  • SNSトピック名:SO0111-SHARR-LocalAlarmNotification
  • CMKのエイリアスはSSMパラメータストアの値:/Solutions/SO0111/CMK_REMEDIATION_ARN

ドキュメント概要

CIS3.1

Ensure a log metric filter and alarm exist for unauthorized API calls

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CIS3.1

認証されていないAPIコールを検知する。以下のリソース名で作成。

  • ログフィルター名:UnauthorizedAPICalls
  • メトリクス名:UnauthorizedAPICalls
  • アラーム名:UnauthorizedAPICalls

ドキュメントの概要

CIS3.2

Ensure a log metric filter and alarm exist for AWS Management Console sign-in without MFA

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CIS3.2

MFAなしのAWSマネジメントコンソールログインを検知する。以下のリソース名で作成。

  • ログフィルター名:ConsoleSigninWithoutMFA
  • メトリクス名:ConsoleSigninWithoutMFA
  • アラーム名:ConsoleSigninWithoutMFA

ドキュメントの概要

CIS3.3

Ensure a log metric filter and alarm exist for usage of the "root" user

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CIS3.3

ルートユーザーの使用を検知する。以下のリソース名で作成。

  • ログフィルター名:RootAccountUsage
  • メトリクス名:RootAccountUsage
  • アラーム名:RootAccountUsage

ドキュメントの概要

CIS3.4

Ensure a log metric filter and alarm exist for IAM policy changes

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

IAMポリシーの変更を検知する。以下のリソース名で作成。

  • ログフィルター名:IAMPolicyChanges
  • メトリクス名:IAMPolicyChanges
  • アラーム名:IAMPolicyChanges

ドキュメントの概要

CIS3.5

Ensure a log metric filter and alarm exist for CloudTrail configuration changes

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CIS3.5

CloudTrailの変更を検知する。以下のリソース名で作成。

  • ログフィルター名:CloudTrailChanges
  • メトリクス名:CloudTrailChanges
  • アラーム名:CloudTrailChanges

ドキュメントの概要

CIS3.6

Ensure a log metric filter and alarm exist for AWS Management Console authentication failures

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CIS3.6

AWSマネジメントコンソールの認証失敗を検知する。以下のリソース名で作成。

  • ログフィルター名:ConsoleAuthenticationFailure
  • メトリクス名:ConsoleAuthenticationFailure
  • アラーム名:ConsoleAuthenticationFailure

ドキュメントの概要

CIS3.7

Ensure a log metric filter and alarm exist for disabling or scheduled deletion of customer created CMKs

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CMKの無効化やスケジュール削除を検知する。以下のリソース名で作成。

CIS3.7

  • ログフィルター名:DisableOrDeleteCMK
  • メトリクス名:DisableOrDeleteCMK
  • アラーム名:DisableOrDeleteCMK

ドキュメントの概要

CIS3.8

Ensure a log metric filter and alarm exist for S3 bucket policy changes

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CIS3.8

S3バケットポリシーの変更を検知する。以下のリソース名で作成。

  • ログフィルター名:S3BucketPolicyChanges
  • メトリクス名:S3BucketPolicyChanges
  • アラーム名:S3BucketPolicyChanges

ドキュメントの概要

CIS3.9

Ensure a log metric filter and alarm exist for AWS Config configuration changes

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CIS3.9

AWS Configの変更を検知する。以下のリソース名で作成。

  • ログフィルター名:AWSConfigChanges
  • メトリクス名:AWSConfigChanges
  • アラーム名:AWSConfigChanges

ドキュメントの概要

CIS3.10

Ensure a log metric filter and alarm exist for security group changes

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CIS3.10

セキュリティグループの変更を検知する。以下のリソース名で作成。

  • ログフィルター名:SecurityGroupChanges
  • メトリクス名:SecurityGroupChanges
  • アラーム名:SecurityGroupChanges

ドキュメントの概要

CIS3.11

Ensure a log metric filter and alarm exist for changes to Network Access Control Lists (NACL)

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CIS3.11

NetworkACLの変更を検知する。以下のリソース名で作成。

  • ログフィルター名:NetworkACLChanges
  • メトリクス名:NetworkACLChanges
  • アラーム名:NetworkACLChanges

ドキュメントの概要

CIS3.12

Ensure a log metric filter and alarm exist for changes to network gateways

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CIS3.12

インターネットゲートウェイやカスタマーゲートウェイの変更を検知する。以下のリソース名で作成。

  • ログフィルター名:NetworkGatewayChanges
  • メトリクス名:NetworkGatewayChanges
  • アラーム名:NetworkGatewayChanges

ドキュメントの概要

CIS3.13

Ensure a log metric filter and alarm exist for route table changes

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CIS3.13

ルートテーブルの変更を検知する。以下のリソース名で作成。

  • ログフィルター名:RouteTableChanges
  • メトリクス名:RouteTableChanges
  • アラーム名:RouteTableChanges

ドキュメントの概要

CIS3.14

Ensure a log metric filter and alarm exist for VPC changes

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

CIS3.14

VPCの変更を検知する。以下のリソース名で作成。

  • ログフィルター名:VPCChanges
  • メトリクス名:VPCChanges
  • アラーム名:VPCChanges

AWS-DisablePublicAccessForSecurityGroup

ドキュメントの概要

Ensure no security groups allow ingress from 0.0.0.0/0 to port 22
Ensure no security groups allow ingress from 0.0.0.0/0 to port 3389

引用元:https://docs.aws.amazon.com/en_us/solutions/latest/automated-security-response-on-aws/playbooks-1.html

修復内容のコメント

  • AWS所有ドキュメントを呼び出し実行:AWS-DisablePublicAccessForSecurityGroup
  • インバウンドルールのオープンなSSHとRDPのルールを削除する(0.0.0.0/0::/0

修復内容コメントの補足について

  • RDSまわりで以下の記載パターンがありますが、SSMドキュメントにより記述方法が異なるため書き分けています。
    • Apply Immediately:false
    • Apply Immediately:指定なし(デフォルト次回メンテ時)

1点目がSSMドキュメントのApply Immediatelyのdefaultにfalseを設定しているパターンで、2点目がApply Immediatelyオプションを指定しないパターンです。ModifyDBInstance APIでApply Immediatelyを指定しない場合はデフォルト値であるfalseで実行されますので、結果的にどちらも次回メンテ時の反映となります。SSMドキュメントでApply Immediatelyオプションを指定しているかの違いがあったため、書き分けました。

参考情報

最後に

久々にSSMドキュメントと長時間にらめっこしましたが、こういう作り方があるのかと得るものが多かったです。S3バケットポリシーを操作するSSMドキュメントでは、中でPythonコードが記述されているのですが、コードを見ても何がどう変わるのか分からず、実際に修復処理を動かしてみてようやく理解できました。Security Hubの自動修復ソリューションについて、またひとつ詳しくなれた気がします。

参考情報