auditing-cloud-with-cis-benchmarks

本 skill 详细介绍如何使用互联网安全中心(Center for Internet Security)基准对 AWS、Azure 和 GCP 进行云安全审计。 涵盖解读 CIS Foundations Benchmark 控制项、使用 Prowler 和 ScoutSuite 等工具运行自动化评估、 修复未通过的控制项,以及针对 CIS AWS v5、Azure v4 和 GCP v4 维持持续合规监控。

9 stars

Best use case

auditing-cloud-with-cis-benchmarks is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

本 skill 详细介绍如何使用互联网安全中心(Center for Internet Security)基准对 AWS、Azure 和 GCP 进行云安全审计。 涵盖解读 CIS Foundations Benchmark 控制项、使用 Prowler 和 ScoutSuite 等工具运行自动化评估、 修复未通过的控制项,以及针对 CIS AWS v5、Azure v4 和 GCP v4 维持持续合规监控。

Teams using auditing-cloud-with-cis-benchmarks should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/auditing-cloud-with-cis-benchmarks/SKILL.md --create-dirs "https://raw.githubusercontent.com/killvxk/cybersecurity-skills-zh/main/skills/auditing-cloud-with-cis-benchmarks/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/auditing-cloud-with-cis-benchmarks/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How auditing-cloud-with-cis-benchmarks Compares

Feature / Agentauditing-cloud-with-cis-benchmarksStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

本 skill 详细介绍如何使用互联网安全中心(Center for Internet Security)基准对 AWS、Azure 和 GCP 进行云安全审计。 涵盖解读 CIS Foundations Benchmark 控制项、使用 Prowler 和 ScoutSuite 等工具运行自动化评估、 修复未通过的控制项,以及针对 CIS AWS v5、Azure v4 和 GCP v4 维持持续合规监控。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 使用 CIS Benchmarks 审计云环境

## 适用场景

- 对云环境进行初始安全审计时,以行业标准基准衡量现状
- 准备参考 CIS 控制项的 SOC 2、ISO 27001 或法规审计时
- 为新云账户或订阅建立可衡量的安全基线时
- 通过定期重新评估跟踪合规改进情况时
- 评估收购或接管的云环境安全态势时

**不适用于**:运行时威胁检测(参见 detecting-cloud-threats-with-guardduty)、应用层安全测试(参见 conducting-cloud-penetration-testing),或非 CIS 的合规框架(参见相关合规 skill 文件)。

## 前置条件

- 对目标云账户的只读访问(AWS SecurityAudit 策略、Azure Reader 角色、GCP Viewer 角色)
- 安装并配置 Prowler、ScoutSuite 或云原生 CSPM 工具
- 了解 CIS 基准结构:章节、控制项、配置文件(Level 1 和 Level 2)
- 用于实施修复的修复访问权限(与审计凭据分开)

## 工作流程

### 步骤 1:选择合适的 CIS Benchmark 版本

为每个云提供商选择正确的基准版本。截至 2025 年的当前版本包括:CIS AWS Foundations Benchmark v5.0、CIS Azure Foundations Benchmark v4.0 和 CIS GCP Foundations Benchmark v4.0。

```
CIS Benchmark 覆盖范围:
+-------------------+-------------------------+------------------------+
| 章节              | AWS v5.0                | Azure v4.0             |
+-------------------+-------------------------+------------------------+
| 身份与访问        | IAM 策略、MFA、root     | Azure AD、RBAC、PIM    |
| 日志记录          | CloudTrail、Config      | Activity Log、Diag     |
| 监控              | CloudWatch 告警         | Defender、Sentinel     |
| 网络              | VPC、SG、NACLs         | NSG、ASG、防火墙       |
| 存储              | S3 加密、访问           | Storage 加密           |
| 数据库            | RDS 加密                | SQL TDE、审计          |
+-------------------+-------------------------+------------------------+

CIS 配置文件级别:
  Level 1:实用安全设置,不会对性能或功能产生重大影响即可实施
  Level 2:纵深防御设置,可能降低功能性或需要额外规划才能实施
```

### 步骤 2:使用 Prowler 运行自动化评估

使用 Prowler 执行全面的 CIS 基准扫描,对 AWS、Azure 和 GCP 的控制项进行自动化评估。

```bash
# AWS CIS v5.0 评估
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 评估
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 评估
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)

# 使用 ScoutSuite 进行多账户 AWS 扫描
scout suite aws \
  --profile audit-account \
  --report-dir ./scout-report \
  --ruleset cis-5.0 \
  --force
```

### 步骤 3:解读结果并确定修复优先级

按章节和严重程度分析审计结果。优先处理 Level 1 控制项(代表基本安全卫生),然后处理 Level 2 控制项(纵深防御)。

