Amazon Macie

Tip

学习并练习 AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
学习并练习 GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
学习并练习 Az Hacking: HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks

Macie

Amazon Macie 是一项旨在 自动检测、分类和识别数据 的服务,适用于 AWS 账户。它利用 机器学习 持续监控和分析数据,主要关注通过检查 cloud trail event 数据和用户行为模式来检测和警报异常或可疑活动。

Amazon Macie 的主要特点:

  1. 主动数据审查:利用机器学习在 AWS 账户内各种操作发生时主动审查数据。
  2. 异常检测:识别不规则活动或访问模式,生成警报以减轻潜在的数据暴露风险。
  3. 持续监控:自动监控和检测 Amazon S3 中的新数据,利用机器学习和人工智能随着时间的推移适应数据访问模式。
  4. 使用 NLP 进行数据分类:利用自然语言处理 (NLP) 对不同数据类型进行分类和解释,分配风险评分以优先处理发现。
  5. 安全监控:识别安全敏感数据,包括 API 密钥、秘密密钥和个人信息,帮助防止数据泄露。

Amazon Macie 是一项 区域服务,需要 ‘AWSMacieServiceCustomerSetupRole’ IAM 角色和启用的 AWS CloudTrail 才能正常工作。

警报系统

Macie 将警报分类为预定义类别,如:

  • 匿名访问
  • 数据合规
  • 凭证丢失
  • 权限提升
  • 勒索软件
  • 可疑访问等。

这些警报提供详细描述和结果细分,以便有效响应和解决。

仪表板功能

仪表板将数据分类为多个部分,包括:

  • S3 对象(按时间范围、ACL、PII)
  • 高风险 CloudTrail 事件/用户
  • 活动位置
  • CloudTrail 用户身份类型等。

用户分类

用户根据其 API 调用的风险级别被分类为不同层级:

  • 铂金:高风险 API 调用,通常具有管理员权限。
  • 黄金:与基础设施相关的 API 调用。
  • 白银:中风险 API 调用。
  • 青铜:低风险 API 调用。

身份类型

身份类型包括 Root、IAM 用户、假定角色、联合用户、AWS 账户和 AWS 服务,指示请求的来源。

数据分类

数据分类包括:

  • 内容类型:基于检测到的内容类型。
  • 文件扩展名:基于文件扩展名。
  • 主题:根据文件中的关键词分类。
  • 正则表达式:基于特定正则表达式模式分类。

这些类别中最高的风险决定文件的最终风险级别。

研究与分析

Amazon Macie 的研究功能允许对所有 Macie 数据进行自定义查询,以进行深入分析。过滤器包括 CloudTrail 数据、S3 桶属性和 S3 对象。此外,它支持邀请其他账户共享 Amazon Macie,促进协作数据管理和安全监控。

使用 AWS 控制台列出发现

在扫描特定 S3 桶以查找秘密和敏感数据后,发现将生成并显示在控制台中。具有足够权限的授权用户可以查看和列出每个作业的这些发现。

Screenshot 2025-02-10 at 19 08 08

揭示秘密

Amazon Macie 提供一个功能,可以以明文格式显示检测到的秘密。此功能有助于识别被泄露的数据。然而,由于安全问题,通常不建议以明文显示秘密,因为这可能会暴露敏感信息。

Screenshot 2025-02-10 at 19 13 53 Screenshot 2025-02-10 at 19 15 11

枚举

# Get buckets
aws macie2 describe-buckets

# Org config
aws macie2 describe-organization-configuration

# Get admin account (if any)
aws macie2 get-administrator-account
aws macie2 list-organization-admin-accounts # Run from the management account of the org

# Get macie account members (run this from the admin account)
aws macie2 list-members

# Check if automated sensitive data discovey is enabled
aws macie2 get-automated-discovery-configuration

# Get findings
aws macie2 list-findings
aws macie2 get-findings --finding-ids <ids>
aws macie2 list-findings-filters
aws macie2 get -findings-filters --id <id>

# Get allow lists
aws macie2 list-allow-lists
aws macie2 get-allow-list --id <id>

# Get different info
aws macie2 list-classification-jobs
aws macie2 describe-classification-job --job-id <Job_ID>
aws macie2 list-classification-scopes
aws macie2 list-custom-data-identifiers
aws macie2 get-custom-data-identifier --id <Identifier_ID>

# Retrieve account details and statistics
aws macie2 get-macie-session
aws macie2 get-usage-statistic

Privesc

AWS - Macie Privesc

Post Exploitation

Tip

从攻击者的角度来看,这项服务并不是为了检测攻击者,而是为了检测存储文件中的敏感信息。因此,这项服务可能帮助攻击者在存储桶中找到敏感信息
然而,攻击者也可能对破坏它感兴趣,以防止受害者收到警报,从而更容易窃取该信息。

TODO: PRs are welcome!

References

Tip

学习并练习 AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
学习并练习 GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
学习并练习 Az Hacking: HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks