前言
云厂商对象存储看了好多家了,上一篇文章介绍了天翼云对象存储ZOS,除了利用工具的可玩性,操作性来讲同前面几篇文章提到的对象存储差别不大,最近看了华为云的OBS,发现华为云在攻击利用的思路上相对来说较其它厂商还是有去别的,因为在配置存储对象的时候可操作性太大了。
介绍
OBS(Object Storage Service)是一种云存储服务,提供海量、安全、高可靠、低成本的数据存储能力。OBS支持HTTP/HTTPS协议的Web服务接口和SDK/API接口,用户可以方便地通过网页控制台或各种OBS工具管理和访问存储在OBS上的数据。
产品架构图

资源管理工具
华为云的OBS的资源管理工具和天翼云类似,可用性和可操作性还是比较高的。

桶创建
目前华为云存储无试用,OBS按照资源包计费

各厂商的计费价格基本上出入不大

上传文件

高级配置中可添加元数据字段

Bucket爆破
华为云的Bucket也是可以进行爆破的,不通状态下的返回包的数据长度不一致,爆破频率可很根据不同厂商的防护情况而定,一般意义不大

其命名规则为<BucketName>.obs.<Region>.myhuaweicloud.com
配置不当导
桶策略配置不当导致桶遍历
选择私有配置时

桶内文件无法被直接遍历。当配置桶为公有状态,桶内文件即可被下载。

桶策略配置不当导致信息泄露
重新上传txt文件,配置桶策略UserAgent=hwobs
即可访问
{
"Statement": [
{
"Sid": "键值对测试",
"Effect": "Allow",
"Principal": {
"ID": [
"*"
]
},
"Action": [
"GetObject",
"GetObjectVersion",
"GetObjectVersionAcl",
"GetObjectAcl",
"RestoreObject"
],
"Resource": [
"hweiobs/xss.txt"
],
"Condition": {
"StringEquals": {
"UserAgent": [
"hwobs"
]
}
}
}
]
}

当正常访问的时候状态码为403

构造请求包访问资源即可成功访问

- 配置不合理的桶动作
List*
,PUTObject
等

访问存储桶,发现对象已可以被遍历

构造请求包测试上传
PUT /xss1.txt HTTP/1.1
Host: hweiobs.obs.cn-east-3.myhuaweicloud.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Priority: u=1
Content-Length: 7
hwobs

文件上传成功,查看桶内文件也上传成功

这种风险最大的问题是
1、当上传的文件名称与桶内文件名一致的话,会导致文件内容被直接覆盖。
2、可对桶内上传任意具有风险的文件甚至恶意的应用等。
添加”元数据“

当通过链接访问设置了该元数据的对象时,会直接弹出一个对象下载的对话框,且对象名称会被修改为“testfile.html”。由于xss.txt
中的文件内容为
<script>alert(1)</script>
用户当访问存储对象后,双击文件打开即触发弹窗

AK/SK泄露
AK/SK泄露导致存储桶接管问题
华为云的密钥创建后也需保存


华为云厂商提供的工具OBS Browser+
https://support.huaweicloud.com/browsertg-obs/obs_03_1003.html

登录接管存储桶

AK/SK泄露导致华为云接管
创建用户,加入linshi
用户组

用户组授权管理,给予用户ECS和OBS的所有权限

使用工具接管华为云平台资源

成功接管云平台

有的情况下只能获取存储桶的权限的原因就是在用户创建密钥的时候用户或者用户组的权限不足。

防护手段
访问控制:OBS通过访问控制策略来限制对桶的访问权限,包括身份验证、授权策略和网络ACL等。您可以在控制台中管理这些权限并设置访问控制规则,以确保只有经过授权的用户才能够访问桶。
数据加密:OBS支持多种数据加密方式,包括服务端加密、客户端加密和传输加密等,可以有效保护数据的机密性和完整性。您可以在创建桶时启用加密功能,并设置相应的密钥和加密算法。
防篡改:OBS通过MD5校验值和ETag等机制来检测数据是否被篡改,还可以使用防篡改功能来保护对象的完整性。如果检测到数据被篡改,系统会自动拒绝操作并向管理员发送警报。
安全审计:OBS支持对桶和对象的操作进行审计记录,包括访问、上传、下载和删除等操作。您可以通过控制台或API查询审计日志并监控访问情况。