```bash
# 解析 Prowler 结果中的失败控制项
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)'

# 按章节生成合规分数
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 系统性地应用修复。

```bash
# CIS 1.4:确保 root 账户无访问密钥
aws iam list-access-keys --user-name root
# 如果密钥存在则删除
aws iam delete-access-key --user-name root --access-key-id AKIAEXAMPLE

# CIS 2.1.1:确保 S3 存储桶启用默认加密
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 "已加密: $bucket" || echo "失败: $bucket"
done

# CIS 3.1:确保 CloudTrail 在所有区域启用
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:配置 CloudWatch 指标过滤器和告警
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。

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

# Azure:分配 CIS 基准策略倡议
az policy assignment create \
  --name cis-azure-benchmark \
  --scope "/subscriptions/<sub-id>" \
  --policy-set-definition "1a5bb27d-173f-493e-9568-eb56638dbd0e" \
  --params '{"effect": {"value": "AuditIfNotExists"}}'

# 安排定期 Prowler 评估
# 通过 cron 或 CI/CD 流水线每周运行
0 2 * * 1 prowler aws --compliance cis_5.0_aws --output-formats csv --output-directory /opt/audits/weekly-$(date +\%Y\%m\%d)
```

## 核心概念

| 术语 | 定义 |
|------|------------|
| CIS Benchmark | 互联网安全中心通过社区共识制定的规范性安全配置指南 |
| Level 1 配置文件 | 可实施的实用安全控制项,不会对性能或功能产生重大影响,代表安全卫生 |
| Level 2 配置文件 | 纵深防御控制项,可能限制功能,实施前需仔细规划 |
| Foundations Benchmark | 专为云提供商设计的 CIS 基准,涵盖 IAM、日志记录、监控、网络和存储安全 |
| 控制项 ID(Control ID) | 每个 CIS 建议的唯一数字标识符(如 1.4 表示 root 访问密钥检查,2.1.1 表示 S3 加密) |
| 合规分数(Compliance Score) | 处于通过状态的 CIS 控制项百分比,随时间跟踪以衡量安全态势改进 |
| 自动化评估(Automated Assessment) | 使用云提供商 API 检查资源配置是否符合基准要求的工具驱动评估 |
| 修复手册(Remediation Runbook) | 修复特定失败 CIS 控制项的文档化分步骤程序,包括预检查和验证 |

## 工具与系统

- **Prowler**:开源云安全工具,执行 300+ 项检查,包括 AWS、Azure 和 GCP 的 CIS 基准评估
- **ScoutSuite**:多云安全审计工具,包含 CIS 基准规则集,生成 HTML 报告
- **AWS Security Hub**:AWS 原生服务,支持将 CIS AWS Foundations Benchmark 作为安全标准
- **Azure Policy**:治理服务,包含内置 CIS 基准策略倡议,用于自动化合规监控
- **GCP Security Command Center**:GCP 原生服务,根据 CIS GCP Foundations Benchmark 评估配置

## 常见场景

### 场景:SOC 2 认证前的 CIS 预审计评估

**场景背景**:一家寻求 SOC 2 Type II 认证的 SaaS 公司需要证明其云安全控制符合 CIS 基准。审计员要求提供 45 个 AWS 账户持续合规监控的证据。

**方法**:
1. 在所有 45 个账户运行 Prowler CIS v5.0 评估,建立基线合规分数
2. 将结果导出为 CSV,按章节(IAM、日志记录、监控、网络)对失败项进行分类
3. 将每个 CIS 控制项映射到相关 SOC 2 信任服务标准(CC6.1、CC6.6、CC7.1 等)
4. 30 天内修复所有 Level 1 控制失败,60 天内修复 Level 2
5. 在 AWS Security Hub 中启用 CIS v5.0,进行持续监控和自动化漂移检测
6. 生成每周合规报告,向审计员展示改进轨迹
7. 为有意不实施的控制项记录例外情况,并附上风险接受理由

**常见陷阱**:未先在预演环境测试就修复控制项可能会破坏生产工作负载。即使 Level 2 控制项不是严格要求的,完全忽略它们也会削弱审计论据。

## 输出格式

```
CIS Benchmark 审计报告
============================
云提供商: AWS
基准版本: CIS AWS Foundations Benchmark v5.0
评估账户数: 45
评估日期: 2025-02-23
工具: Prowler v4.3.0

总体合规分数: 74%

各章节合规情况:
  1. 身份和访问管理:  68% (41/60 个控制项通过)
  2. 存储:           82% (28/34 个控制项通过)
  3. 日志记录:       91% (20/22 个控制项通过)
  4. 监控:           55% (18/33 个控制项通过)
  5. 网络:           78% (32/41 个控制项通过)

最多失败控制项(按受影响账户数排序):
  [1.4]   root 账户存在活跃访问密钥           - 3/45 个账户
  [1.5]   root 账户未启用 MFA                 - 2/45 个账户
  [2.1.1] S3 未启用默认加密                   - 12/45 个账户
  [3.1]   CloudTrail 未启用多区域             - 8/45 个账户
  [4.3]   未配置 root 账户使用告警            - 28/45 个账户
  [5.1]   VPC 未启用流日志                    - 15/45 个账户
  [5.4]   安全组允许 0.0.0.0/0 入站          - 22/45 个账户

