mcpField
A
auditing-cloud-with-cis-benchmarks

auditing-cloud-with-cis-benchmarks

github.com/mukul975セキュリティ35.2k272 回インストール8 週間前に更新
リポジトリ

auditing-cloud-with-cis-benchmarks について

CIS ベンチマークに基づくクラウド環境の評価を支援するスキルです。自動スキャン、修正の優先順位付け、継続的なコンプライアンス監視を扱います。

主な機能

  1. 01クラウド別 CIS ベンチマークの選定
  2. 02Prowler または ScoutSuite でのスキャン
  3. 03失敗した管理項目の重要度別整理
  4. 04重大・高リスク項目の修正
  5. 05継続的なコンプライアンス監視

活用シーン

  1. 01新しいクラウドアカウントの基準設定
  2. 02監査用 CIS 証跡の準備
  3. 03クラウド設定の適合状況の継続追跡

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill auditing-cloud-with-cis-benchmarks

インストール後、Claude Code で/auditing-cloud-with-cis-benchmarksを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

LICENSE
references/
api-reference.md
scripts/
agent.py

詳細

CIS ベンチマークによるクラウドの監査

使用する場面

  • 業界標準のベンチマークに照らして、クラウド環境の初期セキュリティ監査を実施する場合
  • CIS コントロールを参照する SOC 2、ISO 27001、または規制上の監査に備える場合
  • 新しいクラウドアカウントやサブスクリプションの、測定可能なセキュリティベースラインを確立する場合
  • 定期的な再評価によって、コンプライアンスの改善状況を経時的に追跡する場合
  • 取得または引き継いだクラウド環境のセキュリティ態勢を評価する場合

次の場合は使用しないでください:ランタイムの脅威検出(detecting-cloud-threats-with-guardduty を参照)、アプリケーションレベルのセキュリティテスト(conducting-cloud-penetration-testing を参照)、または CIS に基づかないコンプライアンスフレームワーク(該当する規制関連のスキルファイルを参照)。

前提条件

  • 対象のクラウドアカウントへの読み取り専用アクセス(AWS SecurityAudit ポリシー、Azure Reader ロール、GCP Viewer ロール)
  • Prowler、ScoutSuite、またはクラウドネイティブの CSPM ツールがインストールされ、設定済みであること
  • CIS ベンチマークの構造(セクション、コントロール、プロファイル(レベル 1 とレベル 2))を理解していること
  • 修正を適用するための修復アクセス(監査用認証情報とは別に用意)

ワークフロー

ステップ 1:適切な CIS ベンチマークのバージョンを選択する

クラウドプロバイダーごとに適切なベンチマークのバージョンを選択します。2025 年時点の最新バージョンには、CIS AWS Foundations Benchmark v5.0、CIS Azure Foundations Benchmark v4.0、CIS GCP Foundations Benchmark v4.0 があります。

CIS Benchmark Coverage Areas:
+-------------------+-------------------------+------------------------+
| Section           | AWS v5.0                | Azure v4.0             |
+-------------------+-------------------------+------------------------+
| Identity & Access | IAM policies, MFA, root | Azure AD, RBAC, PIM    |
| Logging           | CloudTrail, Config      | Activity Log, Diag     |
| Monitoring        | CloudWatch alarms       | Defender, Sentinel     |
| Networking        | VPC, SG, NACLs         | NSG, ASG, Firewall     |
| Storage           | S3 encryption, access   | Storage encryption     |
| Database          | RDS encryption          | SQL TDE, auditing      |
+-------------------+-------------------------+------------------------+

CIS Profile Levels:
  Level 1: Practical security settings that can be implemented without significant
           performance impact or reduced functionality
  Level 2: Defense-in-depth settings that may reduce functionality or require
           additional planning for implementation
ステップ 2:Prowler で自動評価を実行する

Prowler を使用して、AWS、Azure、GCP 全体のコントロールを自動評価する包括的な CIS ベンチマークスキャンを実行します。

# AWS CIS v5.0 assessment
prowler aws \
  --compliance cis_5.0_aws \
  --profile audit-account \
  --output-formats json-ocsf,html,csv \
  --output-directory ./cis-audit-$(date +%Y%m%d)

# Azure CIS v4.0 assessment
prowler azure \
  --compliance cis_4.0_azure \
  --subscription-ids "sub-id-1,sub-id-2" \
  --output-formats json-ocsf,html,csv \
  --output-directory ./cis-audit-azure-$(date +%Y%m%d)

