Marsの5εcur1ty備忘録

不定期的にCTF、脆弱性検証、バグバウンティレポート分析など、情報セキュリティを中心とした技術ブログを更新します。

ksnctf ZIP de kure: ZIPファイルの既知平文攻撃

f:id:z773733850:20190308180852p:plain

既知平文攻撃とは?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というツールを使います。

 インストール方法:

github.com

  • ファイル調査:

f:id:z773733850:20190308181140p:plain

圧縮率が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

Copyright Mars 2019