pkcrack

zipで圧縮され、パスフレーズで暗号化されているファイルを復元するためにpkcrackというツールがある。その使い方のメモ。単純な全探索ではなく、zipファイル内にあるファイルのどれかがplain textとして存在していれば即座に復号可能である。

以下、PkCrack READMEの抜粋。

  pkcrack -C encrypted-ZIP -c ciphertextname -P plaintext-ZIP 
          -p plaintextname -d decrypted_file -a
(This is supposed to be a single line. I've wrapped it because it doesn't fit in 80 chars. "Real computer scientists never comment their code - the identifiers are so long they can't afford the disc space." :-/ )
encrypted-ZIP
  is the name (and path) of the encrypted ZIP-archive (see 1. above)
ciphertextname
  is the name of the file in the archive, for which you have the plaintext
plaintext-ZIP
  is the name (and path) of the ZIP-archive containing the compressed plaintext (see 2. above)
plaintextname
  is the name of the file in the archive containing the known plaintext
decrypted_file
  is the name of a file to which the decrypted archive will be written

例)Standard-lock-key.jpgが得られている場合。

./pkcrack -C ./flag.zip -c -c Standard-lock-key.jpg -p ./Standard-lock-key.jpg -d target.zip