TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Defending a website with Zip bombs

631 pointsby ridgewellalmost 8 years ago

37 comments

colandermanalmost 8 years ago
I would think Transfer-Encoding would be a better choice than Content-Encoding. It&#x27;s processed at a lower level of the stack and <i>must</i> be decoded – Content-Encoding is generally only decoded if the client is specifically interested in whatever&#x27;s inside the payload. (Note that you don&#x27;t have to specify the large Content-Length in this case as it is implied by the transfer coding.)<p>Also worth trying is an XML bomb [1], though that&#x27;s higher up the stack.<p>Of course you can combine all three in one payload (since it&#x27;s more likely that lower levels of the stack implement streaming processing): gzip an XML bomb followed by a gigabyte of space characters, then gzip that followed by a gigabyte of NULs, then serve it up as application&#x2F;xml with both Content-Encoding and Transfer-Encoding: gzip.<p>(Actually now that I think of it, even though a terabyte of NULs compresses to 1 GiB [2], I bet <i>that</i> file is itself highly compressible, or could be made to be if it&#x27;s handcrafted. You could probably serve that up easily with a few MiB file using the above technique.)<p>EDIT: In fact a 100 GiB version of such a payload compresses down do ~160 KiB on the wire. (No, I won&#x27;t be sharing it as I&#x27;m pretty sure that such reverse-hacking is legally not much different than serving up malware, especially since black-hat crawlers are more likely than not running on compromised devices.)<p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Billion_laughs" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Billion_laughs</a><p>[2] <a href="https:&#x2F;&#x2F;superuser.com&#x2F;questions&#x2F;139253&#x2F;what-is-the-maximum-compression-ratio-of-gzip&#x2F;579290" rel="nofollow">https:&#x2F;&#x2F;superuser.com&#x2F;questions&#x2F;139253&#x2F;what-is-the-maximum-c...</a>
评论 #14709027 未加载
评论 #14708095 未加载
评论 #14709212 未加载
评论 #14710861 未加载
geek_atalmost 8 years ago
How come when I posted this (my blog post) here I only got 2 points? <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14704462" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14704462</a> :D
评论 #14708632 未加载
评论 #14708406 未加载
评论 #14709028 未加载
评论 #14709253 未加载
评论 #14708430 未加载
评论 #14709148 未加载
评论 #14709776 未加载
评论 #14708375 未加载
Scryptonitealmost 8 years ago
Reminds me of a time I once wrote a script in Node to send an endless stream of bytes at a slow &amp; steady pace to bots that were scanning for vulnerable endpoints. It would cause them to hang, preventing them from continuing on to their next scanning job, some remaining connected for as long as weeks.<p>I presume the ones that gave out sooner were manually stopped by whoever maintains them or they hit some sort of memory limit. Good times.
评论 #14708535 未加载
评论 #14709114 未加载
ruytlmalmost 8 years ago
Interesting and related re attacks on a Tor hidden service: <a href="http:&#x2F;&#x2F;www.hackerfactor.com&#x2F;blog&#x2F;index.php?&#x2F;archives&#x2F;762-Attacked-Over-Tor.html" rel="nofollow">http:&#x2F;&#x2F;www.hackerfactor.com&#x2F;blog&#x2F;index.php?&#x2F;archives&#x2F;762-Att...</a><p>And the follow up: <a href="http:&#x2F;&#x2F;www.hackerfactor.com&#x2F;blog&#x2F;index.php?&#x2F;archives&#x2F;763-The-Continuing-Tor-Attack.html" rel="nofollow">http:&#x2F;&#x2F;www.hackerfactor.com&#x2F;blog&#x2F;index.php?&#x2F;archives&#x2F;763-The...</a>
评论 #14711271 未加载
评论 #14708477 未加载
compguyalmost 8 years ago
Wait a minute... He is doing the exact same thing as the former RaaS (ransomware as a service) operator Jeiphoos (he operated Encryptor RaaS). It&#x27;s know that Jeiphoos is from Austria. Exactly one year after the shutdown of the service, someone from Austria is publishing the exactly same thing an Austrian ransomware operator were doing a year ago.
评论 #14708865 未加载
avaeralmost 8 years ago
Does anyone know if this kind of white hat stuff has been tested by law?<p>Because it seems in the realm of possibility that if a large botnet hits you and your responses crash a bunch of computers you could do serious time for trying it. I&#x27;m hoping there&#x27;s precedent against this...
评论 #14708044 未加载
评论 #14708428 未加载
评论 #14708029 未加载
评论 #14708040 未加载
matt_wulfeckalmost 8 years ago
This is why web crawlers are built with upper boundaries on <i>everything</i>!<p>Nobody malicious brings down crawlers. It&#x27;s just unexpected things you find out on the internet.
评论 #14709206 未加载
eyueltalmost 8 years ago
The article says that 42.zip compresses 4.5 petabytes down to 42 bytes. It should say 42 <i>kilobytes</i>.<p>I don&#x27;t see a way to comment on the article itself, but hopefully the author reads this.
评论 #14708329 未加载
评论 #14708351 未加载
TekMolalmost 8 years ago
I don&#x27;t think this &quot;Defends&quot; your website. If anything, it draws attention to it.<p>Might also be used for some kind of reflection attack. Want to kill some service that let&#x27;s users provide a url (for an avatar image or something) - point it to your zip bomber.
评论 #14709251 未加载
jacquesmalmost 8 years ago
A friend of mine has a very useful little service that tracks attempts to breach servers from all over the world:<p><a href="https:&#x2F;&#x2F;www.blockedservers.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.blockedservers.com&#x2F;</a><p>It&#x27;s a lot more effective to kill the connection rather than to start sending data if you&#x27;re faced with a large number of attempts.
评论 #14709850 未加载
cypherpunks01almost 8 years ago
This is like the soft equivalent of leaving a USBKill device in your backpack, to punish anyone who successfully steals it and tries to comb through your data.
评论 #14708956 未加载
bberenbergalmost 8 years ago
I think the natural next step is to make this into a Wordpress plugin.
hirsinalmost 8 years ago
This would be an entertaining way of dealing with MITM agents as well, over HTTP. As long as the client knows not to open the request, you could trade them back and forth with the MITM spy wasting tons of overhead.
评论 #14709129 未加载
petrealmost 8 years ago
Another method is wasting attackers&#x27; time by sending out a character per second or so. It works so well for spam, that OpenBSD includes such a <i>spamd</i> honeypot.
评论 #14708445 未加载
评论 #14708367 未加载
banku_broughamalmost 8 years ago
We need some legal advice in this thread.<p>What if the compressed file is plausibly valid content? How could intent be malicious if a request is served with actual content?
评论 #14708195 未加载
ajarmstalmost 8 years ago
Reminds me a bit of Upside-Down-Ternet: <a href="http:&#x2F;&#x2F;www.ex-parrot.com&#x2F;pete&#x2F;upside-down-ternet.html" rel="nofollow">http:&#x2F;&#x2F;www.ex-parrot.com&#x2F;pete&#x2F;upside-down-ternet.html</a>
em3rgent0rdralmost 8 years ago
Defending by throwing things back at the attacker, instead of simply locking your door.
评论 #14708084 未加载
评论 #14708081 未加载
评论 #14708949 未加载
Theizestookealmost 8 years ago
A great way... to provoke a war with people running botnets.
评论 #14709013 未加载
ianaialmost 8 years ago
This could also be seen as a bug on the browser side. I&#x27;d also be interested in the browser results for the petabyte version.<p>I wonder if there&#x27;s room to do this with other protocols? Ultimately we want to crash whatever tool the scriptkiddy uses.
评论 #14710017 未加载
ioquatixalmost 8 years ago
About a month ago one of my websites was being scraped. They were grabbing JSON data from a mapping system.<p>I replaced it with a GZIP bomb. It was very satisfying to watch the requests start slowing down, and eventually stop.
DamonHDalmost 8 years ago
Interesting!<p>That also crossed with another thought about pre-compressing (real!) content so that Apache can serve it gzipped entirely statically with sendfile() rather than using mod_deflate on the fly, so unless I&#x27;ve misunderstood I think that bot defences can be served entirely statically to minimise CPU demand. I don&#x27;t mind a non-checked-in gzip -v9 file of a few MB sitting there waiting...<p><a href="http:&#x2F;&#x2F;www.earth.org.uk&#x2F;note-on-site-technicals.html" rel="nofollow">http:&#x2F;&#x2F;www.earth.org.uk&#x2F;note-on-site-technicals.html</a>
merricksbalmost 8 years ago
Similar topic a couple of months ago:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14280084" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14280084</a>
dveeden2almost 8 years ago
Directly serving &#x2F;dev&#x2F;zero or &#x2F;dev&#x2F;urandom also gives interesting results. (Be aware of bandwidth costs)
评论 #14711400 未加载
Pitaroualmost 8 years ago
Wow, you killed Tails!<p>I tried visiting the payload site with Tails OS (a Linux distro for privacy minded) and the whole OS is frozen.
jscheelalmost 8 years ago
Both ZIP and GZIP file formats store the uncompressed filesize in their headers. You could stream and check for these headers to determine if the a zip bomb is being delivered. Obviously something script-kiddies aren&#x27;t going to do, but the scripts they use can be improved and redistributed fairly easily.
评论 #14711170 未加载
iopuyalmost 8 years ago
Was there a reduction in ip&#x27;s that Fail2ban would have picked up but instead were treated with the zip bomb?
brian-armstrongalmost 8 years ago
Do browsers protect against media served with Content- or Transfer-Encoding like this? If you use something that lets you embed images, what&#x27;s to stop you from crashing the browser of anyone who happens to visit the page your &quot;image&quot; is on?
评论 #14708838 未加载
评论 #14709662 未加载
wooptooalmost 8 years ago
A similar `slow bomb` could be created for attempted ssh connections to a host using a sshrc script. For example clients which do not present a key, just keep them connected and feed them garbage from time to time. Or rickroll them.
oceanbreeze83almost 8 years ago
doesn&#x27;t this incur large bandwidth data charges for the defender?
评论 #14708122 未加载
ilurkedherealmost 8 years ago
Wouldn&#x27;t all but the most naive scanners use time-out settings, maximum lengths on bytes read etc?
评论 #14713346 未加载
评论 #14711489 未加载
glenscott1almost 8 years ago
What are good strategies for protecting your website against ZIP bomb file uploads?
justusthanealmost 8 years ago
Ironically, it looks like the site has been DOSd by HN.
a1exusalmost 8 years ago
you better have unlimited bandwidth to try 10G))
评论 #14711597 未加载
late2partalmost 8 years ago
brilliant
vacrialmost 8 years ago
Interesting, on FF54 the test link pegs a CPU but the memory doesn&#x27;t rise. Eventually it stops and CPU returns to normal. But then I did a &#x27;view source&#x27;, and the memory use rose until the browser got oomkilled (20GB free ram + swap)
评论 #14709633 未加载
aluhutalmost 8 years ago
* Firefox: Memory rises up to 6-7gig, then just loads endlessly. Tab closable.
futang44almost 8 years ago
Just tried it using piedpiper&#x27;s middle-out algorithm and seeing astonishing results. It&#x27;s so simple! D2F.1 = D2F.2, D2F.3 = D2F.4