Live data from Hacker News

A better zip bomb

bamsoftware.com

61–70 of 138 posts

Re: A better zip bomb

#61
post #46
post #15

Earlier quoted context omitted.

Why would Chrome automatically begin unzipping the file? I'm afraid to even download it now...

I accidentally downloaded it without realising this. I'd assume it performs malware scanning. Luckily I was able to end the process from the chrome task manager (shift+escape) without disrupting the rest of the browser.

TIL chrome has a task manager. Thanks for posting the shortcut! +1

Re: A better zip bomb

#62
post #38

Earlier quoted context omitted.

This file exploits the zip container format, not the actual compression algorithm. SSH only uses the latter, not the former, so it is not applicable.

Would it be possible to do it just exploiting the algorithm?

You can make some limited deflate bombs, but they are nowhere near as massive as this one.

Re: A better zip bomb

#63

Earlier quoted context omitted.

> 1. You put it in a URL marked as "noindex-nofollow". Better yet, mark it Disallow in robots.txt - to see "noindex, nofollow", they'd still need to request the URL, running the risk to be served with the bomb. > 2. You create an exception so that they never cache the page and don't proxy this exact URL. They work as reverse proxies on host-basis, I don't think you can exclude a single URL. CF at least will never cac…

I put, as a test and for fun, a "Disallow" entry in my robots.txt (with a campy name to be honest) and not a single crawler hit that dir in more than three years, don't know if others had the same experience.

I was suggesting Disallow to make sure Google doesn't request it ;) I don't know if any bots look at robots.txt to see potentially interesting URLs. I do when I take a better look at sites, but I usually don't qualify as a bot.

My experience is that most bots just hit the usual suspects, /wp-login.php, /phpmyadmin/ etc, regardless whether they are in robots.txt or not.

Re: A better zip bomb

#64
post #60

Earlier quoted context omitted.

You don't. Though to Apple's credit, users who are concerned with verifying checksums probably overlap with those that take cursory steps to harden their browser by, among various steps, disallowing Safari to open "safe" documents (that's what they're called in Safari's option).

Would it be prejudice to think that the checksum verifying users are not using safari?

Yes. Chrome is surveillance-ware now. I’d rather use Safari or Firefox than Chrome.

Re: A better zip bomb

#65

Are you able to theoretically look at compressed data without size Metadata and estimate its final size without actually uncompressing it?

At worst you can just run the decompression algorithm while piping the output into the void, only counting the length. If you want to be slightly more efficient you can probably write an optimized stream parser for the compressor's format and sum up the lengths of dictionary/literals/back-references while skipping any other processing, but that depends on how amenable to fast-forwarding the stream format is.

If the goal is to avoid zip bombs you can't get any more sloppy than that because then an attacker could exploit inaccuracies in your estimator.

Re: A better zip bomb

#67
I recently created a zip validator and decoder for scanning email attachments, @ronomon/zip.

It's not yet open-sourced but it has defenses against excessive compression ratios, mismatching local and central directory headers, ambiguous filenames, directory traversals and symlink traversals, and anything ambiguous that could exploit differences in zip implementations, e.g. some zip implementations decode from the front while others decode from the back. Most importantly, it balks at deviations from the zip format, including any kind of overlapping or sparseness, buffer bleeds etc.

At least it detected all three of the author's samples as malicious.

Re: A better zip bomb

#68
I remember being so excited when the zip format came out. Prior to zip, we suffered with the arc format. At 2400 baud, the difference in compression was very very significant.

Re: A better zip bomb

#69
post #52
post #36

Earlier quoted context omitted.

If windows defender breaks scanning when it encounters a zip bomb, could that be used to mask malware later in the file?

It probably flags it as unsafe and triggers smart screen. Meaning you have to go out of your way to use the file. As for malware that would be unzipped when using an external zip file; first you would need to trigger the zip bomb on defender but not the external tool, and second defender will still scan the individual files getting unziped by that tool.

Maybe do a self extractor that's specially crafted to ignore the zip-bomb part and only extract the malware part? Then the self extractor can execute the malicious code after extracting to memory.

Re: A better zip bomb

#70
post #68

I remember being so excited when the zip format came out. Prior to zip, we suffered with the arc format. At 2400 baud, the difference in compression was very very significant.

I always preferred ARJ; I remember it having both better compression and more useful options than ZIP.
Post reply on HN