Guides designing CSPM plans for AWS, Azure, GCP: select tools like Wiz/Prisma Cloud/native services, define policy baselines, automate drift detection, integrate findings into SOC workflows.
npx claudepluginhub killvxk/cybersecurity-skills-zhThis skill uses the workspace's default tool permissions.
- 组织缺乏跨多个账户和提供商的云错误配置可见性时
Deploys CSPM in AWS, Azure, GCP using Prowler, ScoutSuite, Security Hub, Defender, and Security Command Center to monitor misconfigurations, compliance violations, and risks.
Deploys CSPM for continuous multi-cloud monitoring of misconfigurations, compliance, and risks using Prowler, ScoutSuite, AWS Security Hub, Azure Defender, and GCP Security Command Center.
Implements Cloud Security Posture Management (CSPM) to monitor AWS, Azure, GCP for misconfigurations, compliance violations, and risks using Prowler, ScoutSuite, Security Hub, Defender, and Security Command Center.
Share bugs, ideas, or general feedback.
不适用于:运行时威胁检测(参见 detecting-cloud-threats-with-guardduty)、应用层漏洞扫描(参见 securing-serverless-functions),或网络流量分析(参见 implementing-cloud-network-segmentation)。
清点所有云账户、订阅和项目。按数据敏感性、法规要求和业务重要性进行分类,以确定 CSPM 覆盖范围。
云资产清单:
+----------------+----------+------------+--------------------+------------------+
| 提供商 | 账户数 | 工作负载 | 数据分类 | 合规需求 |
+----------------+----------+------------+--------------------+------------------+
| AWS | 45 | 生产环境 | 机密 | PCI-DSS, SOC 2 |
| AWS | 12 | 开发/测试 | 内部 | SOC 2 |
| Azure | 8 | 生产环境 | 受限(PII) | GDPR, SOC 2 |
| GCP | 3 | 分析 | 机密 | SOC 2 |
+----------------+----------+------------+--------------------+------------------+
根据多云支持、策略覆盖、无代理扫描、攻击路径分析和集成能力评估 CSPM 解决方案。
原生工具:
商业平台:
# 示例:使用 CloudFormation 为 AWS 部署 Wiz 连接器
aws cloudformation create-stack \
--stack-name wiz-connector \
--template-url https://wiz-advanced-security.s3.amazonaws.com/wiz-aws-connector.yaml \
--parameters ParameterKey=ExternalId,ParameterValue=<wiz-external-id> \
--capabilities CAPABILITY_NAMED_IAM
# 示例:配置 Prisma Cloud AWS 加载
# Prisma Cloud 使用跨账户 IAM 角色进行只读访问
aws iam create-role \
--role-name PrismaCloudReadOnly \
--assume-role-policy-document '{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": {"AWS": "arn:aws:iam::188619942792:root"},
"Action": "sts:AssumeRole",
"Condition": {"StringEquals": {"sts:ExternalId": "<prisma-external-id>"}}
}]
}'
将合规框架控制项映射到 CSPM 策略。为超出标准基准的组织特定要求创建自定义规则。
# 自定义 CSPM 策略定义示例
policies:
- name: s3-bucket-encryption-required
description: 所有 S3 存储桶必须启用 AES-256 或 KMS 加密
provider: aws
resource_type: aws_s3_bucket
severity: HIGH
rule: |
resource.encryption.rules[0].apply_server_side_encryption_by_default.sse_algorithm
in ["aws:kms", "AES256"]
remediation: 使用 AES-256 或 AWS KMS 启用 S3 存储桶默认加密
compliance_mapping:
- CIS_AWS_v5.0: "2.1.1"
- PCI_DSS: "3.4"
- SOC2: "CC6.1"
- name: public-ip-not-attached-to-compute
description: 生产计算实例不得具有公共 IP 地址
provider: aws
resource_type: aws_ec2_instance
severity: CRITICAL
rule: |
resource.public_ip_address == null AND
resource.tags["Environment"] == "production"
remediation: 移除公共 IP,通过负载均衡器或 NAT 网关路由流量
- name: storage-account-private-endpoint
description: Azure 存储账户必须仅使用私有端点
provider: azure
resource_type: azurerm_storage_account
severity: HIGH
rule: |
resource.network_rules.default_action == "Deny" AND
resource.private_endpoint_connections.length > 0
配置持续扫描间隔、漂移检测阈值和告警路由,确保在资源创建或修改后数分钟内检测到新的错误配置。
# 用于 S3 公开访问漂移检测的 AWS Config 规则
aws configservice put-config-rule \
--config-rule '{
"ConfigRuleName": "s3-bucket-public-read-prohibited",
"Source": {
"Owner": "AWS",
"SourceIdentifier": "S3_BUCKET_PUBLIC_READ_PROHIBITED"
},
"Scope": {"ComplianceResourceTypes": ["AWS::S3::Bucket"]}
}'
# 使用 SSM Automation 自动修复
aws configservice put-remediation-configurations \
--remediation-configurations '[{
"ConfigRuleName": "s3-bucket-public-read-prohibited",
"TargetType": "SSM_DOCUMENT",
"TargetId": "AWS-DisableS3BucketPublicReadWrite",
"Automatic": true,
"MaximumAutomaticAttempts": 3,
"RetryAttemptSeconds": 60
}]'
超越仅基于严重性的优先级确定。使用攻击路径分析、资产上下文和可利用性数据,将修复工作聚焦于代表实际风险的发现。
风险优先级矩阵:
+----------------------------+----------+-----------+--------+-------------+
| 发现 | 严重程度 | 暴露于 | 攻击 | 优先级 |
| | | 互联网? | 路径? | 评分 |
+----------------------------+----------+-----------+--------+-------------+
| S3 存储桶公开读取 | 高 | 是 | 是 | 严重 |
| RDS 静态未加密 | 高 | 否 | 否 | 中 |
| SG 允许 0.0.0.0/0:22 | 高 | 是 | 是 | 严重 |
| CloudTrail 未启用 | 中 | 否 | 否 | 高 |
| EBS 卷未加密 | 中 | 否 | 否 | 低 |
+----------------------------+----------+-----------+--------+-------------+
将 CSPM 发现推送到 SIEM 平台,创建 Jira 工单进行修复跟踪,构建态势趋势管理层仪表板。
# 以 OCSF 格式将发现导出到 Amazon Security Lake
aws securitylake create-subscriber \
--subscriber-name cspm-siem-integration \
--sources '[{"awsLogSource": {"sourceName": "SH_FINDINGS"}}]' \
--subscriber-identity '{"principal": "arn:aws:iam::123456789012:role/SIEMIngestionRole", "externalId": "siem-ext-id"}'
| 术语 | 定义 |
|---|---|
| CSPM | 云安全态势管理(Cloud Security Posture Management):持续监控服务,识别云基础设施错误配置和合规违规 |
| 配置漂移(Configuration Drift) | 在批准的变更管理流程外对资源进行修改时,偏离已定义安全基线的情况 |
| 攻击路径(Attack Path) | 攻击者可利用的多步骤错误配置和漏洞链,从入口点移动到关键资产 |
| 无代理扫描(Agentless Scanning) | CSPM 方法,使用云提供商 API 和快照分析评估安全态势,无需在工作负载上安装代理 |
| 策略即代码(Policy as Code) | 以机器可读格式(Rego、YAML、JSON)定义安全策略,可进行版本控制和自动化强制执行 |
| 合规框架(Compliance Framework) | 结构化的安全控制和要求集合,如 CIS Benchmarks、NIST 800-53、PCI-DSS 或 SOC 2,用于衡量态势 |
| 安全图(Security Graph) | 图数据库,表示云资源、身份、网络路径和漏洞之间的关系,用于情境化风险分析 |
场景背景:一家公司收购了一家拥有 30 个 AWS 账户和 5 个 GCP 项目的初创公司。没有 CSPM 工具,安全团队需要在两周内评估继承的环境。
方法:
常见陷阱:为初始评估部署代理会增加数周延迟。在多云评估中仅使用原生工具会创建独立的仪表板,难以进行跨云比较。
云安全态势评估报告
==========================================
组织: Acme Corp
云提供商: AWS(57 个账户)、Azure(8 个订阅)、GCP(3 个项目)
CSPM 平台: Wiz
评估日期: 2025-02-23
总体态势评分: 68/100
按严重程度的发现:
严重: 47 (互联网暴露 + 数据访问风险)
高: 234 (错误配置,暴露有限)
中: 891 (不合规但即时风险低)
低: 1,567 (信息性或最佳实践)
主要攻击路径:
1. 互联网 -> 公开 S3 存储桶(PII 数据)-> 无加密
受影响: 3 个账户 | 风险: 严重 | 修复预计: 1 天
2. 互联网 -> EC2(SSH 开放)-> IAM 角色 -> 跨账户管理员
受影响: 1 个账户 | 风险: 严重 | 修复预计: 2 天
3. 互联网 -> Azure App Service -> SQL Server(公共端点)
受影响: 2 个订阅 | 风险: 严重 | 修复预计: 3 天
合规状态:
CIS AWS v5.0: 62% 合规(340/548 控制项通过)
CIS Azure v4.0: 71% 合规(189/266 控制项通过)
CIS GCP v4.0: 58% 合规(87/150 控制项通过)
SOC 2 Type II: 74% 控制项已映射且通过