Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: wordsmithing

...

There are a number of security concerns when extracting file entries from a ZIP file using java.util.zip.ZipInputStream.  File names may contain path traversal information so that they are that may cause them to be extracted outside of the intended directory, frequently with the purpose of overwriting existing system files.  Directory traversal or path equivalence vulnerabilities can be eliminated by canonicalizing the path name per FIO16-J. Canonicalize path names before validating them) and  and then validating the location before extraction.

A second issue is that the extraction and entries that prcoess can cause excessive consumption of system resources. This may result in a denial of service attack when resource usage is disproportionately large in comparison to the input data. The zip algorithm can produce very large compression ratios [Mahmoud 2002]. For example, a file consisting of alternating lines of a characters and b characters can achieve a compression ratio of more than 200 to 1. Even higher compression ratios can be obtained using input data that is targeted to the compression algorithm, more input data, or other compression methods. This permits the existence of zip bombs in which a small ZIP and or GZIP file consumes excessive resources when uncompressed because of extreme compression.  An example of a zip bomb is the file 42.zip which is a zip file consisting of 42 kilobytes of compressed data, containing five layers of nested zip files in sets of 16, each bottom layer archive containing a 4.3 gigabyte (4 294 967 295 bytes; ~ 3.99 GiB) file for a total of 4.5 petabytes (4 503 599 626 321 920 bytes; ~ 3.99 PiB) of uncompressed data.  Zip bombs often rely on repetition of identical files to achieve their extreme compression ratios. Programs must either limit the traversal of such files or refuse to extract data beyond a certain limit. The actual limit depends on the capabilities of the platform and expected usage.

...