implementing-aws-security-hub
部署 AWS Security Hub 作为集中式云安全态势管理平台,聚合来自 GuardDuty、Inspector、Macie 和第三方工具的发现结果,启用 CIS AWS Foundations Benchmark 等安全标准,配置自动修复,并构建跨多账户 AWS 组织的合规跟踪执行仪表盘。
Best use case
implementing-aws-security-hub is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
部署 AWS Security Hub 作为集中式云安全态势管理平台,聚合来自 GuardDuty、Inspector、Macie 和第三方工具的发现结果,启用 CIS AWS Foundations Benchmark 等安全标准,配置自动修复,并构建跨多账户 AWS 组织的合规跟踪执行仪表盘。
Teams using implementing-aws-security-hub 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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/implementing-aws-security-hub/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How implementing-aws-security-hub Compares
| Feature / Agent | implementing-aws-security-hub | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
部署 AWS Security Hub 作为集中式云安全态势管理平台,聚合来自 GuardDuty、Inspector、Macie 和第三方工具的发现结果,启用 CIS AWS Foundations Benchmark 等安全标准,配置自动修复,并构建跨多账户 AWS 组织的合规跟踪执行仪表盘。
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 Security Hub
## 适用场景
- 在多个 AWS 账户之间建立集中式安全发现结果仪表盘时
- 针对 CIS、PCI-DSS、NIST 或 AWS 基础安全最佳实践启用自动化合规检查时
- 集成来自 GuardDuty、Inspector、Macie 和第三方安全工具的发现结果时
- 为频繁出现的安全错误配置构建自动修复工作流时
- 为需要持续态势监控的审计人员准备合规证据时
**不适用于**:实时威胁检测(参见 detecting-cloud-threats-with-guardduty)、Azure 合规监控(参见 securing-azure-with-microsoft-defender),或对容器镜像进行深度漏洞扫描(参见 securing-container-registry)。
## 前置条件
- 具有指定安全管理员账户的 AWS Organization
- 在所有目标账户和区域启用 AWS Config
- 已激活 GuardDuty、Inspector 和 Macie 以集成发现结果
- 管理员账户具备 `securityhub:*` 和 `config:*` IAM 权限
## 工作流程
### 步骤 1:启用 Security Hub 并配置安全标准
在委派管理员账户中激活 Security Hub 并启用安全标准。AWS Security Hub CSPM(云安全态势管理)支持 CIS AWS Foundations Benchmark v5.0、AWS 基础安全最佳实践(FSBP)、PCI DSS v3.2.1 和 NIST SP 800-53。
```bash
# 启用 Security Hub 并加载默认标准
aws securityhub enable-security-hub \
--enable-default-standards \
--tags '{"Environment":"production","ManagedBy":"security-team"}'
# 启用 CIS AWS Foundations Benchmark v5.0
aws securityhub batch-enable-standards \
--standards-subscription-requests '[
{"StandardsArn": "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/5.0.0"},
{"StandardsArn": "arn:aws:securityhub:us-east-1::standards/aws-foundational-security-best-practices/v/1.0.0"},
{"StandardsArn": "arn:aws:securityhub:us-east-1::standards/pci-dss/v/3.2.1"}
]'
# 验证已启用的标准
aws securityhub get-enabled-standards \
--query 'StandardsSubscriptions[*].[StandardsArn,StandardsStatus]' --output table
```
### 步骤 2:配置多账户聚合
指定 Security Hub 管理员并自动注册所有组织成员账户。配置跨区域聚合,将发现结果整合到单一区域。
```bash
# 指定委派管理员
aws securityhub enable-organization-admin-account \
--admin-account-id 111122223333
# 为所有组织成员自动启用
aws securityhub update-organization-configuration \
--auto-enable \
--organization-configuration '{"ConfigurationType": "CENTRAL"}'
# 启用跨区域聚合
aws securityhub create-finding-aggregator \
--region-linking-mode ALL_REGIONS
```
### 步骤 3:集成安全服务和第三方工具
配置产品集成,接收来自 AWS 服务和合作伙伴安全工具的发现结果。将第三方发现结果映射到 AWS Security Finding Format(ASFF)。
```bash
# 列出可用的产品集成
aws securityhub describe-products \
--query 'Products[*].[ProductName,CompanyName,ProductSubscriptionResourcePolicy]' --output table
# 启用特定集成
aws securityhub enable-import-findings-for-product \
--product-arn "arn:aws:securityhub:us-east-1::product/aws/guardduty"
aws securityhub enable-import-findings-for-product \
--product-arn "arn:aws:securityhub:us-east-1::product/aws/inspector"
# 使用 ASFF 格式导入自定义发现结果
aws securityhub batch-import-findings --findings '[{
"SchemaVersion": "2018-10-08",
"Id": "custom-finding-001",
"ProductArn": "arn:aws:securityhub:us-east-1:123456789012:product/123456789012/default",
"GeneratorId": "custom-scanner",
"AwsAccountId": "123456789012",
"Types": ["Software and Configuration Checks/Vulnerabilities/CVE"],
"Title": "生产 ALB 后端存在未修补的 OpenSSL 漏洞",
"Description": "后端实例检测到 CVE-2024-12345",
"Severity": {"Label": "HIGH"},
"Resources": [{"Type": "AwsEc2Instance", "Id": "arn:aws:ec2:us-east-1:123456789012:instance/i-0abc123"}]
}]'
```
### 步骤 4:构建自动修复
创建与 EventBridge 规则和 Lambda 函数关联的 Security Hub 自定义操作,实现对常见发现结果的一键式或全自动修复。
```bash
# 创建修复自定义操作
aws securityhub create-action-target \
--name "IsolateInstance" \
--description "通过替换安全组隔离 EC2 实例" \
--id "IsolateInstance"
# 针对特定控制项自动修复的 EventBridge 规则
aws events put-rule \
--name SecurityHubAutoRemediate \
--event-pattern '{
"source": ["aws.securityhub"],
"detail-type": ["Security Hub Findings - Imported"],
"detail": {
"findings": {
"Compliance": {"Status": ["FAILED"]},
"Severity": {"Label": ["CRITICAL", "HIGH"]},
"GeneratorId": ["aws-foundational-security-best-practices/v/1.0.0/S3.1"]
}
}
}'
```
### 步骤 5:监控合规评分并生成报告
跟踪各标准的安全评分,监控合规漂移趋势,并生成用于审计证据的报告。
```bash
# 获取某个标准的安全评分
aws securityhub get-security-control-definition \
--security-control-id "S3.1"
# 列出所有失败控制项及其数量
aws securityhub get-findings \
--filters '{
"ComplianceStatus": [{"Value": "FAILED", "Comparison": "EQUALS"}],
"RecordState": [{"Value": "ACTIVE", "Comparison": "EQUALS"}]
}' \
--sort-criteria '{"Field": "SeverityLabel", "SortOrder": "desc"}' \
--max-items 50
```
## 核心概念
| 术语 | 定义 |
|------|------|
| 安全标准(Security Standard) | 映射到 CIS、PCI-DSS、NIST 800-53 和 AWS 最佳实践等合规框架的预打包控制集 |
| 安全控制(Security Control) | 针对特定安全要求评估 AWS 资源配置的单个自动化检查项 |
| ASFF | AWS Security Finding Format,用于规范化所有集成安全产品发现结果的标准化 JSON 模式 |
| 合规评分(Compliance Score) | 给定安全标准中处于通过状态的控制项百分比,按账户计算并在组织层面聚合 |
| 发现结果聚合器(Finding Aggregator) | 将所有已启用区域的发现结果整合到单一管理员区域的跨区域机制 |
| 自定义操作(Custom Action) | 可从 Security Hub 控制台触发的用户定义操作,用于调用 EventBridge 规则进行手动或自动响应 |
## 工具与系统
- **AWS Security Hub CSPM**:用于自动化安全态势检查和发现结果聚合的核心平台
- **AWS Config**:Security Hub 依赖的用于资源评估的底层配置记录器
- **Amazon EventBridge**:将 Security Hub 发现结果连接到自动修复工作流的事件路由服务
- **AWS Systems Manager**:Security Hub 可调用的自动化文档,用于修复常见错误配置
- **AWS Audit Manager**:使用 Security Hub 发现结果作为证据生成审计就绪报告
## 常见场景
### 场景:50 个账户中的 CIS 控制项失败
**场景背景**:一家企业启用 CIS AWS Foundations Benchmark v5.0 后,在 50 个账户中发现 340 个失败的控制项,主要集中在 IAM 密码策略、CloudTrail 配置和 VPC 流日志启用方面。
**方法**:
1. 按控制项 ID 导出所有 FAILED 发现结果,识别最普遍的问题
2. 优先处理影响最多账户的严重和高严重性控制项
3. 为出现频率最高的前 10 个失败项创建 Systems Manager Automation 文档
4. 通过 EventBridge 为 S3.1(阻止公开访问)和 CloudTrail.1(启用多区域跟踪)等控制项部署自动修复
5. 安排每周合规评分审查,并在 90 天修复窗口内跟踪改进情况
**常见陷阱**:一次性为所有控制项启用自动修复可能会破坏合法需要公开 S3 访问或特定网络配置的生产工作负载。务必先在预发布账户中测试修复操作。
## 输出格式
```
AWS Security Hub 合规报告
====================================
组织: acme-corp
管理员账户: 111122223333
报告日期: 2025-02-23
已启用标准: CIS v5.0, AWS FSBP v1.0, PCI DSS v3.2.1
合规评分:
CIS AWS Foundations Benchmark v5.0: 78%
AWS 基础安全最佳实践: 85%
PCI DSS v3.2.1: 72%
失败控制项 TOP 排行(按账户数量):
[S3.1] 已启用阻止公开访问设置 - 50 个账户中 23 个失败
[CT.1] 已启用 CloudTrail 多区域 - 50 个账户中 12 个失败
[IAM.4] Root 账户无访问密钥 - 50 个账户中 3 个失败
[EC2.19] 安全组限制未受限端口 - 50 个账户中 31 个失败
[RDS.3] 已启用 RDS 静态加密 - 50 个账户中 18 个失败
发现结果摘要:
活跃发现结果总计: 1,247
严重: 34 | 高: 189 | 中: 567 | 低: 457
本月自动修复: 89
已抑制: 23
```Related Skills
triaging-security-incident
使用 NIST SP 800-61r3 和 SANS PICERL 框架对安全事件进行初始分类,确定严重性、范围和所需响应行动。 按类型对事件分类,根据业务影响分配优先级,并路由到相应的响应团队。适用于事件分类、 安全告警分类、严重性评估、事件优先级排序或初始事件分析等请求场景。
triaging-security-incident-with-ir-playbook
使用结构化 IR Playbook 对安全事件进行分类和优先排序,确定严重性、分配响应团队并启动适当的响应程序。
triaging-security-alerts-in-splunk
在 Splunk Enterprise Security 中对安全告警进行分类,通过 SPL 查询和事件审查(Incident Review) 仪表板对重要事件进行严重性分类、调查、关联相关遥测并做出升级或关闭决策。 适用于 SOC 分析师需要处理关联搜索产生的告警队列、确定调查优先级, 或需要为交接给二/三级分析师记录分类决策时。
testing-websocket-api-security
测试 WebSocket API 实现中的安全漏洞,包括 WebSocket 升级时缺少身份认证、跨站 WebSocket 劫持(Cross-Site WebSocket Hijacking,CSWSH)、通过 WebSocket 消息进行的注入攻击、输入校验不足、通过消息泛洪实施拒绝服务,以及通过 WebSocket 帧造成的信息泄露。测试人员使用 Burp Suite 拦截 WebSocket 握手和消息,构造恶意 payload,并测试 WebSocket 通道上的授权绕过。适用于 WebSocket 安全测试、WS 渗透测试、CSWSH 攻击或实时 API 安全评估相关请求。
testing-jwt-token-security
在安全测试活动中,评估 JSON Web Token(JWT)实现中的密码学弱点、算法混淆攻击和授权绕过漏洞。
testing-api-security-with-owasp-top-10
使用自动化和手工测试技术,针对 OWASP API 安全 Top 10 风险对 REST 和 GraphQL API 端点进行系统性评估。
performing-wireless-security-assessment-with-kismet
使用 Kismet 通过被动射频监控进行无线网络安全评估,检测流氓接入点(Rogue AP)、隐藏 SSID、弱加密和未授权客户端。
performing-ssl-tls-security-assessment
使用 sslyze Python 库评估 SSL/TLS 服务器配置,评估加密套件、证书链、协议版本、HSTS 头部,以及 Heartbleed 和 ROBOT 等已知漏洞。
performing-soap-web-service-security-testing
通过分析 WSDL 定义,测试 XML 注入(XML Injection)、XXE、WS-Security 绕过和 SOAPAction 欺骗,对 SOAP Web 服务执行安全测试。
performing-serverless-function-security-review
对 AWS Lambda、Azure Functions 和 GCP Cloud Functions 中的无服务器函数(Serverless Function)执行安全审查,识别过度宽松的执行角色(Execution Role)、不安全的环境变量、注入漏洞和缺失的运行时保护措施。
performing-scada-hmi-security-assessment
对 SCADA 人机界面(HMI, Human-Machine Interface)系统进行安全评估,识别基于 Web 的 HMI、瘦客户端配置、认证机制以及 HMI 与 PLC 之间通信信道中的漏洞,符合 IEC 62443 和 NIST SP 800-82 指南要求。
performing-s7comm-protocol-security-analysis
对西门子SIMATIC S7 PLC使用的S7comm和S7CommPlus协议进行安全分析,识别漏洞,包括重放攻击、完整性绕过、未授权的CPU停止命令以及针对S7-300、S7-400、S7-1200和S7-1500控制器弱点的程序下载操控。