bulkinator/Detection-Pipeline-Cloudtrail-Elastic-Project

GitHub: bulkinator/Detection-Pipeline-Cloudtrail-Elastic-Project

基于 AWS CloudTrail 与 Elastic Security 构建的云安全检测流水线实验室,通过自定义检测规则将云活动日志转化为可操作的安全告警。

Stars: 0 | Forks: 0

# CloudTrail Elastic 检测流水线 ## 项目摘要 本项目展示了一个 AWS 安全监控流水线,它将 AWS CloudTrail 活动收集到 Elastic Security 中,并使用自定义检测规则来识别可疑或高风险的云活动。 该项目主要针对以下方面进行实际的云安全监控:AWS 账户活动、IAM 活动、S3 安全更改、控制台身份验证事件以及 CloudTrail 篡改。 ## 项目目标 - 将 AWS CloudTrail 事件收集到 Elastic 中。 - 为常见的 AWS 攻击和错误配置场景创建自定义 Elastic Security 检测规则。 - 通过在实验室账户中生成安全的 AWS 活动来测试每个检测规则。 - 记录检测逻辑、预期的 CloudTrail 事件、证据和响应步骤。 - 构建一个可用于展示的云安全监控项目。 ## 架构概述 ``` AWS Account | | CloudTrail management and data events v CloudTrail Trail | | Logs delivered to S3 v S3 CloudTrail Log Bucket | | SQS notification / Elastic AWS integration v Elastic Agent / AWS Integration | v Elastic Data Stream: aws.cloudtrail | v Elastic Security Detection Rules | v Security Alerts and Investigation Workflow ``` ![图表](https://static.pigsec.cn/wp-content/uploads/repos/cas/cd/cd503feb18ea9bae80bdc376d04bb135ec5d7db8684b9d9bd3689b65c16f32ec.png) ## 数据源 | 来源 | 描述 | |---|---| | AWS CloudTrail | 记录 AWS API 活动、控制台登录、IAM 更改、S3 配置更改和 CloudTrail 配置更改。 | | Elastic AWS Integration | 将 CloudTrail 日志摄取到 Elastic 中。 | | Elastic Security | 运行自定义检测规则并生成安全告警。 | ## 已创建的检测规则 | # | 规则名称 | 严重程度 | 风险评分 | 用途 | |---|---|---:|---:|---| | 1 | AWS CloudTrail Logging Disabled or Modified | 高 | 73 | 检测修改、禁用或删除 CloudTrail 日志记录的尝试。 | | 2 | AccessDenied Spike by Same Identity | 中 | 66 | 检测来自同一身份的重复被拒绝的 AWS API 调用。 | | 3 | AWS API AccessDenied Activity | 中 | 43 | 检测由于权限问题而失败的 AWS API 调用。 | | 4 | Root Account Activity | 高 | 83 | 检测由 AWS root 账户执行的活动。 | | 5 | AWS Console Login Failure | 中 | 31 | 检测失败的 AWS 控制台登录尝试。 | | 6 | Console Login Without MFA | 严重 | 99 | 检测未使用 MFA 的成功控制台登录。 | | 7 | IAM Access Key Updated or Deleted | 中 | 47 | 检测 IAM 访问密钥更新或删除活动。 | | 8 | S3 Bucket Versioning Changed | 中 | 61 | 检测对 S3 存储桶版本控制的更改。 | ## 仓库结构 ``` cloudtrail-elastic-detection-pipeline/ ├── README.md ├── screenshots/ │ ├── rules-enabled.png │ ├── discover-cloudtrail-events.png │ ├── alert-accessdenied.png │ ├── alert-console-login-failure.png │ ├── alert-s3-public-access.png │ └── alert-versioning-changed.png | └── more.... ├── detections/ │ ├── aws_api_access_denied.md │ ├── access_denied_spike.md │ ├── cloudtrail_logging_modified.md │ ├── root_account_activity.md │ ├── console_login_failure.md │ ├── console_login_without_mfa.md │ ├── iam_access_key_updated_or_deleted.md │ └── s3_bucket_versioning_changed.md ├── test-evidence/ └── test-results.md ``` ## 实用的 Elastic Discover 查询 ``` data_stream.dataset:"aws.cloudtrail" ``` 可在 Discover 中添加的实用字段: ``` @timestamp event.action event.provider event.outcome cloud.account.id cloud.region user.name source.ip user_agent.original aws.cloudtrail.user_identity.type aws.cloudtrail.user_identity.arn aws.cloudtrail.error_code aws.cloudtrail.error_message aws.cloudtrail.request_parameters ``` ## Elastic Security 仪表板 ![discover](https://static.pigsec.cn/wp-content/uploads/repos/cas/8f/8ff555658278f6932f4942bb7247ffa0152b0aa41efb26483cb7de0762d28007.png) ## 测试方法 每条规则均使用实验室 AWS 账户中的受控 AWS 操作进行了测试。 测试过程: 1. 确认 CloudTrail 已启用并正在交付日志。 2. 确认 Elastic 正在接收 `aws.cloudtrail` 事件。 3. 运行应与规则逻辑匹配的安全 AWS 测试操作。 4. 在 Elastic Discover 中搜索该事件。 5. 确认 Elastic Security 规则生成了告警。 6. 捕获原始事件、生成的告警和规则状态的屏幕截图。 7. 清理临时的 AWS 资源。 ``` ## 项目成果 The project successfully demonstrates how AWS CloudTrail events can be collected, monitored, and converted into actionable security alerts using Elastic Security. The detections cover common cloud security scenarios such as unauthorized access attempts, root account usage, console authentication issues, S3 exposure risks, IAM key changes, and CloudTrail tampering. ## 局限性 - Detection accuracy depends on CloudTrail coverage and Elastic ingestion health. - Some rules may require tuning to reduce false positives. - Lab testing was performed in a controlled environment and may need adjustment for production. - Field names may vary depending on Elastic integration version and AWS integration configuration. - Some actions may take several minutes to appear in Elastic because CloudTrail delivery is not instant. ## 未来改进 - Add EventBridge or SNS alerting for critical detections. - Add Slack, email, or ticketing integration for high severity alerts. - Add automated response actions for confirmed incidents. - Add GuardDuty and Security Hub findings into Elastic. - Add AWS Config rules for configuration compliance. - Add dashboards for AWS security monitoring. - Add Terraform code for repeatable deployment. ```
标签:AWS, DPI, 安全运营, 扫描框架, 检测规则, 网络资产发现