Hydra: A Complete Guide to the Fast Network Login Cracker
Hydra: A Complete Guide to the Fast Network Login Cracker
Hydra (often called "thc-hydra") is a parallelized login cracker developed by van Hauser and THC. It is designed for online brute-force attacks against network services — as opposed to offline hash cracking tools like John the Ripper or Hashcat, which attack hashed credentials directly. Hydra tests credentials by actually attempting to authenticate against a live service, making it the standard tool for identifying weak or default passwords across FTP, SSH, HTTP, RDP, databases, and more than 50 other protocols.
Where offline cracking tools work on captured hashes, Hydra interacts with live authentication endpoints. This makes it invaluable for penetration testers validating password policies, but it also means Hydra generates real network traffic and can trigger account lockouts or intrusion detection systems.
⚠️ Legal and ethical notice: Hydra is for authorized security testing, bug bounty programs within scope, CTFs, and systems you own. Unauthorized brute-force attacks are illegal and unethical. Always obtain explicit written authorization before testing any system.
Table of Contents
- Why Hydra Exists: Online Brute-Forcing
- Installation
- Basic Usage
- Command Reference
- Supported Protocols & Services
- Attack Examples by Service
- HTTP Form Brute-Forcing
- Advanced Options
- Session Save & Restore
- Output & Logging
- Common Errors & Troubleshooting
- Best Practices
- Hydra vs Other Password Tools
- Final Tips
1. Why Hydra Exists: Online Brute-Forcing
Most password-cracking guides focus on offline attacks: capturing a hash and cracking it on your own hardware. But in real-world penetration tests, you often cannot capture hashes — you only have network access to a login service. Hydra fills this gap.
Hydra is built around three core principles:
- Multi-protocol support — Over 50 protocols including SSH, FTP, HTTP(S), RDP, SMB, MySQL, MSSQL, PostgreSQL, VNC, SMTP, POP3, IMAP, LDAP, SNMP, Telnet, and Cisco AAA.
- Parallel processing — Multiple threads test credentials simultaneously, dramatically reducing time-to-result.
- Wordlist integration — Works with custom username and password lists, or single credentials, or even generated combinations.
The tool also ships with companion utilities: pw-inspector for filtering wordlists by length and complexity, and dpl4hydra for generating default password lists from vendor databases.
2. Installation
Kali Linux / Parrot OS (Pre-Installed)
Hydra is pre-installed on Kali Linux and Parrot Security OS. Verify installation with:
hydra -h
The expected output is the Hydra help menu showing the version number.
Debian / Ubuntu
sudo apt updatesudo apt install hydra -y
RHEL / Fedora
sudo dnf install hydra
Build from Source (Latest Version)
For the latest features, build from the official repository:
git clone https://github.com/vanhauser-thc/thc-hydracd thc-hydra./configuremakesudo make install
Docker
docker run --rm --network=host -it \-v /tmp:/tmp \lushirong/hydra:latest \hydra -L /opt/usernames/top-usernames-shortlist.txt \-P /opt/wordlists/passwords.txt \target_ip ssh
Verify Installation
hydra -h
Dependencies (Debian/Ubuntu)
Hydra depends on several libraries including libssh, libssl, libgcrypt20, libmariadb3, libpq5, libfreerdp3-3, and others. These are typically resolved automatically by the package manager.
3. Basic Usage
Basic Syntax
Hydra supports two syntax styles. Both work identically, but the newer style is more consistent and easier to script.
Old Style:
hydra [options] target_ip service
New Style:
hydra service://target_ip:port [options]
Example: Brute-Force SSH with a Known Username
hydra -l root -P /usr/share/wordlists/metasploit/unix_passwords.txt -t 6 ssh://192.168.1.123
This attempts to log in as root using each password from the wordlist, with 6 parallel threads.
Example: Brute-Force FTP with Username and Password Lists
hydra -L users.txt -P pass.txt ftp://192.168.1.100
Example: Test a Single Credential Pair
hydra -l admin -p password123 192.168.1.100 ftp
Example: HTTP POST Form
hydra -l admin -P passlist.txt 10.0.0.5 http-post-form \"/login.php:username=^USER^&password=^PASS^:F=incorrect" -V
Understanding ^USER^ and ^PASS^
In HTTP form attacks, ^USER^ and ^PASS^ are placeholders that Hydra replaces with each username and password from your lists. The failure string (F=incorrect) tells Hydra what a failed login looks like — it must match text that appears only on failed login responses.
4. Command Reference
Username & Password Options
| Flag | Description |
|---|---|
-l <user> | Single username |
-L <file> | File containing a list of usernames |
-p <pass> | Single password |
-P <file> | File containing a list of passwords |
-C <file> | File with username:password pairs (colon-separated) |
-e <nsr> | Try null password (n), username as password (s), reversed username (r) |
-x <min:max:chars> | Generate passwords by brute-force mask (e.g., -x 6:8:aA1) |
-u | Try each username against all passwords before moving to the next username (default: all passwords per username first) |
Target Options
| Flag | Description |
|---|---|
<target> | IP address, CIDR subnet, or DNS name |
-M <file> | File containing a list of target IP addresses |
-s <port> | Specify a non-default target port |
-S | Connect via SSL/TLS |
-m <options> | Module-specific options |
-4 / -6 | Force IPv4 or IPv6 |
Performance & Behavior Options
| Flag | Description |
|---|---|
-t <n> | Number of parallel threads (default: 16) |
-T <n> | Total number of parallel tasks across all targets |
-f | Exit after the first valid credential pair is found |
-F | Exit after the first valid pair on any target (with -M) |
-V | Verbose — show each attempt |
-d | Debug mode |
-o <file> | Save found credentials to file |
-b <format> | Output format (text, json, jsonv1) |
-R | Restore a previous session |
-I | Ignore an existing restore file |
Attack Modes
| Mode | Flag | Description |
|---|---|---|
| Straight | -a 0 | Default — each username × each password |
| Combination | -a 1 | Pair usernames from one list with passwords from another (paired by line) |
| Brute-force | -a 3 | Generate all possible character combinations |
| Hybrid (wlist+mask) | -a 6 | Wordlist words + generated characters |
| Hybrid (mask+wlist) | -a 7 | Generated characters + wordlist words |
5. Supported Protocols & Services
Hydra supports an extensive list of protocols organized by category:
Authentication / Remote Access
| Protocol | Description |
|---|---|
ssh | Secure Shell remote login |
telnet | Telnet protocol (unencrypted) |
rdp | Windows Remote Desktop |
vnc | Virtual Network Computing |
rlogin | Unix remote login (deprecated) |
cisco / cisco-enable | Cisco device login / enable password |
Web Services
| Protocol | Description |
|---|---|
http-get | HTTP GET-based authentication |
http-head | HTTP HEAD-based authentication |
http-post | HTTP POST-based authentication |
http-get-form | HTTP GET form login |
http-post-form | HTTP POST form login |
http-proxy | Login attempts on proxy servers |
https-* | Same as above but over SSL/TLS |
File Transfer
| Protocol | Description |
|---|---|
ftp / ftps | File Transfer Protocol (optionally over SSL/TLS) |
Email Services
| Protocol | Description |
|---|---|
smtp | Simple Mail Transfer Protocol |
pop3 / pop3s | Post Office Protocol |
imap / imaps | Internet Message Access Protocol |
Databases
| Protocol | Description |
|---|---|
mysql | MySQL |
mssql | Microsoft SQL Server |
postgres | PostgreSQL |
oracle-listener | Oracle listener |
oracle-sid | Oracle SID |
Network Services
| Protocol | Description |
|---|---|
smb | Windows file/printer sharing |
snmp | Simple Network Management Protocol |
ldap2 / ldap3 | Lightweight Directory Access Protocol |
sip | VoIP signaling protocol |
Messaging / Communication
| Protocol | Description |
|---|---|
irc | Internet Relay Chat |
icq | Instant Messaging (legacy) |
6. Attack Examples by Service
SSH Brute-Force
# Single username, password listhydra -l root -P passwords.txt 10.0.0.5 -t 4 ssh# Username list, password listhydra -L users.txt -P passwords.txt ssh://192.168.1.100# Custom porthydra -L users.txt -P pass.txt ssh://192.168.1.100:2222# Verbose, exit on first successhydra -l admin -P pass.txt -t 6 -f -V ssh://192.168.1.100
FTP Brute-Force
# Username list, password listhydra -L users.txt -P pass.txt ftp://192.168.1.100# Custom porthydra -l admin -P passwords.txt ftp://target -s 2121
RDP Brute-Force
hydra -L users.txt -P passwords.txt rdp://192.168.1.100
MySQL Brute-Force
hydra -L users.txt -P passwords.txt mysql://192.168.1.100
SMB Brute-Force
hydra -L users.txt -P passwords.txt smb://192.168.1.100
HTTP Basic Authentication
hydra -L users.txt -P pass.txt 192.168.1.100 http-get /protected/
Telnet Brute-Force
hydra -L users.txt -P passwords.txt telnet://192.168.1.100
VNC Brute-Force
hydra -P passwords.txt vnc://192.168.1.100
7. HTTP Form Brute-Forcing
HTTP form attacks are the most complex Hydra operation because you must specify the exact form path, parameter names, and a failure indicator string.
Step 1: Identify the Form Parameters
Use browser DevTools (Network tab) to inspect the login request. Note:
- The form action path (e.g.,
/login.php) - The parameter names (e.g.,
username,password) - Whether the form uses GET or POST
- The failure message shown on bad login
Step 2: Construct the Command
Syntax:
hydra target http-post-form "<path>:<POST_body>:<failure_condition>"
Example (failure string):
hydra -l admin -P passlist.txt 10.0.0.5 http-post-form \"/login.php:username=^USER^&password=^PASS^:F=incorrect" -V
Example (failure string with F= prefix):
hydra -L users.txt -P pass.txt 192.168.1.100 http-post-form \"/login.php:username=^USER^&password=^PASS^&submitbtn=Submit:The username or password is not correct. Please try again" -V -f
Example (success condition):
hydra -l admin -P passlist.txt mywebsite.com http-post-form \"/login:username=^USER^&password=^PASS^:S=Dashboard"
When using S=, Hydra treats the string as a success indicator. Use F= when specifying a failure indicator.
Important Notes
- Prefer
F=(failure string) overS=(success string). WithS=, anything that doesn't match — including timeouts or rate-limit responses — can be misinterpreted as success. - The failure string must appear only on failed logins. Test manually first.
- Use
-Vto see each attempt and confirm Hydra is parsing responses correctly.
8. Advanced Options
Restore a Previous Session
If a scan is interrupted, Hydra saves state to a .restore file. Resume with:
hydra -R /path/to/hydra.restore
Using -e nsr for Quick Tests
hydra -l admin -e nsr 192.168.1.100 ssh
This tries three common weak patterns before any wordlist:
n— null/empty passwords— username as passwordr— reversed username as password
Brute-Force Mask Generation
hydra -l admin -x 6:8:aA1 192.168.1.100 ssh
The -x flag generates passwords from a mask:
6:8— length from 6 to 8 charactersaA1— lowercase letters, uppercase letters, digits
Common mask characters: a (lowercase), A (uppercase), 1 (digits), s (special characters).
Username/Password Pairs File
hydra -C credentials.txt 192.168.1.100 ssh
The -C file format is username:password, one pair per line.
Combination Mode
hydra -a 1 -L users.txt -P passes.txt 192.168.1.100 ssh
In combination mode, Hydra pairs the first username with the first password, the second username with the second password, and so on.
9. Session Save & Restore
Hydra automatically saves session state to hydra.restore in the current directory when interrupted (Ctrl+C) or when it completes. To resume:
hydra -R hydra.restore
You can also specify a custom restore file:
hydra -R /path/to/session.restore
Use -I to ignore an existing restore file and start fresh:
hydra -I -l admin -P pass.txt 192.168.1.100 ssh
10. Output & Logging
Save Found Credentials to File
hydra -L users.txt -P pass.txt 192.168.1.100 ssh -o found.txt
JSON Output
hydra -L users.txt -P pass.txt 192.168.1.100 ssh -b json -o results.json
Verbose Mode
hydra -l admin -P pass.txt 192.168.1.100 ssh -V
Verbose mode shows every attempt, which is useful for debugging but generates significant output for large wordlists.
Quiet Mode
Without -V, Hydra shows only successful logins and summary statistics. This is the recommended mode for large runs.
11. Common Errors & Troubleshooting
Error: hydra: command not found
Cause: Hydra is not installed or not in PATH.
Solution:
sudo apt updatesudo apt install hydra -y
Error: Compiled without LIBSSH v0.4.x support, module is not available!
Cause: Hydra was compiled without LIBSSH library support, so the SSH module is unavailable.
Solution: Recompile Hydra with LIBSSH support, or install the libssh-dev package and rebuild:
sudo apt install libssh-devcd thc-hydra./configuremakesudo make install
Error: connection refused
Cause: The target service is not running or not accessible.
Solution: Verify the service is running:
sudo systemctl status sshsudo systemctl status vsftpdsudo systemctl status apache2
Check that the port is open:
sudo ss -tlnp | grep -E ':(21|22|80)'
Error: all children were disabled due to too many connection errors
Cause: The target is rejecting connections, possibly due to a firewall, rate limiting, or service crash.
Solution: Reduce thread count (-t 2), add delays, or verify the service is stable. This is often a sign the target has defensive mechanisms in place.
Error: Hydra returns no valid passwords
Possible Causes:
- Incorrect wordlists (wrong path or empty file)
- Wrong service type
- Incorrect HTTP path or failure string
- Credentials are not actually valid
Solutions:
- Verify wordlists:
wc -l wordlist.txt - Test a known credential manually first
- For HTTP forms, confirm the failure string appears only on failed logins
- Use
-Vto see each attempt
Error: Hydra is very slow
Cause: Low thread count.
Solution: Increase tasks with -t 16 or higher. Be aware that high thread counts may trigger detection systems or account lockouts.
Error: HTTP form attack always returns failure
Cause: The failure string is incorrect or the form uses a different response pattern.
Solution:
- Manually submit a failed login and inspect the response
- Check whether the failure string is in the response body, headers, or status code
- Use
S=(success string) as an alternative if a reliable failure string is unavailable - Verify parameter names match the actual form (use browser DevTools)
12. Best Practices
Start with Known Credentials
Before running a large wordlist, test with a single known credential pair to confirm Hydra is working correctly:
hydra -l testuser -p testpass 192.168.1.100 ssh
Tune Thread Count
The default thread count is 16. For production systems or fragile services, reduce to 2–4:
hydra -l admin -P pass.txt -t 4 192.168.1.100 ssh
For isolated lab environments, you can increase to 32 or higher.
Use -f to Stop on First Success
When you only need one valid credential, use -f to exit immediately:
hydra -l admin -P pass.txt -f 192.168.1.100 ssh
Always Obtain Authorization
Brute-forcing without permission is illegal. Document your authorization, scope, and testing window before starting.
Avoid Account Lockouts
Many systems lock accounts after 3–5 failed attempts. If the target has a lockout policy, Hydra will lock out the account before finding the password. Consider:
- Testing with a single username first
- Using a small, targeted wordlist
- Coordinating with system administrators
Prefer ffuf for HTTP Form Attacks
For HTTP form brute-forcing specifically, ffuf is often faster and more flexible than Hydra. Hydra remains the better choice for native protocols (SSH, FTP, RDP, databases).
Use pw-inspector to Filter Wordlists
The bundled pw-inspector tool filters wordlists by length and character composition:
pw-inspector -i wordlist.txt -o filtered.txt -m 6 -M 10
Use dpl4hydra for Default Passwords
The dpl4hydra script generates default password lists for specific vendors:
dpl4hydra Linksys
13. Hydra vs Other Password Tools
| Feature | Hydra | Medusa | Ncrack | John the Ripper | Hashcat |
|---|---|---|---|---|---|
| Attack Type | Online | Online | Online | Offline | Offline |
| Protocols | 50+ | 20+ | 15+ | N/A (hashes) | N/A (hashes) |
| Parallelism | High | High | High | CPU/GPU | GPU |
| HTTP Form Support | Yes | Limited | No | No | No |
| Session Restore | Yes | Yes | No | Yes | Yes |
| Best For | Broad protocol coverage | Stable, fast online | Network devices | CPU hash cracking | GPU hash cracking |
Bottom line: Hydra is the most widely used online brute-force tool due to its protocol breadth and maturity. Medusa and Ncrack are alternatives with different strengths. For offline hash cracking, use John the Ripper or Hashcat.
14. Final Tips
- Always verify the service is running and reachable before starting a Hydra attack.
- Test with a single credential pair to confirm syntax before committing to a large wordlist.
- Use `-V` for debugging but disable it for production runs — verbose output slows Hydra significantly.
- Use `-o` to save found credentials — terminal output is lost when the session ends.
- Resume interrupted scans with
hydra -R hydra.restorerather than starting over. - For HTTP forms, prefer ffuf when speed and flexibility are priorities. Hydra's HTTP form module works but is slower.
- Keep wordlists organized — the standard location on Kali is
/usr/share/wordlists/, with Metasploit wordlists at/usr/share/metasploit-framework/data/wordlists/. - Update Hydra regularly — new protocol modules and fixes are added frequently.
sudo apt update && sudo apt upgrade hydra. - Consult the official repository at github.com/vanhauser-thc/thc-hydra for the latest version and documentation.
- Use `-e nsr` as a quick first pass — null, username-as-password, and reversed-username are common weak patterns that take seconds to test.
Official Resources:
- GitHub: github.com/vanhauser-thc/thc-hydra
- Kali Linux Tool Page: kali.org/tools/hydra
- Ubuntu Manpage: manpages.ubuntu.com/manpages/hydra
Remember: Hydra is a powerful tool for authorized security testing. Always obtain written authorization before brute-forcing any system. Unauthorized password attacks are illegal and unethical. Respect rate limits, avoid account lockouts, and document every action.
Author
Discussion · 0
No comments yet — start the discussion.
Sign in to join the discussion.