You can do this with nginx using the built-in gzip_static module.
If you want to protect /blah.txt, create the empty file blah.txt and store your zip bomb as blah.txt.gz. Make sure to add "text/plain" to gzip_types, so that nginx knows to serve the compressed version.
It’s not built by default. There is really no need for it in this situation, though — you can just basically send the gz files by themselves for certain locations, maybe modifying some headers slightly to explicitly indicate the encoding.
Not really a fan of this idea. This article isn’t so much about “defending” your website as it is about attacking anyone who scans it. Vulnerability scanners are often run from servers that are themselves compromised, so retaliatory attacks like this can further victimize people who have already been owned :(
Still pretty neat on a technical level though.
Many people are not even aware that they’ve been compromised… At least that helps in a way!
Just because you’re being attacked from compromised server, doesn’t mean that you’re not being attacked.
Opened this in firefox, memory usage shot up to 5GB used then it slowly went down before the OS asked me if I wanted to kill firefox
…so just another day using a web browser? :-)
It’s kind of amazing that the browser vendors haven’t considered it an attack vector. Why would anyone legitimately need to view a 4GB non-video file in a browser window?! That’s not really how WWW works.
I am pretty sure WWW wasn’t designed for 10+ MB pages either.
However, I’ve opened rather big “pages” already. Especially when they are some for of very long lists.
https://github.com/cjdelisle/big_download same thing except the gzip data is generated on the fly with ~no CPU usage. nodejs/express app.
I’ve been running SSH on multiple servers with non-standard ports for years. Yet, I rarely, if ever, get failed login attempts. Is this really a thing?
Worked for me for a long time, but they’ve found me now :’(
This is not defense, this is very poor offense.
Just tested brotli: 100MB becomes 1341 bytes :D Now let’s hope the skiddies can deal with compression: br