[GH-ISSUE #245] zip2john fails to work for some files posted on sample "non-hashes" page #16

Closed
opened 2026-10-14 02:49:48 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @kholia on GitHub (Apr 11, 2013).
Original GitHub issue: https://github.com/openwall/john/issues/245

Originally assigned to: @jfoug on GitHub.

  1. Download and extract http://openwall.info/wiki/_media/john/zip_sample_files.tar
  2. Run zip2john on "zip0_password.zip" file. This results in no output hash.
  3. The following patch will enable zip2john to emit the output hash. However the resulting hash couldn't be cracked (the password is "password") by john. Seems like more fixing is required.
-                       if (LoadZipBlob(fp, &curzip, &zfp, fname) && curzip.decomp_len > 12) {
+                       if (LoadZipBlob(fp, &curzip, &zfp, fname) && curzip.decomp_len > 3) {
Originally created by @kholia on GitHub (Apr 11, 2013). Original GitHub issue: https://github.com/openwall/john/issues/245 Originally assigned to: @jfoug on GitHub. 1. Download and extract http://openwall.info/wiki/_media/john/zip_sample_files.tar 2. Run zip2john on "zip0_password.zip" file. This results in no output hash. 3. The following patch will enable zip2john to emit the output hash. However the resulting hash couldn't be cracked (the password is "password") by john. Seems like more fixing is required. ``` - if (LoadZipBlob(fp, &curzip, &zfp, fname) && curzip.decomp_len > 12) { + if (LoadZipBlob(fp, &curzip, &zfp, fname) && curzip.decomp_len > 3) { ```
Author
Owner

@magnumripper commented on GitHub (May 2, 2013):

What version of zip is that? Winzip or pkzip?

<!-- gh-comment-id:17353024 --> @magnumripper commented on GitHub (May 2, 2013): What version of zip is that? Winzip or pkzip?
Author
Owner

@kholia commented on GitHub (May 2, 2013):

IIRC, I used WinZip to generate those files.

However, I don't think that it matters. zip2john is programmed to reject small file streams.

<!-- gh-comment-id:17353144 --> @kholia commented on GitHub (May 2, 2013): IIRC, I used WinZip to generate those files. However, I don't think that it matters. zip2john is programmed to reject small file streams.
Author
Owner

@magnumripper commented on GitHub (Feb 19, 2014):

This is not exactly a bug, it's function as designed. But if we can fix it, all the better.

<!-- gh-comment-id:35454546 --> @magnumripper commented on GitHub (Feb 19, 2014): This is not exactly a bug, it's function as designed. But if we can fix it, all the better.
Author
Owner

@jfoug commented on GitHub (Jun 15, 2014):

Fixed: c67b168 and b7a49ae

The issue was zip2john not processing any file with less than 12 bytes of compressed data. This has been lowered to > 2 bytes. The 2nd part of the bug was fixed in b7a49ae and it had to do with decompressed zip data being less than 128 byte. In that case, the inflate function does NOT return a Z_OK. It returns a Z_END_OF_STREAM, BUT that is ok, since we inflated the entire data. Normally, you inflate a small chunk, and the inflate engine says, 'ok'. Here it simply said all is done. That patch detects these tiny guys, and handles them properly.

This bug is fixed.

$ ../bleeding/run/john x.in
Loaded 1 password hash (PKZIP [32/32])
Press 'q' or Ctrl-C to abort, almost any other key for status
password (zip0_password.zip)
1g 0:00:00:00 DONE 1/3 (2014-06-15 09:44) 62.50g/s 1000p/s 1000c/s 1000C/s zip0zip0_password.zip..passwordzip0
Use the "--show" option to display all of the cracked passwords reliably
Session completed

<!-- gh-comment-id:46117713 --> @jfoug commented on GitHub (Jun 15, 2014): Fixed: c67b168 and b7a49ae The issue was zip2john not processing any file with less than 12 bytes of compressed data. This has been lowered to > 2 bytes. The 2nd part of the bug was fixed in b7a49ae and it had to do with decompressed zip data being less than 128 byte. In that case, the inflate function does NOT return a Z_OK. It returns a Z_END_OF_STREAM, BUT that is ok, since we inflated the entire data. Normally, you inflate a small chunk, and the inflate engine says, 'ok'. Here it simply said all is done. That patch detects these tiny guys, and handles them properly. This bug is fixed. $ ../bleeding/run/john x.in Loaded 1 password hash (PKZIP [32/32]) Press 'q' or Ctrl-C to abort, almost any other key for status password (zip0_password.zip) 1g 0:00:00:00 DONE 1/3 (2014-06-15 09:44) 62.50g/s 1000p/s 1000c/s 1000C/s zip0zip0_password.zip..passwordzip0 Use the "--show" option to display all of the cracked passwords reliably Session completed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#16
No description provided.