# GCP CIS v4.0 assessment
prowler gcp \
  --compliance cis_4.0_gcp \
  --project-ids "project-1,project-2" \
  --output-formats json-ocsf,html,csv \
  --output-directory ./cis-audit-gcp-$(date +%Y%m%d)

# Multi-account AWS scan using ScoutSuite
scout suite aws \
  --profile audit-account \
  --report-dir ./scout-report \
  --ruleset cis-5.0 \
  --force
ステップ 3:結果を解釈し、修復の優先順位を決める

セクションと重大度ごとに監査結果を分析します。レベル 1 のコントロールは基本的なセキュリティ衛生を示すため、まず優先して対応し、その後、多層防御のためにレベル 2 のコントロールに対処します。

# Parse Prowler results for failed controls
cat ./cis-audit-*/prowler-output-*.json | \
  jq '[.[] | select(.StatusExtended == "FAIL")] | group_by(.CheckID) |
  map({control: .[0].CheckID, description: .[0].CheckTitle,
  failed_resources: length, severity: .[0].Severity}) |
  sort_by(-.failed_resources)'

# Generate compliance score by section
cat ./cis-audit-*/prowler-output-*.json | \
  jq 'group_by(.Section) | map({
    section: .[0].Section,
    total: length,
    passed: [.[] | select(.StatusExtended == "PASS")] | length,
    failed: [.[] | select(.StatusExtended == "FAIL")] | length,
    score: (([.[] | select(.StatusExtended == "PASS")] | length) / length * 100 | round)
  })'
ステップ 4:重大および高リスクのコントロールを修復する

影響が最も大きい項目から順に、失敗したコントロールに対処します。AWS Config の修復、Azure Policy、または Terraform を使用して、体系的に修正を適用します。

# CIS 1.4: Ensure no root account access key exists
aws iam list-access-keys --user-name root
# If keys exist, delete them
aws iam delete-access-key --user-name root --access-key-id AKIAEXAMPLE

# CIS 2.1.1: Ensure S3 bucket default encryption is enabled
for bucket in $(aws s3api list-buckets --query 'Buckets[*].Name' --output text); do
  aws s3api put-bucket-encryption --bucket "$bucket" \
    --server-side-encryption-configuration '{
      "Rules": [{"ApplyServerSideEncryptionByDefault": {"SSEAlgorithm": "AES256"}}]
    }' 2>/dev/null && echo "Encrypted: $bucket" || echo "FAILED: $bucket"
done

# CIS 3.1: Ensure CloudTrail is enabled in all regions
aws cloudtrail create-trail \
  --name organization-trail \
  --s3-bucket-name cloudtrail-logs-bucket \
  --is-multi-region-trail \
  --enable-log-file-validation \
  --kms-key-id arn:aws:kms:us-east-1:123456789012:key/key-id

aws cloudtrail start-logging --name organization-trail

# CIS 4.x: Configure CloudWatch metric filters and alarms
aws logs put-metric-filter \
  --log-group-name CloudTrail/DefaultLogGroup \
  --filter-name UnauthorizedAPICalls \
  --filter-pattern '{ ($.errorCode = "*UnauthorizedAccess*") || ($.errorCode = "AccessDenied*") }' \
  --metric-transformations metricName=UnauthorizedAPICalls,metricNamespace=CISBenchmark,metricValue=1
ステップ 5:継続的なコンプライアンス監視を確立する

定期監査の間に発生する設定ドリフトを検出するため、自動コンプライアンス監視を導入します。AWS Security Hub、Azure Policy、または GCP Security Command Center を使用します。

# AWS: Enable CIS v5.0 in Security Hub
aws securityhub batch-enable-standards \
  --standards-subscription-requests '[
    {"StandardsArn": "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/5.0.0"}
  ]'

# Azure: Assign CIS benchmark policy initiative
az policy assignment create \
  --name cis-azure-benchmark \
  --scope "/subscriptions/<sub-id>" \
  --policy-set-definition "1a5bb27d-173f-493e-9568-eb56638dbd0e" \
  --params '{"effect": {"value": "AuditIfNotExists"}}'

# Schedule periodic Prowler assessments
# Run weekly via cron or CI/CD pipeline
0 2 * * 1 prowler aws --compliance cis_5.0_aws --output-formats csv --output-directory /opt/audits/weekly-$(date +\%Y\%m\%d)

主要な概念

用語定義
CIS ベンチマークCenter for Internet Security がコミュニティの合意を通じて策定した、規範的なセキュリティ設定ガイドライン
レベル 1 プロファイルパフォーマンスや機能に大きな影響を与えずに実装できる、セキュリティ衛生を示す実用的なセキュリティコントロール
レベル 2 プロファイル機能を制限する可能性があり、実装前に慎重な計画が必要な多層防御コントロール
Foundations BenchmarkIAM、ログ記録、監視、ネットワーク、ストレージのセキュリティを対象とする、クラウドプロバイダー向けの CIS ベンチマーク
コントロール ID各 CIS 推奨事項に割り当てられた一意の数値識別子(例:ルートアクセスキーの確認は 1.4、S3 の暗号化は 2.1.1)
コンプライアンススコア合格状態にある CIS コントロールの割合。セキュリティ態勢の改善を測定するため、経時的に追跡します
自動評価クラウドプロバイダーの API を使用し、リソース設定をベンチマーク要件と照合して CIS コントロールを評価する、ツール主導のプロセス
修復手順書特定の失敗した CIS コントロールを修正するための、事前確認と検証を含む、文書化された手順

ツールとシステム

  • Prowler:AWS、Azure、GCP の CIS ベンチマーク評価を含む 300 件以上のチェックを実行する、オープンソースのクラウドセキュリティツール
  • ScoutSuite:CIS ベンチマークのルールセットを備え、HTML レポートを生成するマルチクラウドセキュリティ監査ツール
  • AWS Security Hub:CIS AWS Foundations Benchmark をセキュリティ標準としてサポートする AWS ネイティブサービス
  • Azure Policy:コンプライアンスを自動で監視する、CIS ベンチマークの組み込みポリシーイニシアチブを備えたガバナンスサービス
  • GCP Security Command Center:CIS GCP Foundations Benchmark に照らして構成を評価する GCP ネイティブサービス

一般的なシナリオ

シナリオ:SOC 2 認証に向けた監査前の CIS 評価

背景:SOC 2 Type II 認証の取得を目指す SaaS 企業は、CIS ベンチマークに準拠したクラウドセキュリティ管理策を実証する必要があります。監査人は、45 の AWS アカウント全体で継続的にコンプライアンスを監視している証拠を求めています。

アプローチ:

  1. 45 のアカウントすべてで Prowler CIS v5.0 の評価を実行し、コンプライアンススコアのベースラインを確立します
  2. 結果を CSV にエクスポートし、失敗項目をセクション別(IAM、Logging、Monitoring、Networking)に分類します
  3. 各 CIS コントロールを、該当する SOC 2 Trust Services Criteria(CC6.1、CC6.6、CC7.1 など)に対応付けます
  4. Level 1 のコントロールの失敗をすべて 30 日以内に、Level 2 の失敗を 60 日以内に修正します
  5. AWS Security Hub で CIS v5.0 を有効にし、継続的な監視と自動的な構成変更の検出を行います
  6. 改善の推移を示すコンプライアンスレポートを毎週作成し、監査人に提出します
  7. 意図的に実装していないコントロールについて、リスク受容の根拠とともに例外を記録します

注意点:ステージング環境で事前にテストせずにコントロールを修正すると、本番ワークロードに支障をきたす可能性があります。Level 2 のコントロールを完全に無視すると、厳密には必須でない場合でも、監査での説明が弱くなります。

出力形式

CIS Benchmark Audit Report
============================
Cloud Provider: AWS
Benchmark Version: CIS AWS Foundations Benchmark v5.0
Accounts Assessed: 45
Assessment Date: 2025-02-23
Tool: Prowler v4.3.0

OVERALL COMPLIANCE SCORE: 74%

COMPLIANCE BY SECTION:
  1. Identity and Access Management:  68% (41/60 controls passed)
  2. Storage:                         82% (28/34 controls passed)
  3. Logging:                         91% (20/22 controls passed)
  4. Monitoring:                      55% (18/33 controls passed)
  5. Networking:                      78% (32/41 controls passed)

TOP FAILED CONTROLS (by affected accounts):
  [1.4]   Root account has active access keys           - 3/45 accounts
  [1.5]   MFA not enabled for root account              - 2/45 accounts
  [2.1.1] S3 default encryption not enabled             - 12/45 accounts
  [3.1]   CloudTrail not multi-region                   - 8/45 accounts
  [4.3]   No alarm for root account usage               - 28/45 accounts
  [5.1]   VPC flow logs not enabled                     - 15/45 accounts
  [5.4]   Security groups allow 0.0.0.0/0 ingress      - 22/45 accounts

REMEDIATION PRIORITY:
  Critical (Fix within 7 days):  Root access keys, missing root MFA
  High (Fix within 30 days):     S3 encryption, CloudTrail, VPC flow logs
  Medium (Fix within 60 days):   CloudWatch alarms, security group restrictions
  Low (Fix within 90 days):      Level 2 controls, informational items

コメント