mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-02-05 11:26:11 -08:00
Translated ['src/pentesting-cloud/aws-security/aws-privilege-escalation/
This commit is contained in:
@@ -292,6 +292,7 @@
|
||||
- [AWS - KMS Privesc](pentesting-cloud/aws-security/aws-privilege-escalation/aws-kms-privesc.md)
|
||||
- [AWS - Lambda Privesc](pentesting-cloud/aws-security/aws-privilege-escalation/aws-lambda-privesc.md)
|
||||
- [AWS - Lightsail Privesc](pentesting-cloud/aws-security/aws-privilege-escalation/aws-lightsail-privesc.md)
|
||||
- [AWS - Macie Enum](pentesting-cloud/aws-security/aws-privilege-escalation/aws-macie-privesc.md)
|
||||
- [AWS - Mediapackage Privesc](pentesting-cloud/aws-security/aws-privilege-escalation/aws-mediapackage-privesc.md)
|
||||
- [AWS - MQ Privesc](pentesting-cloud/aws-security/aws-privilege-escalation/aws-mq-privesc.md)
|
||||
- [AWS - MSK Privesc](pentesting-cloud/aws-security/aws-privilege-escalation/aws-msk-privesc.md)
|
||||
@@ -320,7 +321,6 @@
|
||||
- [AWS - Firewall Manager Enum](pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-firewall-manager-enum.md)
|
||||
- [AWS - GuardDuty Enum](pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-guardduty-enum.md)
|
||||
- [AWS - Inspector Enum](pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-inspector-enum.md)
|
||||
- [AWS - Macie Enum](pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-macie-enum.md)
|
||||
- [AWS - Security Hub Enum](pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-security-hub-enum.md)
|
||||
- [AWS - Shield Enum](pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-shield-enum.md)
|
||||
- [AWS - Trusted Advisor Enum](pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-trusted-advisor-enum.md)
|
||||
@@ -354,6 +354,7 @@
|
||||
- [AWS - KMS Enum](pentesting-cloud/aws-security/aws-services/aws-kms-enum.md)
|
||||
- [AWS - Lambda Enum](pentesting-cloud/aws-security/aws-services/aws-lambda-enum.md)
|
||||
- [AWS - Lightsail Enum](pentesting-cloud/aws-security/aws-services/aws-lightsail-enum.md)
|
||||
- [AWS - Macie Enum](pentesting-cloud/aws-security/aws-services/aws-macie-enum.md)
|
||||
- [AWS - MQ Enum](pentesting-cloud/aws-security/aws-services/aws-mq-enum.md)
|
||||
- [AWS - MSK Enum](pentesting-cloud/aws-security/aws-services/aws-msk-enum.md)
|
||||
- [AWS - Organizations Enum](pentesting-cloud/aws-security/aws-services/aws-organizations-enum.md)
|
||||
@@ -399,6 +400,7 @@
|
||||
- [Az - Tokens & Public Applications](pentesting-cloud/azure-security/az-basic-information/az-tokens-and-public-applications.md)
|
||||
- [Az - Enumeration Tools](pentesting-cloud/azure-security/az-enumeration-tools.md)
|
||||
- [Az - Unauthenticated Enum & Initial Entry](pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/README.md)
|
||||
- [Az - Container Registry Unauth](pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/az-container-registry-unauth.md)
|
||||
- [Az - OAuth Apps Phishing](pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/az-oauth-apps-phishing.md)
|
||||
- [Az - Storage Unauth](pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/az-storage-unauth.md)
|
||||
- [Az - VMs Unauth](pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/az-vms-unauth.md)
|
||||
@@ -413,7 +415,7 @@
|
||||
- [Az - Azure App Services](pentesting-cloud/azure-security/az-services/az-app-services.md)
|
||||
- [Az - Cloud Shell](pentesting-cloud/azure-security/az-services/az-cloud-shell.md)
|
||||
- [Az - Container Registry](pentesting-cloud/azure-security/az-services/az-container-registry.md)
|
||||
- [Az - Container Registry](pentesting-cloud/azure-security/az-services/az-container-instances.md)
|
||||
- [Az - Container Instances](pentesting-cloud/azure-security/az-services/az-container-instances.md)
|
||||
- [Az - CosmosDB](pentesting-cloud/azure-security/az-services/az-cosmosDB.md)
|
||||
- [Az - Intune](pentesting-cloud/azure-security/az-services/intune.md)
|
||||
- [Az - File Shares](pentesting-cloud/azure-security/az-services/az-file-shares.md)
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
# Amazon Macie - 绕过 `Reveal Sample` 完整性检查
|
||||
# AWS - Macie Privesc
|
||||
|
||||
AWS Macie 是一项安全服务,能够自动检测 AWS 环境中的敏感数据,例如凭证、个人身份信息 (PII) 和其他机密数据。当 Macie 识别到敏感凭证,例如存储在 S3 桶中的 AWS 秘密密钥时,它会生成一个发现,允许所有者查看检测到的“样本”。通常,一旦敏感文件从 S3 桶中删除,预计该秘密将无法再被检索。
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
然而,已识别出一种 **绕过** 方法,攻击者在具有足够权限的情况下可以 **重新上传一个同名** 但包含不同、非敏感虚拟数据的文件。这导致 Macie 将新上传的文件与原始发现关联,从而允许攻击者使用 **“Reveal Sample” 功能** 提取之前检测到的秘密。此问题构成了重大安全风险,因为被认为已删除的秘密仍然可以通过此方法检索。
|
||||
## Macie
|
||||
|
||||
<img src="https://github.com/user-attachments/assets/c44228ae-12cd-41bd-9a04-57f503a63281" height="800" width="auto"/>
|
||||
有关 Macie 的更多信息,请查看:
|
||||
|
||||
## 重现步骤:
|
||||
{{#ref}}
|
||||
../aws-services/aws-macie-enum.md
|
||||
{{#endref}}
|
||||
|
||||
### Amazon Macie - 绕过 `Reveal Sample` 完整性检查
|
||||
|
||||
AWS Macie 是一种安全服务,能够自动检测 AWS 环境中的敏感数据,例如凭证、个人身份信息 (PII) 和其他机密数据。当 Macie 识别到敏感凭证(例如存储在 S3 桶中的 AWS 秘密密钥)时,它会生成一个发现,允许所有者查看检测到的数据的“样本”。通常,一旦敏感文件从 S3 桶中删除,预计该秘密将无法再被检索。
|
||||
|
||||
然而,已识别出一种 **绕过** 方法,攻击者在具有足够权限的情况下可以 **重新上传一个同名** 但包含不同、非敏感的虚拟数据的文件。这导致 Macie 将新上传的文件与原始发现关联,从而允许攻击者使用 **“Reveal Sample” 功能** 提取之前检测到的秘密。此问题构成了重大安全风险,因为被认为已删除的秘密仍然可以通过此方法检索。
|
||||
|
||||

|
||||
|
||||
**重现步骤:**
|
||||
|
||||
1. 将一个文件(例如 `test-secret.txt`)上传到包含敏感数据的 S3 桶,例如 AWS 秘密密钥。等待 AWS Macie 扫描并生成发现。
|
||||
|
||||
@@ -20,6 +32,6 @@ AWS Macie 是一项安全服务,能够自动检测 AWS 环境中的敏感数
|
||||
|
||||
6. 观察到 Macie 仍然揭示原始秘密,尽管文件已被删除并被不同内容 **替换, 在我们的案例中将是攻击者的账户**。
|
||||
|
||||
## 总结:
|
||||
**总结:**
|
||||
|
||||
此漏洞允许具有足够 AWS IAM 权限的攻击者恢复之前检测到的秘密,即使原始文件已从 S3 中删除。如果 AWS 秘密密钥、访问令牌或其他敏感凭证被暴露,攻击者可以利用此缺陷检索它并获得对 AWS 资源的未经授权访问。这可能导致权限提升、未经授权的数据访问或进一步危害云资产,从而导致数据泄露和服务中断。
|
||||
此漏洞允许具有足够 AWS IAM 权限的攻击者恢复之前检测到的秘密,即使原始文件已从 S3 中删除。如果 AWS 秘密密钥、访问令牌或其他敏感凭证被暴露,攻击者可以利用此缺陷检索它并获得对 AWS 资源的未授权访问。这可能导致权限提升、未授权的数据访问或进一步危害云资产,从而导致数据泄露和服务中断。
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
# AWS - Macie Enum
|
||||
|
||||
## AWS - Macie Enum
|
||||
|
||||
{{#include ../../../../banners/hacktricks-training.md}}
|
||||
|
||||
## 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 才能正常工作。
|
||||
|
||||
### Alert System
|
||||
|
||||
Macie 将警报分类为预定义类别,如:
|
||||
|
||||
- 匿名访问
|
||||
- 数据合规
|
||||
- 凭证丢失
|
||||
- 权限提升
|
||||
- 勒索软件
|
||||
- 可疑访问等。
|
||||
|
||||
这些警报提供详细描述和结果细分,以便有效响应和解决。
|
||||
|
||||
### Dashboard Features
|
||||
|
||||
仪表板将数据分类为多个部分,包括:
|
||||
|
||||
- S3 对象(按时间范围、ACL、PII)
|
||||
- 高风险 CloudTrail 事件/用户
|
||||
- 活动位置
|
||||
- CloudTrail 用户身份类型等。
|
||||
|
||||
### User Categorization
|
||||
|
||||
用户根据其 API 调用的风险级别被分类为不同层级:
|
||||
|
||||
- **Platinum**:高风险 API 调用,通常具有管理员权限。
|
||||
- **Gold**:与基础设施相关的 API 调用。
|
||||
- **Silver**:中风险 API 调用。
|
||||
- **Bronze**:低风险 API 调用。
|
||||
|
||||
### Identity Types
|
||||
|
||||
身份类型包括 Root、IAM 用户、假定角色、联合用户、AWS 账户和 AWS 服务,指示请求的来源。
|
||||
|
||||
### Data Classification
|
||||
|
||||
数据分类包括:
|
||||
|
||||
- Content-Type:基于检测到的内容类型。
|
||||
- File Extension:基于文件扩展名。
|
||||
- Theme:根据文件中的关键词分类。
|
||||
- Regex:基于特定的正则表达式模式分类。
|
||||
|
||||
这些类别中最高的风险决定文件的最终风险级别。
|
||||
|
||||
### Research and Analysis
|
||||
|
||||
Amazon Macie 的研究功能允许对所有 Macie 数据进行自定义查询以进行深入分析。过滤器包括 CloudTrail 数据、S3 桶属性和 S3 对象。此外,它支持邀请其他账户共享 Amazon Macie,促进协作数据管理和安全监控。
|
||||
|
||||
### Enumeration
|
||||
```
|
||||
# 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 form 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 list-classification-scopes
|
||||
aws macie2 list-custom-data-identifiers
|
||||
```
|
||||
#### 后期利用
|
||||
|
||||
> [!TIP]
|
||||
> 从攻击者的角度来看,这项服务并不是为了检测攻击者,而是为了检测存储文件中的敏感信息。因此,这项服务可能**帮助攻击者在存储桶中找到敏感信息**。\
|
||||
> 然而,攻击者也可能有兴趣破坏它,以防止受害者收到警报,从而更容易窃取该信息。
|
||||
|
||||
TODO: PRs are welcome!
|
||||
|
||||
## 参考文献
|
||||
|
||||
- [https://cloudacademy.com/blog/introducing-aws-security-hub/](https://cloudacademy.com/blog/introducing-aws-security-hub/)
|
||||
|
||||
{{#include ../../../../banners/hacktricks-training.md}}
|
||||
Reference in New Issue
Block a user