7 ms·
The AWS S3 Denial of Wallet Amplification Attack
- andersa 3y ago> Potential remedies - Stop using S3 and other AWS (perhaps it stands for Amazon Web Scams?) things already and switch to Cloudflare R2...
- vuln 3y agoCIAWS
- voidwtf 3y agoThe way billing is calculated should be clearly labeled along with the pricing. Azure does this too, it's super unclear what metric they're using to determine what will be billed for requests. We're having to find out via trial and error. If we request 0-2GB on a 6GB file, but the client cancels after 400MB. Are we paying 2GB or 400MB or 6GB? Is there a billed difference between Range: 0-, no "Range" header, and Range: 0-1GB if the client downloads 400MB in each scenario?
- __roland__ 3y agoSorry for not having this made clearer (we'll fix this part of the post): the gotcha is not that AWS does not honor range requests, it's that canceling those will still add the full range of bytes to your egress bill (and this can add up quickly) although no bytes (or much fewer) have been transferred.
- alchemist1e9 3y agoOn the other hand you did ask for them so what does it mean “canceling”? Just playing devil’s advocate that they did likely start getting the data for you and that takes resources. Otherwise they would be open to a DOS attack that initiates many requests and then cancels them.
- __roland__ 3y agoSure, that's true. The thing is: this was the same requested (and cancelled) range on the same file(s), over and over (it was a bug). Looking at this from the outside, even some internal S3 caching should have had many cache hits and not have to re-download the requested ranges internally all the time (there were dozens of identical requests per second, immediately being cancelled). On top of this, S3 already bills (separately) for any request against a bucket (see the other current issue with the invalid PUT requests against a secured bucket, which still got billed to the bucket owner; https://news.ycombinator.com/item?id=40203126 https://news.ycombinator.com/item?id=40203126). So I'd say both the requests and the cancellations were already paid for; the surprise was the 'egress' cost on top, of data that was not actually leaving the AWS network. Still, you are right that this still consumes some additional AWS resources, and it is probably a non-trivial issue to fix in the 'billing system'.
- deleted 3y ago[deleted]
- CharlesW 3y ago"Thank you to everyone who brought this article to our attention. We agree that customers should not have to pay for unauthorized requests that they did not initiate. We’ll have more to share on exactly how we’ll help prevent these charges shortly." — Jeff Barr, Chief Evangelist, Amazon Web Services https://twitter.com/jeffbarr/status/1785386554372042890 https://twitter.com/jeffbarr/status/1785386554372042890
- wmf 3y agoNote that there are two separate issues being discussed.
- gnabgib 3y agoDon't think that's the same problem - that's about the failed puts still costing a dev money [0](272 points, 2 days ago, 99 comments). [0]: https://news.ycombinator.com/item?id=40203126 https://news.ycombinator.com/item?id=40203126
- wmf 3y ago"With range requests, the client can request to retrieve a part of a file, but not the entire file. ... Due to the way AWS calculates egress costs the transfer of the entire file is billed." WTF if true.
- fabian2k 3y agoThat sounds egregious enough that I have trouble believing this can be correct. My understanding is that AWS bills for egress for every service, parts of the file that aren't transferred are not part of this so can't be billed. There could certainly be S3-specific charges that affect cases like this, no idea. But if AWS bills the full egress traffic costs for a range request I'd consider that essentially fraud.
- belter 3y agohttps://github.com/ZJONSSON/node-unzipper/issues/308 https://github.com/ZJONSSON/node-unzipper/issues/308
- paulddraper 3y agotl;dr AWS user believes that testing on a 1Gbps connection for 45 min can't be more than $10 of egress. Gets a $500 bill instead. Note: This user specified a lower range but not an upper range on the request (and closed the connection prematurely). Essentially read() with an offset, for a ZIP tool. See also: https://news.ycombinator.com/item?id=40205213 https://news.ycombinator.com/item?id=40205213
- yonixwm 3y agoSo I guess the attack of the OP is a case AWS calculate price based on the unbounded request header and not on the actual egress
- scottlamb 3y agoMore or less. The article quotes AWS as saying the following: > Amazon S3 attempts to stop the streaming of data, but it does not happen instantaneously. ...which doesn't really explain it. It shouldn't send more than a TCP window after the connection is closed, and TCP windows are at most 1 GiB [1], usually much less, so this completely fails to explain the article's observed 3 TB sent vs 130 TB billed. The article goes on to say: > Okay, this is half the explanation. AWS customers are not billed for the data actually transferred to the Internet but instead for some amount of data that is cached internally. In other words, how much they bill really isn't bounded by how much is sent at all. This is unacceptable. [1] https://en.wikipedia.org/wiki/TCP_window_scale_option https://en.wikipedia.org/wiki/TCP_window_scale_option
- belter 3y agohttps://news.ycombinator.com/item?id=40203126 https://news.ycombinator.com/item?id=40203126 https://news.ycombinator.com/item?id=40221108 https://news.ycombinator.com/item?id=40221108
- itsdrewmiller 3y agoThose are about a different issue - not a great time for S3 billing!
- belter 3y agoCorrect. Its a like a game of negative chess. Wins who racks the biggest bill, in the shortest amount of time, with the least amount of activity :-)
- andrewstuart 3y agoWhy is anyone using S3 when Cloudflare R2 is free?
- ezekiel68 3y agoBecause of "The Rise of Worse is Better" (search it) and because a 900-lb industry gorilla is never displaced quickly or easily.
- surfingdino 3y agoBecause of the other AWS services you get access to.
- zedpm 3y agoLots of reasons. My company started using AWS (and specifically S3) something like 9 years ago; R2 wasn't even on the radar back then. If I were starting from scratch today, I'd be looking seriously at Cloudflare as a platform, but it's only in the last year or two that they've offered these services that would make it possible to build substantial applications.
- waiwai933 3y agoR2 bandwidth is free, but storage is not. R2 also doesn't have all the features that S3 does - including an equivalent of S3 Glacier, which is cheaper storage than R2. R2 also doesn't have object tagging, object-level permissions, or object locking. Sure, you could build your own layer in front of R2 that gives you these features, but are you necessarily saving money over just using S3?
- fragmede 3y agoinertia, mostly. If you're already using AWS and have your system set up, adding a new vendor is going to be a lot of extra work compared to just using what's available.
- flockonus 3y agoNot necessarily R2, but Cloudflare mostly has free egress, so one could put it in front of a public bucket. As others mentioned, it still lack many features if compared to S3.
- bearjaws 3y agoHate that it's essentially half ChatGPT generated. Especially given the huge explanation of AWS.
- tills13 3y agoA "AI Generated" label would be nice, here.
- anon373839 3y agoThese AI accusations are becoming a tired trope. What, exactly, about the article gives you the impression that it was generated by an LLM?
- bakugo 3y agoIf writers don't want people to think their content is AI generated, maybe they shouldn't put ugly AI generated images on top of everything they write.
- anon373839 3y agoAh, so it’s the illustrations?
- flockonus 3y agoAI-fobic
- __roland__ 3y agoI can assure you this was not AI-generated, apart from the 'symbolic image' (which should be fairly obvious :). Maybe that's just our non-native English shining through. In any case, as a small European company in the healthcare space, we are quite used to having to explain "the cloud" (with all potential and pitfalls) to our customers. They are also (part of) the target audience for this post, hence the additional explanations. (Not OP and not author of the article, but was involved in the write-up.)
- bennettnate5 3y ago"Denial of Wallet" seems a misnomer--it makes it sound like source of payment is being blocked. They should really use the same term cellular systems have been for decades to describe this kind of threat, namely an "overbilling attack".
- KomoD 3y ago"Denial of Wallet" has been used in countless articles (incl. academic) and places to refer to attacks that increase usage bills.
- akira2501 3y agoWe use CloudFront and we deny public users the ability to access S3 directly. You can even use Signed URLs with CloudFront if you like. I'm not sure I'd evere feel comfortable letting the public at large hit my S3 endpoints.
- INTPenis 3y agoAs it should be, but recently on HN it was posted that AWS will charge you for any unauthorized PUT request to your S3 buckets. Meaning even 4xx errors will rack up a charge. So your S3 bucket names must be hidden passphrases now that stand between an attacker and your budget.
- nijave 3y agoIn all fairness, systems administrators have always had to pay for unauthorized requests and systems to mitigate the risk The new thing is hyperscalers have so much capacity you can get flooded by these long before the service degrades or goes offline
- kazen44 3y agoAlso, the cost of doing this per request is insane compared to either absorbing or rate-limiting the bandwith the requests take. Cloud computing charges you by the request/byte/cpu cycle. Servers do not have this issue. Also, is it simply not possible to rate limit this on a per IP basis? Make client only able to do X requests per second from each unique IP/network flow.
- nijave 3y ago>Cloud computing charges you by the request/byte/cpu cycle. Servers do not have this issue. Sure they do. Processing requests takes bandwidth, CPU, memory, disk I/O >Also, is it simply not possible to rate limit this on a per IP basis It's largely useless. You'll block any legitimate bits/programs, people on CGNAT, people on corporate networks & bad actors will use botnets, residential IPs, VPNs to gain access to thousands or millions of unique IPs
- Havoc 3y agoIt's almost like the combination of public accessible + charged per use + big cloud refusing to allow hardcaps on spend is a terrible idea...
- jsheard 3y agoAzure is probably the most egregious example of this, AWS and GCP can at least claim they have architectural barriers to implementing a hard spending cap, but Azure already has one and arbitrarily only allows certain subscription types to use it. If you have a student account then you get a certain amount of credit each month and if you over-spend it then most services are automatically suspended until the next month, unless you explicitly opt-out of the spending limit and commit to paying the excess out of pocket. However if you have a standard account you're not allowed to set a spending limit for, uh... reasons. https://learn.microsoft.com/en-us/azure/cost-management-billing/manage/spending-limit https://learn.microsoft.com/en-us/azure/cost-management-bill...
- anonymousDan 3y agoAWS Educate has the same ability to impose a hard cap I believe...
- carbotaniuman 3y agoI guess it's a matter of students don't have money to spend and bad optics, while a company might be cowed into paying the bill.
- dylan604 3y agoThat's insane as well. They already built the system, but you just can't use it because we want the option for you to screw up and pad our billing. There are many projects I've worked on where a service not being available until the 1st of the next month would not be anything more than a minor annoyance, and would much rather that happen than an unexpected bill. This is also something that I think would be a nice CYA tool when developing something in the cloud for the first time. It's easy to make a mistake when learning cloud services that could be expensive like TFA shows.
- tomp 3y agohow about the "PUT deny" attack? AFAIK cannot be protected against https://twitter.com/Lauramaywendel/status/1785064878643843085 https://twitter.com/Lauramaywendel/status/178506487864384308...
- zedpm 3y agoJeff Barr posted that AWS is actively working on a resolution for this: https://twitter.com/jeffbarr/status/1785386554372042890 https://twitter.com/jeffbarr/status/1785386554372042890 . Given who he is, I take this as a strong indication that there will be a reasonable fix in the near future.
- lulznews 3y agoDoes this apply to Cloudfront requests also?
- belter 3y agoWould seem to me that is also a Yes!... CloudFront charges for all requests, so a 404 Not Found, will be counted towards the total number of requests, and you will be billed accordingly. Hopefully somebody will prove me wrong :-)
- KomoD 3y agoSo much fluff, just get to the point. At least 500-600 words weren't needed and just added noise to the article, making it harder to read.
- surfingdino 3y agoAWS APIs need a cleanup. I am constantly running into issues not documented in the official doc, boto3 docs, or even on StackOverflow. It's not even funny when a whole day goes by on trying to figure out why I see nothing in the body of a 200 OK response when I request data which I know is there in the bowels of AWS. Then it turns out that one param doesn't allow values below a certain number, even though the docs say otherwise.
- Twirrim 3y agoHistorically, they've been scared of versioning their APIs (not many services have done it, dynamodb has, for example). It leads to a "bad customer experience", having to update lots of code, and also increases maintenance costs while you keep two separate code paths functional. There's a lot about the S3 API that would be changed, including the response codes etc., if S3 engineers had freedom to change it! I remember many conversations on the topic when I worked alongside them in AWS.
- andrewxdiamond 3y agoIt’s quite insane the levels of effort S3 engineers put in to maintain perfect API compatibility. Even tiny details such as whitespace or ordering have messed up project timelines and blocked important launches.
- Twirrim 3y agoAll meeting some random arbitrary, maybe not even conscious, decision made by an early S3 engineer when they were implementing something.
- deleted 3y ago[deleted]
- adverbly 3y agoSounds like they were using the Range header on large files. I have made systems in the past using exactly this pattern(without the intentionally dropped requests). I hope this doesn't result in any significant changes as I really liked using this pattern for sequential data processing of potentially large blobs.
- ignoreusernames 3y agoEarly Athena (managed prestodb by AWS) had a similar bug when measuring colunar file scans. If it touched the file, it considered the whole file instead of just the column chunks read. If I’m not mistaken, this was a bug on presto itself, but it was a simple patch that landed on upstream a long time before we did the tests. This was the first and only time we considered using a relatively early AWS product. It was so bad that our half assed self deployed version outperformed Athena by every metric that we cared about
- jpambrun 3y agoI had the exact same thing happen to me last Friday. My ISP metered 300GB, AWS measured 6,000GB. A factor of 20. I don't think this is reasonable. https://news.ycombinator.com/item?id=40203126#40205213 https://news.ycombinator.com/item?id=40203126#40205213 https://github.com/ZJONSSON/node-unzipper/issues/308 https://github.com/ZJONSSON/node-unzipper/issues/308
- martin-lim 3y agoThat could be the same root cause. You download data via range request but with no upper bound and AWS is billing you for very much more than you downloaded in reality.