Let’s see an example of how it would work with N=3: The program starts consulting the first header of the central directory, “CD Header 1”, which redirects it to “Header 1”. Zip executes what is behind “Header 1”. You will find the header “Escape next 2 headers”, so the program writes in the output as are the headers “Header 2”, “Escape next header” and “Header 3”. Then it finds “Data 1” and decompresses it in the output. Then it goes to the next file, consulting the next header of the central directory, “CD Header 2”, which redirects it to “Header 2”. Zip executes what is behind, and finds the header “Escape next header” so it writes in the output header “Header N” and decompresses “Data 1”. To finish the program goes to the last header of the central directory, “CD Header N”, redirects it to the header “Header N” and decompresses in the output “Data 1”.
In this example there are 3 file headers of 31 bytes, 2 escape headers of 5 bytes, a file with the compressed data and 3 headers of the central directory of 1 byte. If we put a compressed file in “Data 1” of 1000 bytes, we have a total of 1106 bytes. That file will be full of zeros to get the maximum DEFLATE decompression rate, so when decompressed it becomes 1.032.000 bytes. When it is repeated 3 times, we have 3,096,000 bytes. Plus the escaped headers, make a total of 3,096,108 bytes from 1,106 bytes.
David Fifield has managed to optimize this to the point of achieving a quadratic decompression rate, with which a 42kB compressed file gives a 5.5GB file, and a 46MB file gives 4.5 PB.
You can download both the zip bombs and the source code of the program that generates them in David Fifield’s blog. But be careful, because nowadays it works and if you try to decompress it your computer will be blocked. In that blog you also have explained in more detail the whole process of construction and optimization of the zip bomb.
With this input I finish the series of zip bombs, after having shown the recursive bombs, the quine bombs and the superimposed bombs.
Lethani.
Be First to Comment