概要
TryHackMe「Crack the hash」のWalkthroughです。
Task1
Q1.48bb6e862e54f2a795ffc4e541caed4d
Hint.md5
対象のハッシュ値をファイルに保存します。
$ echo "48bb6e862e54f2a795ffc4e541caed4d" > task1q1.txt
john the ripper
を使用してmd5
のハッシュ値を解析します。
$ john --format=raw-md5 --wordlist=/usr/share/wordlists/rockyou.txt task1q1.txt
Using default input encoding: UTF-8
Loaded 1 password hash (Raw-MD5 [MD5 256/256 AVX2 8x3])
Warning: no OpenMP support for this hash type, consider --fork=2
Press 'q' or Ctrl-C to abort, almost any other key for status
easy (?)
元の文字列がeasy
であると分かりました。
A.easy
Q2.CBFDAC6008F9CAB4083784CBD1874F76618D2A97
Hint.Sha.. but which version
ハッシュ値をファイルに保存します。
$ echo "CBFDAC6008F9CAB4083784CBD1874F76618D2A97" > task1q2.txt
ヒントからSHA~
までは分かりました。
一旦john
に任せて実行します。
$ john task1q2.txt --wordlist=/usr/share/wordlists/rockyou.txt
Warning: detected hash type "Raw-SHA1", but the string is also recognized as "Raw-SHA1-AxCrypt"
Use the "--format=Raw-SHA1-AxCrypt" option to force loading these as that type instead
Warning: detected hash type "Raw-SHA1", but the string is also recognized as "Raw-SHA1-Linkedin"
Use the "--format=Raw-SHA1-Linkedin" option to force loading these as that type instead
Warning: detected hash type "Raw-SHA1", but the string is also recognized as "ripemd-160"
Use the "--format=ripemd-160" option to force loading these as that type instead
Using default input encoding: UTF-8
Loaded 1 password hash (Raw-SHA1 [SHA1 256/256 AVX2 8x])
Warning: no OpenMP support for this hash type, consider --fork=2
Press 'q' or Ctrl-C to abort, almost any other key for status
password123 (?)
password123
だと解析できました。
A.password123
Q3.1C8BFE8F801D79745C4631D09FFF36C82AA37FC4CCE4FC946683D7B336B63032
Hint.Sha..
ハッシュ値をファイルに保存します。
$ echo "1C8BFE8F801D79745C4631D09FFF36C82AA37FC4CCE4FC946683D7B336B63032" > task1q3.txt
とりあえずjohn
を実行します。
$ john task1q3.txt --wordlist=/usr/share/wordlists/rockyou.txt
Warning: detected hash type "cryptoSafe", but the string is also recognized as "gost"
Use the "--format=gost" option to force loading these as that type instead
Warning: detected hash type "cryptoSafe", but the string is also recognized as "HAVAL-256-3"
Use the "--format=HAVAL-256-3" option to force loading these as that type instead
Warning: detected hash type "cryptoSafe", but the string is also recognized as "Raw-Keccak-256"
Use the "--format=Raw-Keccak-256" option to force loading these as that type instead
Warning: detected hash type "cryptoSafe", but the string is also recognized as "Raw-SHA256"
Use the "--format=Raw-SHA256" option to force loading these as that type instead
Warning: detected hash type "cryptoSafe", but the string is also recognized as "skein-256"
Use the "--format=skein-256" option to force loading these as that type instead
Warning: detected hash type "cryptoSafe", but the string is also recognized as "Stribog-256"
Use the "--format=Stribog-256" option to force loading these as that type instead
Using default input encoding: UTF-8
Loaded 1 password hash (cryptoSafe [AES-256-CBC])
Will run 2 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
0g 0:00:00:03 DONE (2024-06-04 05:54) 0g/s 3994Kp/s 3994Kc/s 3994KC/s 02102265315..*7¡Vamos!
Session completed.
パスワードを特定できませんでしたが、SHA256
でハッシュ化されていそうだと分かりました。
フォーマットを指定して再度実行するとパスワードを特定出来ました。
$ john task1q3.txt --wordlist=/usr/share/wordlists/rockyou.txt --format=raw-sha256
Using default input encoding: UTF-8
Loaded 1 password hash (Raw-SHA256 [SHA256 256/256 AVX2 8x])
Warning: poor OpenMP scalability for this hash type, consider --fork=2
Will run 2 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
letmein (?)
A.letmein
Q4.$2y$12$Dwt1BZj6pcyc3Dy1FWZ5ieeUznr71EeNkJkUlypTsgbX1H68wsRom
Hint.Search the hashcat examples page (https://hashcat.net/wiki/doku.php?id=example_hashes) for \$2y\$. This type of hash can take a very long time to crack, so either filter rockyou for four character words, or use a mask for four lower case alphabetical characters.
ハッシュ値をファイルに保存します。
$ echo '$2y$12$Dwt1BZj6pcyc3Dy1FWZ5ieeUznr71EeNkJkUlypTsgbX1H68wsRom' > task1q4.txt
hashcat
のwikiにある表からbcrypt
でハッシュ化されていると推測できました。
普通にhashcat
を実行するととんでもない時間がかかるので今回は裏技を使います。
回答欄から答えは4文字だと分かるのでrockyou.txt
から4文字のワードを抽出してワードリストに使用します。
$ cat /usr/share/wordlists/rockyou.txt| grep -E '^.{4}$' > 4rockyou.txt
かなり縮小することができました。
$ wc -c 4rockyou.txt
91391 4rockyou.txt
hashcat
で解析します。
$ hashcat -a 0 -m 3200 task1q4.txt 4rockyou.txt
元の文字列を特定できました。
$2y$12$Dwt1BZj6pcyc3Dy1FWZ5ieeUznr71EeNkJkUlypTsgbX1H68wsRom:bleh
A.bleh
Q5.279412f945939ba78ce0758d3fd83daa
Hint.md4
下記サイトで解析します。
A.Eternity22
Task2
Q1.Hash: F09EDCB1FCEFC6DFB23DC3505A882655FF77375ED8AA2D1C13F640FCCC2D0C85
ハッシュ値をファイルに保存します。
$ echo 'F09EDCB1FCEFC6DFB23DC3505A882655FF77375ED8AA2D1C13F640FCCC2D0C85' > task2q1.txt
Hash Analyzer
によるとSHA2-256
でハッシュ化されているようですね。
hashcat
で解析します。
SHA2-256
は1400
を使用します。
$ hashcat -a 0 -m 1400 task2q1.txt /usr/share/wordlists/rockyou.txt
元の文字列を特定できました。
f09edcb1fcefc6dfb23dc3505a882655ff77375ed8aa2d1c13f640fccc2d0c85:paule
A.paule
Q2.Hash: 1DFECA0C002AE40B8619ECF94819CC1B
Hint.NTLM
ハッシュ値をファイルに保存します。
$ echo '1DFECA0C002AE40B8619ECF94819CC1B' > task2q2.txt
NTLM
は1000
を指定します。
hashcat
を実行します。
$ hashcat -a 0 -m 1000 task2q2.txt /usr/share/wordlists/rockyou.txt
元の文字列を特定できました。
1dfeca0c002ae40b8619ecf94819cc1b:n63umy8lkf4i
A.n63umy8lkf4i
Q3.Hash: $6$aReallyHardSalt$6WKUTqzq.UQQmrm0p/T7MPpMbGNnzXPMAXi4bJMl9be.cfi3/qxIf.hsGpS41BqMhSrHVXgMpdjS6xeKZAs02. Salt: aReallyHardSalt
ハッシュ値をファイルに保存します。
$ echo '$6$aReallyHardSalt$6WKUTqzq.UQQmrm0p/T7MPpMbGNnzXPMAXi4bJMl9be.cfi3/qxIf.hsGpS41BqMhSrHVXgMpdjS6xeKZAs02.' > task2q3.txt
ハッシュ値の形式からSHA512
形式だと推測しました。
SHA512
は1800
を指定します。
$ hashcat -a 0 -m 1800 task2q3.txt /usr/share/wordlists/rockyou.txt
元の文字列を特定できました。
$6$aReallyHardSalt$6WKUTqzq.UQQmrm0p/T7MPpMbGNnzXPMAXi4bJMl9be.cfi3/qxIf.hsGpS41BqMhSrHVXgMpdjS6xeKZAs02.:waka99
A.waka99
Q4.Hash: e5d8870e5bdd26602cab8dbe07a942c8669e56d6 Salt: tryhackme
Hint.HMAC-SHA1
HMAC-SHA1
は160
を指定します。
ソルトが分かっているので、<ハッシュ値>:<ソルト>
の形式でファイルに保存します。
$ echo 'e5d8870e5bdd26602cab8dbe07a942c8669e56d6:tryhackme' > q5.txt
hashcat
を実行します。
$ hashcat -a 0 -m 160 q5.txt /usr/share/wordlists/rockyou.txt
元の文字列を特定できました。
e5d8870e5bdd26602cab8dbe07a942c8669e56d6:tryhackme:481616481616
A.481616481616