News for hackers. Stuff that matters.
Re:Issues with Cloudflare Images by AtNightWeCode on Tuesday December 07, 2021 @12:33PM (#29475537)
"5. Lack of dynamic resizing, only 20 “variants” allowed"

Best practice when it comes to images on the web is to use a fixed number of sizes. Why they limited it to 20 I do not know though. You should never allow dynamic image resizing since it is commonly used in various attacks.

Re:Issues with Cloudflare Images by danielskogly on Tuesday December 07, 2021 @12:45PM (#29475721)
Cloudflare is industry leading when it comes to facing those kinds of attacks, though, and it's supported in the "Cloudflare Image Resizing" [0] product.

Also, using a fixed number of sizes might be best practice when it comes to a website you have full control over, and can plan the content for. When it comes to user-generated content, where you want to give the user the opportunity to select a custom crop for an image, you don't necessarily have that kind of control.

The alternative we considered was doing the crop on the client before uploading the image, but that ensures loss of information, and makes it impossible for the user to edit their selection at a future time without re-uploading the image.

[0]: https://developers.cloudflare.com/images/image-resizing

Re:Issues with Cloudflare Images by LukeLambert on Tuesday December 07, 2021 @12:40PM (#29475655)
That’s why many image CDNs allow signed URLs. With Cloudflare Image Resizing, you’d need to implement that functionality using Workers.
Re:Issues with Cloudflare Images by manigandham on Wednesday December 08, 2021 @06:54AM (#29483691)
All major file/image upload services use signed URLs to prevent this. It's a minor abuse vector and not much of an issue.

Cloudflare started as DDOS protection and should add similar features rather than limit functionality.

Re:Issues with Cloudflare Images by Aeolun on Tuesday December 07, 2021 @07:36PM (#29480036)
> Best practice when it comes to images on the web is to use a fixed number of sizes.

What is the idea behind this? It doesn’t seem to add anything other than to leverage caching a bit better.

Re:Issues with Cloudflare Images by ryan_lane on Tuesday December 07, 2021 @09:22PM (#29480610)
It's a common DoS vector. If you limit the allowed sizes, you can predict your min/max for compute, storage, cache, networking, etc. If you allow arbitrary resizing, the client can iterate indefinitely, doing things like "give me 1x1, now 1x2, now 2x2", which will tie up your compute resources, eat up storage, push legitimate data out of your cache, etc.
Re:Issues with Cloudflare Images by jrochkind1 on Tuesday December 07, 2021 @01:10PM (#29476037)
> You should never allow dynamic image resizing since it is commonly used in various attacks.

Can you say or link to more? I'm not following this. Like... attacks... on Cloudflare?

Re:Issues with Cloudflare Images by afavour on Tuesday December 07, 2021 @02:04PM (#29476784)
Resizing an image is computationally intensive (at least compared to the average HTTP request). You can sidestep that by using caching: resize once, then serve the cached version from then on.

Dynamic resizing opens you up to a DDOS attack, essentially: someone would request the image at 1x1, and 1x2, and 1x3... you get the idea. But yeah, if there was anyone able to mitigate that risk via other means you'd think it would be Cloudflare.

Re:Issues with Cloudflare Images by AtNightWeCode on Tuesday December 07, 2021 @01:40PM (#29476456)
I worked with sites that had performance issues because of attacks against dynamic image scaling in Cloudflare (scaling probably done with workers). Services like Cloudflare does not in general protect against service design issues. I try to explain that to people all the time. I also worked with another provider where a monthly bill got 5 times higher one month because images were requested at many different large sizes.
Re:Issues with Cloudflare Images by rhizome on Tuesday December 07, 2021 @02:06PM (#29476810)
Yeah, I've come across sites that allow arbitrary resizing via dimension numbers in the URL. Seems like it would be easy to CPU ddos by submitting random numbers in those fields.
Re:Issues with Cloudflare Images by magicalhippo on Tuesday December 07, 2021 @05:22PM (#29478974)
And it's fairly easy to "snap" to the nearest available size variant. That way one can add cached variants after-the-fact.
Re:Issues with Cloudflare Images by Aeolun on Tuesday December 07, 2021 @07:38PM (#29480050)
You could do the same by requesting any dynamic page many times.

Adding a rate limit to image resizing is no harder than adding it to any other URL.

Re:Issues with Cloudflare Images by jrochkind1 on Tuesday December 07, 2021 @03:56PM (#29478112)
Huh. I don't understand how this would effect a site using Cloudflare Images. It seems like maybe a DDOS against Cloudflare itself, but I don't see how it would be a problem for your site. But you say it was, so.

But okay, thanks for providing more context. I have not used Cloudflare Images at all, so I don't really know, just trying to make sense of it.