重要提示:本站仅作 Skill 资源导航与收录,正文以 GitHub 原仓库为准,版权归原项目所有。
以下为摘要预览,完整内容请查看 GitHub 原文。
Performing Cloud Forensics with AWS CloudTrail
When to Use
- When investigating suspected AWS account compromise
- After detecting unauthorized API calls or credential exposure
- During incident response involving cloud infrastructure
- When analyzing S3 data exfiltration or IAM privilege escalation
- For post-incident forensic timeline reconstruction
Prerequisites
- AWS account with CloudTrail enabled (management and data events)
- IAM permissions for cloudtrail:LookupEvents, s3:GetObject, athena:StartQueryExecution
- boto3 Python SDK installed
- CloudTrail logs delivered to S3 with optional Athena table configured
- AWS CLI configured with appropriate credentials
Workflow
- Scope Investigation: Identify timeframe, affected accounts, and compromised credentials.
- Query CloudTrail: Use boto3 lookup_events or Athena to retrieve relevant API events.
- Filter by Indicators: Search for suspicious user agents, source IPs, and event names.
- Reconstruct Timeline: Build chronological sequence of attacker actions from API calls.
- Analyze Access Patterns: Identify data access, IAM changes, and resource modifications.
- Identify Persistence: C…
以下为摘要预览,完整内容请查看 GitHub 原文。
使用 AWS CloudTrail 执行云取证
适用场景
- 调查可疑的 AWS 账号入侵事件
- 在检测到未授权 API 调用或凭证泄露之后
- 在涉及云基础设施的事件响应过程中
- 分析 S3 数据外泄或 IAM 权限提升时
- 用于事后取证时间线重建
先决条件
- 已启用 CloudTrail 的 AWS 账号(管理事件与数据事件)
- 拥有以下权限的 IAM 权限:cloudtrail:LookupEvents、s3:GetObject、athena:StartQueryExecution
- 已安装 boto3 Python SDK
- CloudTrail 日志投递至 S3,并可选用已配置的 Athena 表
- 已使用相应凭证配置 AWS CLI
工作流程
- 确定调查范围:识别时间范围、受影响账号以及被入侵的凭证。
- 查询 CloudTrail:使用 boto3 的 lookup_events 或 Athena 检索相关 API 事件。
- 按指标进行过滤:搜索可疑的 User-Agent、源 IP 和事件名称。
- 重建时间线:根据 API 调用构建攻击者操作的时序序列。
- 分析访问模式:识别数据访问、IAM 变更以及资源修改。
- 识别持久化机制:检查是否存在新建的 IAM 用户、访问密钥、角色或 Lambda 函数。
- 生成报告:产出包含发现与修复步骤的取证时间线。
关键概念
| 概念 | 描述 |
|---|
| LookupEvents | 用于查询管理事件的 CloudTrail API(最近 90 天) |
| Athena 查询 | 针对 S3 中 CloudTrail 日志进行 SQL 查询,用于历史分析 |
| User Agent 分析 | 识别工具特征(AWS CLI、SDK、Console、自定义工具) |
| AccessKeyId | 按特定 IAM 访问密钥追踪活动 |
| EventName | AWS API 操作名称(例如 GetObject、CreateUser、AssumeRole) |
| sourceIPAddress | API 调用的来源 IP,用于地理位置分析 |
工具与系统
| 工具 | 用途 |
|---|
| boto3 CloudTrail 客户端 | 以编程方式查询 CloudTrail 事件 |
| AWS Athena | 对 CloudTrail S3 日志进行基于 SQL 的分析 |
| AWS CLI | 通过命令行查询 CloudTrail |
| jq | 用于 CloudT… |