mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-02-05 03:16:37 -08:00
Translated ['src/pentesting-cloud/aws-security/aws-privilege-escalation/
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# Amazon Macie - 绕过 `Reveal Sample` 完整性检查
|
||||
|
||||
AWS Macie 是一项安全服务,能够自动检测 AWS 环境中的敏感数据,例如凭证、个人身份信息 (PII) 和其他机密数据。当 Macie 识别到敏感凭证,例如存储在 S3 桶中的 AWS 秘密密钥时,它会生成一个发现,允许所有者查看检测到的“样本”。通常,一旦敏感文件从 S3 桶中删除,预计该秘密将无法再被检索。
|
||||
|
||||
然而,已识别出一种 **绕过** 方法,攻击者在具有足够权限的情况下可以 **重新上传一个同名** 但包含不同、非敏感虚拟数据的文件。这导致 Macie 将新上传的文件与原始发现关联,从而允许攻击者使用 **“Reveal Sample” 功能** 提取之前检测到的秘密。此问题构成了重大安全风险,因为被认为已删除的秘密仍然可以通过此方法检索。
|
||||
|
||||
<img src="https://github.com/user-attachments/assets/c44228ae-12cd-41bd-9a04-57f503a63281" height="800" width="auto"/>
|
||||
|
||||
## 重现步骤:
|
||||
|
||||
1. 将一个文件(例如 `test-secret.txt`)上传到包含敏感数据的 S3 桶,例如 AWS 秘密密钥。等待 AWS Macie 扫描并生成发现。
|
||||
|
||||
2. 导航到 AWS Macie 发现,找到生成的发现,并使用 **Reveal Sample** 功能查看检测到的秘密。
|
||||
|
||||
3. 从 S3 桶中删除 `test-secret.txt` 并验证它不再存在。
|
||||
|
||||
4. 创建一个名为 `test-secret.txt` 的新文件,包含虚拟数据,并使用 **攻击者的账户** 重新上传到同一个 S3 桶。
|
||||
|
||||
5. 返回 AWS Macie 发现,访问原始发现,并再次点击 **Reveal Sample**。
|
||||
|
||||
6. 观察到 Macie 仍然揭示原始秘密,尽管文件已被删除并被不同内容 **替换, 在我们的案例中将是攻击者的账户**。
|
||||
|
||||
## 总结:
|
||||
|
||||
此漏洞允许具有足够 AWS IAM 权限的攻击者恢复之前检测到的秘密,即使原始文件已从 S3 中删除。如果 AWS 秘密密钥、访问令牌或其他敏感凭证被暴露,攻击者可以利用此缺陷检索它并获得对 AWS 资源的未经授权访问。这可能导致权限提升、未经授权的数据访问或进一步危害云资产,从而导致数据泄露和服务中断。
|
||||
@@ -0,0 +1,48 @@
|
||||
# Amazon Macie
|
||||
|
||||
## 介绍
|
||||
|
||||
Amazon Macie 是一种数据安全服务,通过使用机器学习和模式匹配来发现敏感数据,提供数据安全风险的可见性,并能够对这些风险进行自动保护。
|
||||
|
||||
## 使用 AWS 控制台列出发现
|
||||
|
||||
在扫描特定的 S3 存储桶以查找秘密和敏感数据后,将生成并在控制台中显示发现。具有足够权限的授权用户可以查看和列出每个作业的这些发现。
|
||||
|
||||
<img width="1438" alt="Screenshot 2025-02-10 at 19 08 08" src="https://github.com/user-attachments/assets/4420f13e-c071-4ae4-946b-6fe67449a9f6" />
|
||||
|
||||
|
||||
## 显示秘密
|
||||
|
||||
Amazon Macie 提供了一项功能,可以以明文格式显示检测到的秘密。此功能有助于识别被泄露的数据。然而,由于安全问题,通常不建议以明文显示秘密,因为这可能会暴露敏感信息。
|
||||
|
||||
<img width="596" alt="Screenshot 2025-02-10 at 19 13 53" src="https://github.com/user-attachments/assets/31c40c29-0bba-429b-8b86-4e214d1aef66" />
|
||||
|
||||
<img width="1154" alt="Screenshot 2025-02-10 at 19 15 11" src="https://github.com/user-attachments/assets/df616e56-a11a-41da-ac69-0bea37d143a5" />
|
||||
|
||||
## 枚举
|
||||
```bash
|
||||
# List and describe classification jobs
|
||||
aws macie2 list-classification-jobs --region eu-west-1
|
||||
aws macie2 describe-classification-job --job-id <Job_ID> --region eu-west-1
|
||||
|
||||
# Retrieve account details and statistics
|
||||
aws macie2 get-macie-session --region eu-west-1
|
||||
aws macie2 get-usage-statistics --region eu-west-1
|
||||
|
||||
# List and manage Macie members (for organizations)
|
||||
aws macie2 list-members --region eu-west-1
|
||||
|
||||
# List findings and get detailed information about specific findings
|
||||
aws macie2 list-findings --region eu-west-1
|
||||
aws macie2 get-findings --finding-id <Finding_ID> --region eu-west-1
|
||||
|
||||
# Manage custom data identifiers
|
||||
aws macie2 list-custom-data-identifiers --region eu-west-1
|
||||
aws macie2 get-custom-data-identifier --id <Identifier_ID> --region eu-west-1
|
||||
|
||||
# List and detail findings filters
|
||||
aws macie2 list-findings-filters --region eu-west-1
|
||||
aws macie2 get-findings-filter --id <Filter_ID> --region eu-west-1
|
||||
|
||||
```
|
||||
|
||||
@@ -471,12 +471,13 @@ window.search = window.search || {};
|
||||
showResults(true);
|
||||
}
|
||||
|
||||
fetch('https://raw.githubusercontent.com/HackTricks-wiki/hacktricks-cloud/refs/heads/master/searchindex.json')
|
||||
var branch = lang === "en" ? "master" : lang
|
||||
fetch(`https://raw.githubusercontent.com/HackTricks-wiki/hacktricks-cloud/refs/heads/${branch}/searchindex.json`)
|
||||
.then(response => response.json())
|
||||
.then(json => init(json))
|
||||
.catch(error => { // Try to load searchindex.js if fetch failed
|
||||
var script = document.createElement('script');
|
||||
script.src = 'https://raw.githubusercontent.com/HackTricks-wiki/hacktricks-cloud/refs/heads/master/searchindex.js';
|
||||
script.src = `https://raw.githubusercontent.com/HackTricks-wiki/hacktricks-cloud/refs/heads/${branch}/searchindex.js`;
|
||||
script.onload = () => init(window.search);
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
<!-- Provide site root to javascript -->
|
||||
<script>
|
||||
var path_to_root = "{{ path_to_root }}";
|
||||
var lang = "{{ language }}";
|
||||
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "{{ preferred_dark_theme }}" : "{{ default_theme }}";
|
||||
</script>
|
||||
<!-- Start loading toc.js asap -->
|
||||
|
||||
Reference in New Issue
Block a user