implementing-cloud-security-posture-management

实施云安全态势管理(CSPM),使用 Prowler、ScoutSuite、AWS Security Hub、Azure Defender 和 GCP Security Command Center 对多云环境中的错误配置、合规违规和安全风险进行持续监控。

9 stars

Best use case

implementing-cloud-security-posture-management is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

实施云安全态势管理(CSPM),使用 Prowler、ScoutSuite、AWS Security Hub、Azure Defender 和 GCP Security Command Center 对多云环境中的错误配置、合规违规和安全风险进行持续监控。

Teams using implementing-cloud-security-posture-management 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/implementing-cloud-security-posture-management/SKILL.md --create-dirs "https://raw.githubusercontent.com/killvxk/cybersecurity-skills-zh/main/skills/implementing-cloud-security-posture-management/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/implementing-cloud-security-posture-management/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How implementing-cloud-security-posture-management Compares

Feature / Agentimplementing-cloud-security-posture-managementStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

实施云安全态势管理(CSPM),使用 Prowler、ScoutSuite、AWS Security Hub、Azure Defender 和 GCP Security Command Center 对多云环境中的错误配置、合规违规和安全风险进行持续监控。

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

# 实施云安全态势管理

## 适用场景

- 在 AWS、Azure 和 GCP 环境中建立持续安全监控时
- 合规要求需要针对 CIS、SOC 2 或 PCI DSS 进行自动化态势评估时
- 安全团队需要跨多个账户和订阅了解云错误配置时
- 构建能检测和修复偏离安全基线的安全运营工作流时
- 将工作负载迁移到云端并需要强制执行安全护栏时

**不适用于**:运行时工作负载保护(使用 Falco 或 Aqua 等 CWPP 工具)、应用安全测试(使用 DAST/SAST 工具),或网络入侵检测(使用 GuardDuty 或 Network Watcher 等云原生 IDS)。

## 前置条件

- 跨所有目标环境具有只读安全审计权限的多云凭据
- 已安装 Prowler v3+(`pip install prowler`)
- 已安装 ScoutSuite(`pip install scoutsuite`)
- 在各自环境中启用 AWS Config、Azure Policy 和 GCP Organization Policy
- 用于发现结果聚合的集中日志目标(S3 存储桶、Log Analytics 工作区或 Cloud Storage)
- 已配置严重发现结果告警的通知渠道(Slack、PagerDuty、邮件)

## 工作流程

### 步骤 1:部署云原生 CSPM 服务

在每个云提供商中启用内置 CSPM 功能,用于基线态势评估。

```bash
# AWS:启用带 FSBP 和 CIS 标准的 Security Hub
aws securityhub enable-security-hub --enable-default-standards
aws securityhub batch-enable-standards --standards-subscription-requests \
  '[{"StandardsArn":"arn:aws:securityhub:::standards/cis-aws-foundations-benchmark/v/1.4.0"}]'

# Azure:启用 Microsoft Defender for Cloud(CSPM 层)
az security pricing create --name CloudPosture --tier standard
az security auto-provisioning-setting update --name default --auto-provision on

# GCP:启用 Security Command Center Premium
gcloud services enable securitycenter.googleapis.com
gcloud scc settings update --organization=ORG_ID \
  --enable-asset-discovery
```

### 步骤 2:运行 Prowler 进行多云评估

执行 Prowler,对所有三个云提供商进行全面安全检查。

```bash
# AWS 评估,执行所有 CIS 检查
prowler aws \
  --profile production \
  -M json-ocsf csv html \
  -o ./prowler-results/aws/ \
  --compliance cis_1.4_aws cis_1.5_aws

# Azure 评估
prowler azure \
  --subscription-ids SUB_ID_1 SUB_ID_2 \
  -M json-ocsf csv html \
  -o ./prowler-results/azure/ \
  --compliance cis_2.0_azure

# GCP 评估
prowler gcp \
  --project-ids project-1 project-2 \
  -M json-ocsf csv html \
  -o ./prowler-results/gcp/ \
  --compliance cis_2.0_gcp

# 查看跨所有提供商的摘要
prowler aws --list-compliance
```

### 步骤 3:运行 ScoutSuite 进行跨云比较

