ksnctf ZIP de kure: ZIPファイルの既知平文攻撃
既知平文攻撃とは?What's the known-plaintext attack?
Wikipedia definition:
The known-plaintext attack (KPA) is an attack model for cryptanalysis where the attacker has access to both the plaintext (called a crib), and its encrypted version (ciphertext). These can be used to reveal further secret information such as secret keys and code books.
Known-plaintext attack - Wikipedia
今回は、pkcrackというツールを使います。
インストール方法:
- ファイル調査:
圧縮率が0%のようです。
zipファイルには、パスワードがかかっています。
Standard-lock-key.jpgをググってみると、どうやらファイルが見つけられるらしいです。 ファイルのサイズは、249 KByteになっているので、それとぴったりなファイルをダウンロードした。
./pkcrack -c '[暗号化されているZIPファイル]' -c '[既知のファイル]' -p '[既知ファイル自身のパス]' -d [出力ファイル名]
./pkcrack -C '../../../ksnctf/flag.zip' -c Standard-lock-key.jpg -p '../../../ksnctf/Standard-lock-key.jpg' -d output.zip
すると、output.zipをパスワードなしで解凍できる:
cat flag.html | grep FLAG
FLAG FLAG_PghfJf8X8mXEqWsk