Translated ['src/pentesting-cloud/aws-security/aws-unauthenticated-enum-

This commit is contained in:
Translator
2025-04-30 15:35:57 +00:00
parent f537d0e7fd
commit 6fed60d6b2

View File

@@ -6,9 +6,9 @@
如果**任何用户都可以列出**桶的内容,则该桶被视为**“公共”**,如果桶的内容**只能由某些用户列出或写入**,则被视为**“私有”**。
公司可能会**桶权限配置错误**导致访问权限过于宽泛,或者对任何在 AWS 中的已认证用户开放(即任何人开放)。请注意,即使存在这样的配置错误某些操作可能仍无法执行因为桶可能有自己的访问控制列表ACL
公司可能会**错误配置桶权限**使得访问权限要么开放给所有人,要么开放给在任何账户中经过身份验证的所有人(即任何人)。请注意,即使存在这样的错误配置某些操作可能仍无法执行因为桶可能有自己的访问控制列表ACL
**在这里了解 AWS-S3 配置错误:** [**http://flaws.cloud**](http://flaws.cloud/) **和** [**http://flaws2.cloud/**](http://flaws2.cloud)
**在这里了解 AWS-S3 错误配置** [**http://flaws.cloud**](http://flaws.cloud/) **和** [**http://flaws2.cloud/**](http://flaws2.cloud)
### 查找 AWS 桶
@@ -17,7 +17,7 @@
#### 枚举与 OSINT
- 使用 **wappalyzer** 浏览器插件
- 使用 burp (**爬虫**网页) 或通过手动浏览页面,所有**加载的资源**将保存在历史记录中。
- 使用 burp**爬虫**网页或通过手动浏览页面,所有**加载的资源**将保存在历史记录中。
- **检查资源**在以下域名中:
```
@@ -26,10 +26,11 @@ http://[bucket_name].s3.amazonaws.com/
```
- 检查 **CNAMES**,如 `resources.domain.com` 可能有 CNAME `bucket.s3.amazonaws.com`
- **[s3dns](https://github.com/olizimmermann/s3dns)** 一个轻量级 DNS 服务器,通过分析 DNS 流量被动识别云存储桶S3、GCP、Azure。它检测 CNAME跟踪解析链并匹配桶模式为暴力破解或基于 API 的发现提供了一个安静的替代方案。非常适合侦查和 OSINT 工作流程。
- 检查 [https://buckets.grayhatwarfare.com](https://buckets.grayhatwarfare.com/),这是一个已经**发现的开放桶**的网站。
- **桶名称**和**桶域名**需要**相同**
- **flaws.cloud** 的 **IP** 是 52.92.181.107,如果你访问该地址,它会重定向到 [https://aws.amazon.com/s3/](https://aws.amazon.com/s3/)。此外,`dig -x 52.92.181.107` 返回 `s3-website-us-west-2.amazonaws.com`
- 要检查是否桶,你也可以**访问** [https://flaws.cloud.s3.amazonaws.com/](https://flaws.cloud.s3.amazonaws.com/)。
- **桶名称**和**桶域名**需要**相同**
- **flaws.cloud** 的 **IP** 是 52.92.181.107,如果你访问那里,它会重定向到 [https://aws.amazon.com/s3/](https://aws.amazon.com/s3/)。此外,`dig -x 52.92.181.107` 返回 `s3-website-us-west-2.amazonaws.com`
- 要检查是否是一个桶,你也可以**访问** [https://flaws.cloud.s3.amazonaws.com/](https://flaws.cloud.s3.amazonaws.com/)。
#### 暴力破解
@@ -37,7 +38,7 @@ http://[bucket_name].s3.amazonaws.com/
- [https://github.com/sa7mon/S3Scanner](https://github.com/sa7mon/S3Scanner)
- [https://github.com/clario-tech/s3-inspector](https://github.com/clario-tech/s3-inspector)
- [https://github.com/jordanpotti/AWSBucketDump](https://github.com/jordanpotti/AWSBucketDump) (包含潜在桶名称的列表)
- [https://github.com/jordanpotti/AWSBucketDump](https://github.com/jordanpotti/AWSBucketDump)包含潜在桶名称的列表
- [https://github.com/fellchase/flumberboozle/tree/master/flumberbuckets](https://github.com/fellchase/flumberboozle/tree/master/flumberbuckets)
- [https://github.com/smaranchand/bucky](https://github.com/smaranchand/bucky)
- [https://github.com/tomdev/teh_s3_bucketeers](https://github.com/tomdev/teh_s3_bucketeers)
@@ -56,7 +57,7 @@ cat subdomains.txt > /tmp/words-hosts-s3.txt
cat subdomains.txt | tr "." "-" >> /tmp/words-hosts-s3.txt
cat subdomains.txt | tr "." "\n" | sort -u >> /tmp/words-hosts-s3.txt
# 创建基于域名和子域名的排列列表进行攻击
# 创建基于要攻击的域名和子域名的排列
goaltdns -l /tmp/words-hosts-s3.txt -w /tmp/words-s3.txt -o /tmp/final-words-s3.txt.temp
## 之前的工具专门用于创建子域名的排列,让我们过滤该列表
<strong>### 移除以 "." 结尾的行
@@ -75,7 +76,7 @@ cat /tmp/final-words-s3.txt.temp2 /tmp/final-words-s3.txt.temp3 /tmp/final-words
s3scanner --threads 100 scan --buckets-file /tmp/final-words-s3.txt | grep bucket_exists
</code></pre>
#### 获取 S3 桶
#### 获取 S3 桶的战利品
给定 S3 开放桶,[**BucketLoot**](https://github.com/redhuntlabs/BucketLoot) 可以自动**搜索有趣的信息**。
@@ -85,7 +86,7 @@ s3scanner --threads 100 scan --buckets-file /tmp/final-words-s3.txt | grep buck
#### 通过 DNS
你可以通过**`dig`** 和 **`nslookup`** 获取桶的区域,方法是对发现的 IP 进行**DNS 请求**
你可以通过**`dig`** 和 **`nslookup`** 通过对发现的 IP 进行**DNS 请求**来获取桶的区域
```bash
dig flaws.cloud
;; ANSWER SECTION:
@@ -96,18 +97,20 @@ Non-authoritative answer:
11.192.218.52.in-addr.arpa name = s3-website-us-west-2.amazonaws.com.
```
检查解析的域名是否包含“website”一词。\
您可以通过访问以下静态网站来访问`flaws.cloud.s3-website-us-west-2.amazonaws.com`\
或者您可以通过访问以下存储桶来访问`flaws.cloud.s3-us-west-2.amazonaws.com`
您可以通过访问以下地址访问静态网站:`flaws.cloud.s3-website-us-west-2.amazonaws.com`\
或者您可以通过访问以下地址访问存储桶:`flaws.cloud.s3-us-west-2.amazonaws.com`
#### 通过尝试
如果您尝试访问一个存储桶,但在**域名中指定了另一个区域**(例如存储桶在`bucket.s3.amazonaws.com`,但您尝试访问`bucket.s3-website-us-west-2.amazonaws.com`,那么您将被**指向正确的位置**
#### 尝试访问
如果您尝试访问一个存储桶,但在**域名中指定了另一个区域**(例如存储桶在`bucket.s3.amazonaws.com`中,但您尝试访问`bucket.s3-website-us-west-2.amazonaws.com`,那么您将被**指向正确的位置**
![](<../../../images/image (106).png>)
### 枚举存储桶
要测试存储桶的开放性,用户只需在其网浏览器中输入URL。私有存储桶将响应“访问被拒绝”。公共存储桶将列出前1,000个已存储的对象。
要测试存储桶的开放性,用户只需在其网浏览器中输入URL。私有存储桶将响应“访问被拒绝”。公共存储桶将列出前1,000个已存储的对象。
对所有人开放:
@@ -117,7 +120,7 @@ Non-authoritative answer:
![](<../../../images/image (83).png>)
可以通过cli检查此内容
可以通过cli检查此内容
```bash
#Use --no-sign-request for check Everyones permissions
#Use --profile <PROFILE_NAME> to indicate the AWS profile(keys) that youwant to use: Check for "Any Authenticated AWS User" permissions
@@ -133,10 +136,10 @@ https://{user_provided}.s3.amazonaws.com
```
### 从公共桶获取账户ID
可以通过利用新的 **`S3:ResourceAccount`** **策略条件键** 来确定一个AWS账户。这个条件 **基于账户所在的S3桶限制访问**(其他基于账户的策略基于请求主体所在的账户)。\
而且由于策略可以包含 **通配符**,因此可以 **一次找到一个数字** 来查找账户号码。
可以通过利用新的 **`S3:ResourceAccount`** **策略条件键** 来确定AWS账户。条件 **基于账户所在的S3桶限制访问**(其他基于账户的策略基于请求主体所在的账户)。\
由于策略可以包含 **通配符**,因此可以 **一次找到一个数字** 来查找账户号码。
这个工具自动化了这个过程:
工具自动化了过程:
```bash
# Installation
pipx install s3-account-search
@@ -146,11 +149,11 @@ s3-account-search arn:aws:iam::123456789012:role/s3_read s3://my-bucket
# With an object
s3-account-search arn:aws:iam::123456789012:role/s3_read s3://my-bucket/path/to/object.ext
```
技术同样适用于 API Gateway URLs、Lambda URLs、Data Exchange 数据集,甚至可以获取标签的值(如果知道标签键)。可以在 [**原始研究**](https://blog.plerion.com/conditional-love-for-aws-metadata-enumeration/) 和工具 [**conditional-love**](https://github.com/plerionhq/conditional-love/) 中找到更多信息,以自动化此利用。
这种技术同样适用于 API Gateway URLs、Lambda URLs、Data Exchange 数据集,甚至可以获取标签的值(如果知道标签键)。可以在 [**原始研究**](https://blog.plerion.com/conditional-love-for-aws-metadata-enumeration/) 和工具 [**conditional-love**](https://github.com/plerionhq/conditional-love/) 中找到更多信息,以自动化此利用。
### 确认一个桶属于 AWS 账户
如 [**这篇博客文章**](https://blog.plerion.com/things-you-wish-you-didnt-need-to-know-about-s3/) 中所述,**如果您有权限列出一个桶**可以通过发送下请求来确认桶所属的 accountID
如 [**这篇博客文章**](https://blog.plerion.com/things-you-wish-you-didnt-need-to-know-about-s3/) 中所述,**如果你有列出桶的权限**,可以通过发送类似以下请求来确认桶所属的 accountID
```bash
curl -X GET "[bucketname].amazonaws.com/" \
-H "x-amz-expected-bucket-owner: [correct-account-id]"