First off, make a website defend mode that can be triggered to serve different content. Then, do the following: 1. Add a robots.txt, make it look like it's wordpress (Disallow: /wp-admin etc) 2. If any client requests /wp-admin, flag their IP ASN as bot. 3. If a client is a bot, send it a gzip bomb (100kB size, unpacked around 20GB), use Transfer-Encoding: gzip and Content-Encoding: gzip to also punish malicious web…
> gzip bomb (100kB size, unpacked around 20GB) Not possible (unless you're talking double gzip). gzip's max compression ratio is 1032:1[1]. So 100kB can expand to at most ~103MB with single gzip. Brotli allows much larger compression. Here's[2] a brotli bomb I created that's 81MB compressed and 100TB uncompressed. That's a 1.2M:1 compression ratio. [1] https://stackoverflow.com/a/16794960 [2] https://github.com/googl…
> Not possible (unless you're talking double gzip). gzip's max compression ratio is 1032:1[1]. So 100kB can expand to at most ~103MB with single gzip.
Not sure if I understand the rest of your argument though. If the critique is that it's not possible and that I'm lying(?) about the unpacked file size on the proxy side, then below you'll find the answer from my pentester's perspective. Note that the goal is not to have a valid gzip archive, the goal is to have an as big as possible gzip archive _while unpacking_ and before the integrity and alignment checks.
In order to understand how gzip's longest match algorithm works, I recommend to read that specific method first (grep for "longest_match(IPos cur_match)" in case it changes in the future): https://git.savannah.gnu.org/cgit/gzip.git/tree/deflate.c#37...
The beauty of C code that "cleverly" uses pointers and scan windows with offsets is that there's always a technique to exploit it.
I'll leave that for the reader to understand how the scan condition for unaligned windows can be modified so that the "good_match" and "MAX_MATCH" conditions are avoided, which, in return, leads to bigger chains than the 258 / 4096 bytes the linked StackOverflow answer was talking about :)