使用 ScoutSuite 进行统一的多云安全评估,并生成可视化报告。

```bash
# 扫描 AWS
python3 -m ScoutSuite aws --profile production \
  --report-dir ./scoutsuite/aws/

# 扫描 Azure
python3 -m ScoutSuite azure --cli \
  --all-subscriptions \
  --report-dir ./scoutsuite/azure/

# 扫描 GCP
python3 -m ScoutSuite gcp --user-account \
  --all-projects \
  --report-dir ./scoutsuite/gcp/

# 每次均生成包含风险评分发现结果的 HTML 报告
```

### 步骤 4:构建自动化合规监控管道

创建每日运行 CSPM 检查并将发现结果路由到相应渠道的定期管道。

```bash
# 通过 EventBridge + CodeBuild 创建每日 Prowler 扫描(AWS)
cat > buildspec.yml << 'EOF'
version: 0.2
phases:
  install:
    commands:
      - pip install prowler
  build:
    commands:
      - prowler aws -M json-ocsf -o s3://security-findings-bucket/prowler/$(date +%Y%m%d)/
      - prowler aws --compliance cis_1.5_aws -M csv -o s3://security-findings-bucket/prowler/compliance/
  post_build:
    commands:
      - |
        CRITICAL=$(cat output/*.json | grep -c '"CRITICAL"')
        if [ "$CRITICAL" -gt 0 ]; then
          aws sns publish --topic-arn arn:aws:sns:us-east-1:ACCOUNT:security-alerts \
            --subject "Prowler: 发现 $CRITICAL 个严重问题" \
            --message "请查看 s3://security-findings-bucket/prowler/$(date +%Y%m%d)/"
        fi
EOF

# 使用 EventBridge 设置定时任务
aws events put-rule \
  --name daily-prowler-scan \
  --schedule-expression "cron(0 6 * * ? *)" \
  --state ENABLED
```

### 步骤 5:配置发现结果聚合和去重

将来自多个 CSPM 工具和云提供商的发现结果聚合到统一视图。

```python
# findings_aggregator.py - 规范化和去重 CSPM 发现结果
import json
import hashlib
from datetime import datetime

def normalize_finding(finding, source):
    """将来自不同 CSPM 工具的发现结果规范化为通用格式。"""
    normalized = {
        'id': hashlib.sha256(f"{finding.get('ResourceId','')}{finding.get('CheckId','')}".encode()).hexdigest()[:16],
        'source': source,
        'cloud': finding.get('Provider', 'unknown'),
        'account': finding.get('AccountId', finding.get('SubscriptionId', '')),
        'region': finding.get('Region', ''),
        'resource_type': finding.get('ResourceType', ''),
        'resource_id': finding.get('ResourceId', ''),
        'severity': finding.get('Severity', 'INFO').upper(),
        'status': finding.get('Status', 'FAIL'),
        'title': finding.get('CheckTitle', finding.get('Title', '')),
        'description': finding.get('StatusExtended', ''),
        'compliance': finding.get('Compliance', {}),
        'remediation': finding.get('Remediation', {}).get('Recommendation', {}).get('Text', ''),
        'timestamp': datetime.utcnow().isoformat()
    }
    return normalized

def aggregate_findings(prowler_file, scoutsuite_file):
    findings = {}
    for file_path, source in [(prowler_file, 'prowler'), (scoutsuite_file, 'scoutsuite')]:
        with open(file_path) as f:
            for line in f:
                raw = json.loads(line)
                normalized = normalize_finding(raw, source)
                if normalized['status'] == 'FAIL':
                    findings[normalized['id']] = normalized
    return sorted(findings.values(), key=lambda x: {'CRITICAL':0,'HIGH':1,'MEDIUM':2,'LOW':3}.get(x['severity'],4))
```

### 步骤 6:实施配置漂移检测和自动修复

为违反安全基线的配置漂移设置自动响应。

```bash
# AWS Config 自动修复不合规 S3 存储桶
aws configservice put-remediation-configurations --remediation-configurations '[{
  "ConfigRuleName": "s3-bucket-public-read-prohibited",
  "TargetType": "SSM_DOCUMENT",
  "TargetId": "AWS-DisableS3BucketPublicReadWrite",
  "Parameters": {
    "S3BucketName": {"ResourceValue": {"Value": "RESOURCE_ID"}}
  },
  "Automatic": true,
  "MaximumAutomaticAttempts": 3,
  "RetryAttemptSeconds": 60
}]'

# Azure Policy 自动修复
az policy assignment create \
  --name "enforce-storage-encryption" \
  --policy "/providers/Microsoft.Authorization/policyDefinitions/404c3081-a854-4457-ae30-26a93ef643f9" \
  --scope "/subscriptions/SUB_ID" \
  --enforcement-mode Default

# GCP 组织策略约束
gcloud resource-manager org-policies set-policy policy.yaml --organization=ORG_ID
# policy.yaml: constraint: constraints/storage.publicAccessPrevention, enforcement: true
```

## 核心概念

| 术语 | 定义 |
|------|------|
| CSPM(云安全态势管理) | 持续监控云基础设施错误配置和合规违规的实践 |
| 配置漂移(Configuration Drift) | 云资源配置随时间偏离已批准安全基线的意外变更 |
| 安全基线(Security Baseline) | 记录了所有云资源必须满足的最低安全配置要求的文档 |
| 合规框架(Compliance Framework) | 用于评估云配置的结构化安全控制和要求集(CIS、SOC 2、PCI DSS、NIST) |
| 发现结果严重程度(Finding Severity) | 基于可利用性和潜在影响的错误配置风险分类(严重、高、中、低、信息) |
| 自动修复(Auto-Remediation) | 无需人工干预即可将不合规资源恢复到所需配置的自动纠正操作 |

## 工具与系统

- **Prowler**:开源多云安全评估工具,包含 300 余项对齐 CIS、PCI DSS、HIPAA 和 NIST 的检查
- **ScoutSuite**:多云安全审计工具,通过 API 收集的配置数据生成风险评分 HTML 报告
- **AWS Security Hub**:具有聚合发现结果和合规标准评估的 AWS 原生 CSPM
- **Microsoft Defender for Cloud**:具有安全评分、合规性和工作负载保护的 Azure 原生 CSPM
- **GCP Security Command Center**:具有资产清单、漏洞扫描和合规监控的 GCP 原生安全平台

## 常见场景

### 场景:为多云企业建立 CSPM

**场景背景**:一家企业在 AWS(主要)、Azure(身份和 Microsoft 服务)和 GCP(数据分析)上运行生产工作负载。安全团队需要统一的态势可见性。

**方法**:
1. 在每个提供商中启用云原生 CSPM:Security Hub、Defender for Cloud、SCC
2. 通过 CI/CD 管道在每个环境中将 Prowler 扫描部署为每日定期任务
3. 使用聚合脚本将发现结果规范化并聚合到中央数据湖
4. 在 Grafana 或 Kibana 中构建按云、账户和严重程度显示态势评分的仪表盘
5. 为已知安全修复(公开访问阻断、加密启用)配置自动修复
6. 将严重(CRITICAL)发现结果路由到 PagerDuty 进行即时响应,将高(HIGH)发现结果路由到 Jira 工单
7. 为管理层生成显示趋势数据的每周合规报告

**常见陷阱**:使用权限过宽运行 CSPM 工具会创建高价值目标。使用具有只读权限的专用服务账户并定期轮换凭据。不同 CSPM 工具可能以不同方式报告同一错误配置,因此去重逻辑必须考虑不同工具之间不同的资源 ID 格式和发现结果标题。

## 输出格式

```
云安全态势管理仪表盘
==============================================
组织: Acme Corp
评估日期: 2026-02-23
环境: AWS(12 个账户)、Azure(8 个订阅)、GCP(5 个项目)

态势评分:
  AWS:   82/100(比上周+3)
  Azure: 76/100(比上周-1)
  GCP:   79/100(比上周+5)
  总体: 79/100

按严重程度划分的发现结果:
  严重:  18(AWS: 7, Azure: 8, GCP: 3)
  高:    67(AWS: 28, Azure: 24, GCP: 15)
  中:   234(AWS: 98, Azure: 87, GCP: 49)
  低:   412(AWS: 178, Azure: 134, GCP: 100)

失败类别 TOP 排行:
  1. IAM 权限过宽策略        (43 个发现结果)
  2. 静态加密未启用           (38 个发现结果)
  3. 公开网络暴露             (29 个发现结果)
  4. 日志和监控缺口           (24 个发现结果)
  5. 未使用的凭据和密钥       (19 个发现结果)

自动修复(过去 7 天):
  已自动修复的发现结果:  34
  待手动修复:             51
  已批准豁免:              8
```