修复优先级:
  严重(7 天内修复):  root 访问密钥、缺失 root MFA
  高(30 天内修复):   S3 加密、CloudTrail、VPC 流日志
  中(60 天内修复):   CloudWatch 告警、安全组限制
  低(90 天内修复):   Level 2 控制项、信息类项目
```

Related Skills

securing-kubernetes-on-cloud

9
from killvxk/cybersecurity-skills-zh

本技能涵盖通过实施 Pod 安全标准(Pod Security Standards)、网络策略、工作负载身份、RBAC 权限控制、镜像准入控制和运行时安全监控,对 EKS、AKS 和 GKE 上的托管 Kubernetes 集群进行加固。涉及云平台特定安全功能,包括 EKS 的 IRSA、GKE 的工作负载身份(Workload Identity)以及 AKS 的托管身份(Managed Identity)。

performing-cloud-storage-forensic-acquisition

9
from killvxk/cybersecurity-skills-zh

通过收集 API 远程数据和端点设备本地同步客户端制品,对 Google Drive、OneDrive、Dropbox 和 Box 等云存储服务执行取证获取和分析。

performing-cloud-penetration-testing

9
from killvxk/cybersecurity-skills-zh

对 AWS、Azure 和 GCP 云环境执行授权渗透测试,识别 IAM 错误配置、暴露的存储桶、过度宽松的安全组、 无服务器函数漏洞以及从初始访问到账户沦陷的云特定攻击路径。测试人员使用云原生工具及 Pacu、 ScoutSuite 等专用框架枚举并利用云基础设施。适用于云渗透测试、AWS 安全评估、Azure 渗透测试 或云基础设施安全测试等请求场景。

performing-cloud-penetration-testing-with-pacu

9
from killvxk/cybersecurity-skills-zh

使用开源 AWS 利用框架 Pacu 执行已授权的 AWS 渗透测试,枚举 IAM 配置、发现权限提升路径、测试凭据收集,并通过系统化的攻击模拟验证安全控制。

performing-cloud-native-forensics-with-falco

9
from killvxk/cybersecurity-skills-zh

使用 Falco YAML 规则在容器和 Kubernetes 中进行运行时威胁检测,监控系统调用以检测 shell 生成、文件篡改、网络异常和权限提升。通过 Falco gRPC API 管理 Falco 规则并解析 Falco 告警输出。适用于构建容器运行时安全或调查 k8s 集群入侵。

performing-cloud-incident-containment-procedures

9
from killvxk/cybersecurity-skills-zh

在 AWS、Azure 和 GCP 中执行云原生事件遏制,包括隔离受攻陷资源、撤销凭据、保全取证证据,以及应用安全组限制以防止横向移动。

performing-cloud-forensics-with-aws-cloudtrail

9
from killvxk/cybersecurity-skills-zh

使用 CloudTrail 日志对 AWS 环境执行取证调查,重建攻击者活动、识别受损凭据并分析 API 调用模式。

performing-cloud-forensics-investigation

9
from killvxk/cybersecurity-skills-zh

通过收集和分析来自 AWS、Azure 和 GCP 服务的日志、快照和元数据,在云环境中开展取证调查。

performing-cloud-asset-inventory-with-cartography

9
from killvxk/cybersecurity-skills-zh

使用 Cartography 执行全面的云资产清单和关系映射,在 AWS、GCP 和 Azure 中构建包含基础设施资产、IAM 权限和攻击路径的 Neo4j 安全图谱。

managing-cloud-identity-with-okta

9
from killvxk/cybersecurity-skills-zh

本技能涵盖将 Okta 部署为云环境集中身份提供商,配置与 AWS、Azure 和 GCP 的 SSO 集成,使用 Okta FastPass 部署抗钓鱼 MFA,管理用户预配置和取消配置的生命周期自动化,以及基于设备态势和风险信号实施自适应访问策略。

implementing-zero-trust-in-cloud

9
from killvxk/cybersecurity-skills-zh

本技能指导组织按照 NIST SP 800-207 和 Google BeyondCorp 原则在云环境中实施零信任(Zero Trust)架构,涵盖以身份为中心的访问控制、微分段(Micro-Segmentation)、持续验证、设备信任评估,以及部署身份感知代理(Identity-Aware Proxy)以消除 AWS、Azure 和 GCP 环境中的隐式网络信任。

implementing-ddos-mitigation-with-cloudflare

9
from killvxk/cybersecurity-skills-zh

配置 Cloudflare DDoS 防护,包括托管规则集、速率限制、WAF 规则、Bot 管理和源站保护,以缓解容量型、协议型和应用层攻击。