0

I've been trying to figure this out using an encrypted zip file as an example.

I am quite familiar with the idea that PBKDF2 creates a key drivered form a password and then that key is used to encrypt the file using AES. But how does JtR know when there is a password match?

  1. File name: 1msg.txt
  2. File content: secreto
  3. zip password: 123
  4. zip name: 1zip.zip

After runing zip2john I get the following output:

1zip.zip/1msg.txt:$pkzip2$1*2*2*0*14*8*ceb1bdc8*0*42*0*14*ceb1*7f11*82f7880f88c1eca2f1cca528dc15458be59510c7*$/pkzip2$:1msg.txt:1zip.zip::1zip.zip

Acording to comments it the program, the structure of the information above goes like this:

 * filename:$pkzip2$C*B*[DT*MT{CL*UL*CR*OF*OX}*CT*DL*CS*TC*DA]*$/pkzip2$   (new format, with 2 checksums)
 * All numeric and 'binary data' fields are stored in hex.
 *
 * C   is the count of hashes present (the array of items, inside the []  C can be 1 to 3.).
 * B   is number of valid bytes in the checksum (1 or 2).  Unix zip is 2 bytes, all others are 1 (NOTE, some can be 0)
 * ARRAY of data starts here
 *   DT  is a "Data Type enum".  This will be 1 2 or 3.  1 is 'partial'. 2 and 3 are full file data (2 is inline, 3 is load from file).
 *   MT  Magic Type enum.  0 is no 'type'.  255 is 'text'. Other types (like MS Doc, GIF, etc), see source.
 *     NOTE, CL, DL, CRC, OFF are only present if DT != 1
 *     CL  Compressed length of file blob data (includes 12 byte IV).
 *     UL  Uncompressed length of the file.
 *     CR  CRC32 of the 'final' file.
 *     OF  Offset to the PK\x3\x4 record for this file data. If DT == 2, then this will be a 0, as it is not needed, all of the data is already included in the line.
 *     OX  Additional offset (past OF), to get to the zip data within the file.
 *     END OF 'optional' fields.
 *   CT  Compression type  (0 or 8)  0 is stored, 8 is imploded.
 *   DL  Length of the DA data.
 *   CS  2 bytes of checksum data.
 *   TC  2 bytes of checksum data (from timestamp)
 *   DA  This is the 'data'.  It will be hex data if DT == 1 or 2. If DT == 3, then it is a filename (name of the .zip file).
 * END of array item.  There will be C (count) array items.
 * The format string will end with $/pkzip$

John only needs the result of zip2john to start comparing passwords, but I don't see any key or hashed password or salt. So, what is it comparing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.