👓
john the ripperに初めて触れたので自分でパスワード付きzip作って解析してみた
CTF競技面白そうやなーと思って、CELTFを触ってみたところ、初めてjohn the ripperというのを知った。
ちょっと触ってみたのでメモ。
john the ripperの環境構築はこちら
brew ウンタラする以外にもzip2johnを使うにはexport PATH=...をすることが必要。
触ってみた(CELTFのTODO管理サービス)
zipのパスワードを解析することができる。
題材はこれの最初に出てくる「TODO管理サービス」
ハッシュを作る
zip2john {解析したいzipファイル} > {一旦仮置きするハッシュファイル名}
my@mainoMacBook-Air celtf % zip2john credentials.zip > hash.txt
credentials.zip/credentials/ is not encrypted!
ver 1.0 credentials.zip/credentials/ is not encrypted, or stored with non-handled compression type
ver 1.0 efh 5455 efh 7875 credentials.zip/credentials/token.txt PKZIP Encr: 2b chk, TS_chk, cmplen=49, decmplen=37, crc=CFCB39DB
ハッシュを作る
john {さっき作ったファイル名}
my@mainoMacBook-Air celtf % john hash.txt
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
Warning: Only 2 candidates buffered for the current salt, minimum 8 needed for performance.
Almost done: Processing the remaining buffered candidate passwords, if any.
Warning: Only 3 candidates buffered for the current salt, minimum 8 needed for performance.
Proceeding with wordlist:/opt/homebrew/Cellar/john-jumbo/1.9.0_1/share/john/password.lst, rules:Wordlist
Proceeding with incremental:ASCII
3b8afc (credentials.zip/credentials/token.txt)
1g 0:00:00:45 DONE 3/3 (2025-09-10 19:01) 0.02186g/s 12617Kp/s 12617Kc/s 12617KC/s 3b83tm..3b8dh5
Use the "--show" option to display all of the cracked passwords reliably
Session completed
45秒ぐらいで出てきた。
触ってみた(自分でつくったzipを解読してみる)
zip作る
パスワードはランダム文字列生成サイトで作ったFOLpkc0
でいく。
my@mainoMacBook-Air celtf % zip -re eri.zip eri.txt
解析
my@mainoMacBook-Air celtf % zip2john eri.zip > eri_hash.txt
ver 1.0 efh 5455 efh 7875 eri.zip/eri.txt PKZIP Encr: 2b chk, TS_chk, cmplen=25, decmplen=13, crc=3275A26D
my@mainoMacBook-Air celtf % john eri_hash.txt
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
Warning: Only 5 candidates buffered for the current salt, minimum 8 needed for performance.
Warning: Only 1 candidate buffered for the current salt, minimum 8 needed for performance.
Warning: Only 3 candidates buffered for the current salt, minimum 8 needed for performance.
Almost done: Processing the remaining buffered candidate passwords, if any.
Warning: Only 5 candidates buffered for the current salt, minimum 8 needed for performance.
Proceeding with wordlist:/opt/homebrew/Cellar/john-jumbo/1.9.0_1/share/john/password.lst, rules:Wordlist
Proceeding with incremental:ASCII
0g 0:00:15:58 3/3 0g/s 13760Kp/s 13760Kc/s 13760KC/s COLW5r..COLN21
Session aborted
さっきは6桁で45秒、今度は7桁で15分以上...
すげー時間かかると思ったので、一旦ctrlCで止めた。
maskオプションとやらがあるので、ヒントを出してみる
--mask="FOLp?1?1?1"
で「FOLpから始まって、あとはワイルドカード」的な検索ができる
my@mainoMacBook-Air celtf % john --mask="FOLp?1?1?1" eri_hash.txt
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Press 'q' or Ctrl-C to abort, almost any other key for status
FOLpkc0 (eri.zip/eri.txt)
1g 0:00:00:00 DONE (2025-09-10 19:29) 100.0g/s 10649Kp/s 10649Kc/s 10649KC/s FOLp67q..FOLpRS0
Use the "--show" option to display all of the cracked passwords reliably
Session completed
秒で終わった...
まとめ
- 6文字と7文字でだいぶ時間が変わったので、何故か調べてみたい
- CTFもっとトライしてみたい!
Discussion