Related Skills

triaging-security-incident

9
from killvxk/cybersecurity-skills-zh

使用 NIST SP 800-61r3 和 SANS PICERL 框架对安全事件进行初始分类,确定严重性、范围和所需响应行动。 按类型对事件分类,根据业务影响分配优先级,并路由到相应的响应团队。适用于事件分类、 安全告警分类、严重性评估、事件优先级排序或初始事件分析等请求场景。

triaging-security-incident-with-ir-playbook

9
from killvxk/cybersecurity-skills-zh

使用结构化 IR Playbook 对安全事件进行分类和优先排序,确定严重性、分配响应团队并启动适当的响应程序。

triaging-security-alerts-in-splunk

9
from killvxk/cybersecurity-skills-zh

在 Splunk Enterprise Security 中对安全告警进行分类,通过 SPL 查询和事件审查(Incident Review) 仪表板对重要事件进行严重性分类、调查、关联相关遥测并做出升级或关闭决策。 适用于 SOC 分析师需要处理关联搜索产生的告警队列、确定调查优先级, 或需要为交接给二/三级分析师记录分类决策时。

testing-websocket-api-security

9
from killvxk/cybersecurity-skills-zh

测试 WebSocket API 实现中的安全漏洞,包括 WebSocket 升级时缺少身份认证、跨站 WebSocket 劫持(Cross-Site WebSocket Hijacking,CSWSH)、通过 WebSocket 消息进行的注入攻击、输入校验不足、通过消息泛洪实施拒绝服务,以及通过 WebSocket 帧造成的信息泄露。测试人员使用 Burp Suite 拦截 WebSocket 握手和消息,构造恶意 payload,并测试 WebSocket 通道上的授权绕过。适用于 WebSocket 安全测试、WS 渗透测试、CSWSH 攻击或实时 API 安全评估相关请求。

testing-jwt-token-security

9
from killvxk/cybersecurity-skills-zh

在安全测试活动中,评估 JSON Web Token(JWT)实现中的密码学弱点、算法混淆攻击和授权绕过漏洞。

testing-api-security-with-owasp-top-10

9
from killvxk/cybersecurity-skills-zh

使用自动化和手工测试技术,针对 OWASP API 安全 Top 10 风险对 REST 和 GraphQL API 端点进行系统性评估。

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-wireless-security-assessment-with-kismet

9
from killvxk/cybersecurity-skills-zh

使用 Kismet 通过被动射频监控进行无线网络安全评估,检测流氓接入点(Rogue AP)、隐藏 SSID、弱加密和未授权客户端。

performing-ssl-tls-security-assessment

9
from killvxk/cybersecurity-skills-zh

使用 sslyze Python 库评估 SSL/TLS 服务器配置,评估加密套件、证书链、协议版本、HSTS 头部,以及 Heartbleed 和 ROBOT 等已知漏洞。

performing-ssl-certificate-lifecycle-management

9
from killvxk/cybersecurity-skills-zh

SSL/TLS 证书生命周期管理涵盖请求、颁发、部署、监控、续期和吊销 X.509 证书的完整流程。不当的证书管理是导致中断和安全事件的主要原因。本技能涵盖使用 Python 和 ACME 协议工具自动化整个证书生命周期。

performing-soap-web-service-security-testing

9
from killvxk/cybersecurity-skills-zh

通过分析 WSDL 定义,测试 XML 注入(XML Injection)、XXE、WS-Security 绕过和 SOAPAction 欺骗,对 SOAP Web 服务执行安全测试。

performing-serverless-function-security-review

9
from killvxk/cybersecurity-skills-zh

对 AWS Lambda、Azure Functions 和 GCP Cloud Functions 中的无服务器函数(Serverless Function)执行安全审查,识别过度宽松的执行角色(Execution Role)、不安全的环境变量、注入漏洞和缺失的运行时保护措施。