One thing that the other answers don’t indicate well is how you can compress so much material into a small file. It has to do with the nature of how file compression works.
Imagine I had a 1 GB text file, but every character in the file was just the number “1.” In a compressed file, this might be compressed by simply giving the instruction, “‘1’x1GB”. And so a very tiny compressed file (7 characters in my fake example) could be turned into a gigantic file on the other end (~1 billion characters).
When your computer opens a ZIP file, it follows a set of rules according to what the file says it has inside of it. A ZIP bomb is a ZIP file with rules that are intentionally malicious. It’s basically a little file that says, “spend all of your time and energy and memory writing out meaningless junk.” (And in this case it has to be meaningless, if the compression ratio is going to be that high. The reason that ZIP files can only compress “real” data only so much is because real data has structure and variance most of the time, and so there’s only so much you can do to reduce that to instructions like this, which generally focus on repeated sets of characters.)
For an ELI5 analogy, imagine I have someone who types up my notes for me. Except I don’t have to just give them my notes; I can put instructions on the notes. So I send them a tiny Post-It note, but it says, “write the number 1 a trillion times.” In real life, the person would probably laugh and/or quit the job, but your computer doesn’t have that option — unless its programmers anticipated this problem (which some modern archive programs might), it will just dumbly follow the instructions in the file, even if it is ruinous for the overall machine’s performance.
Latest Answers