我理解有问题还是 backblaze 的对象存储就有这种漏洞?

2021-06-20 08:53:28 +08:00
 stimw

之前看到 v 友讨论腾讯 cos 防刷,有人提到:

事实上如果找到你 COS 桶源站域名,就算你每个请求都鉴权,攻击者也可以靠刷请求次数让你破产~(无效请求也要计费)

看后虎躯一震,想到一直在用 backblaze 的对象存储服务完全可以被别人推出桶源站域名( S3 URL)...

具体情况如下:

背景

我目前是 backblaze 搭配 cloudflare 使用,使用他们的"friendly URL"套 cf 可以减免回源流量费。

官方套 cf 文档: https://help.backblaze.com/hc/en-us/articles/217666928-Using-Backblaze-B2-with-the-Cloudflare-CDN

槽点

简单解释一下,

Friendly URL 示例: https://f000.backblazeb2.com/file/my-bucket-name/image-name

也就是说,套上 cf 后,访问地址就变成了: https://我的二级域名 /file/存储桶名 /图片名

然后它的 S3 URL 是这样的: https://存储桶名.s3.us-west-000.backblazeb2.com/图片名

那么问题来了,其他人只要根据 cdn 访问地址,就可以知道我的存储桶名,然后轻易地推出 S3 URL 。

然后就如 v 友所说。。

事实上如果找到你 COS 桶源站域名,就算你每个请求都鉴权,攻击者也可以靠刷请求次数让你破产~(无效请求也要计费)

官方第一次回应

Hello there,

Thank you for taking the time to write in,

The only vulnerability that may occur is if a malicious user would download your files many times to incur a large download bill on your part, but just knowing the public URLs of the files does not grant access or the ability to upload or delete files from a public bucket. If the bucket is private no downloads, inquires or other type of access can occur unless they have a valid app key and keyID to that bucket, which would be impossible to retrieve from your website.

Let me know if you have any other questions.

Regards,

Bob The Backblaze Team

可能我表达出了问题,他没有理解我的意思,还是确实他们的无效请求不计费?

我现在再问的话,因为有时差,应该明天才能回复我了。

本来就对这个不太懂,有没有 v 友可以指导下...

5100 次点击
所在节点    程序员
24 条回复
stimw
2021-06-20 21:31:55 +08:00
@lostberryzz
@boboliu
@xiaoz
@lqf96

本来 rewrite 成功了,但是

根据 https://help.backblaze.com/hc/en-us/articles/360010017893-How-to-allow-Cloudflare-to-fetch-content-from-a-Backblaze-B2-private-bucket

把 bucket 设置了 private 并且授权后,rewrite 的 URL 就报 404 了,但是加上 /file/bucketname/可以正常访问

'''
{
"code": "not_found",
"message": "File with such name does not exist.",
"status": 404
}
'''
AaronLee
2021-06-21 18:08:29 +08:00
@boboliu @lostberryzz 怎么做到修改 URL,有没有具体文档?
keyword233
2021-06-22 00:49:43 +08:00
看邮件 b2 应该是按成功请求收取费用,不过你可以实验一下。
GetObject 算是 B 类请求,每天前 2500 次免费,然后每 10000 次 4 美分,刷个 13000 次看看扣不扣费就行了。
(我想其实应该没几个闲人见谁打谁吧?也不必太惊慌 :)
另外 @lqf96 提到的 transform rules 应该能解决问题,报错的话再看看 cf 的文档吧
allworldg
2022-05-24 11:41:23 +08:00
我也问了一下 b2 官方客服,他是这么回复我的:

Thank you for contacting us. To go beyond the download cap on the free plan, you would need to put in billing information onto the account or you would have to wait till tomorrow to resume your downloads. We will not close the bucket. Since you are worried about large requests you can add caps to your account to stop any downloads after a certain dollar amount: https://help.backblaze.com/hc/en-us/articles/217931138-How-to-use-B2-data-caps-alerts

如果直接刷完了源桶免费额度,应该是直接禁止访问直到第二天免费额度复原。或者绑定信用卡并且设置每天额度。它不会导致达到额度只发警告然后无限扣费(个人没主动试过)。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/784561

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX