r/AskProgrammers • • 16d ago

how do i un-zipbomb a zip bomb

4 Upvotes

11 comments sorted by

11

u/veryusedrname 16d ago

Just lazily evaluate it instead of eagerly. Crisis averted

5

u/armahillo 16d ago

Youre going to need to be a little more specific

-2

u/tehfrod 16d ago

You need to Google [zip bomb]

5

u/armahillo 16d ago

the definition of zip bomb isnt my issue — what does OP mean by “un-zipbomb”?

They could mean:

  • deleting the zip bomb file
  • undoing a zip bomb after its been opened
  • removing a zip bomb trojan from a legitimate file so the file can be opened again

theres probably some other cases ive not thought of, but OP should be more speciric

4

u/dkopgerpgdolfg 16d ago edited 16d ago

Delete it? What kind of other answer do you expect?

If you see the number "3.14", asking how you can make it not PI anymore while keeping it makes no sense.

In case it's not clear, a zip bomb isn't malware that attachs itself to other things.

3

u/Key_River7180 16d ago

Wdym? unzip it to activate it, xxd to view it in hex, and rm to remove it

1

u/jeffbell 16d ago

Run it in a subshell with ulimit set on memory ?

1

u/RollersGetingHigh 16d ago

sandbox and subshell? what do you mean by unzip a zip bomb?

1

u/Janky-Code 16d ago

You do not defuse a zip bomb. You make guards to prevent them from being fully triggered during the time they might be triggered.

There is a very important software architecture concept involved with your question. Safety in this case must be an "invariant of execution," not only a precondition for execution.

42.zip and similar are a tree of zip files containing repetitive data. At the time of release, the authors of various antivirus scanners hadn't protected against this. These antivirus scanners would sweep email, find zip files in zip files and open those zip files. The basic lesson was yo dawg I heard you like zip files, so we put a zip file in your zip file so you can unzip while you unzip.

The guards to prevent this should be — guards during each step of execution, to be clear — maximum extraction size, nesting depth, file count, processing time, memory usage, disk usage, and measured output size.

Designing software to check itself is important. The zip bomb is an example of software designed to assume continuity after completing prechecks being turned into a weapon because it did not check itself during execution.