How does one make a Zip bomb?

前端 未结 14 1540
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-12 11:13

This question about zip bombs naturally led me to the Wikipedia page on the topic. The article mentions an example of a 45.1 kb zip file that decompresses to 1.3 exabytes.

14条回答
  •  情书的邮戳
    2020-12-12 11:41

    Below is for Windows:

    From the Security Focus proof of concept (NSFW!), it's a ZIP file with 16 folders, each with 16 folders, which goes on like so (42 is the zip file name):

    \42\lib 0\book 0\chapter 0\doc 0\0.dll
    ...
    \42\lib F\book F\chapter F\doc F\0.dll

    I'm probably wrong with this figure, but it produces 4^16 (4,294,967,296) directories. Because each directory needs allocation space of N bytes, it ends up being huge. The dll file at the end is 0 bytes.

    Unzipped the first directory alone \42\lib 0\book 0\chapter 0\doc 0\0.dll results in 4gb of allocation space.

提交回复
热议问题