Online Dictionary Attack with Hydra

An interesting article from  at InfoSec Institute:

1. Introduction

When an attacker wants to learn credentials for an online system, he can use brute force or a dictionary attack. This article introduces these two types of attack and explains how to launch an online dictionary attack using Hydra.

2. Brute Force vs. Dictionary Attack

An attacker can try every possible password combination (brute force approach). The advantage is guaranteed success in finding the right password. The drawback is that it is a very time-consuming process.

It’s probable that a typical user is frustrated about password best practices and uses a pattern for the password (for example a common word and a digit appended at the end). Then the attacker can build a set of common words concatenated with a digit (an exemplary pattern in the dictionary) and try every combination from this set. This approach (dictionary attack) can save the attacker’s time, because he doesn’t have to brute-force the whole key space. The disadvantage is that there is no guarantee that the right password will be found. However, the probability of hitting the right password is quite good, taking into account the passwords people often choose.

3. Environment

Hydra is described as a network logon cracker that supports many services [1]. This article explains how to use Hydra to launch an online dictionary attack against FTP and a web form.

Metasploitable is a Linux-based virtual machine that is intentionally vulnerable [2]. It can be used, for example, to practice penetration testing skills. Please remember that this machine is vulnerable and should not operate in bridge mode.

DVWA (Damn Vulnerable Web Application) is a web application that is intentionally vulnerable [3]. It is helpful for those who want to play with web application security stuff. DVWA is part of Metasploitable.

4. Dictionaries

Let’s create two short dictionaries for the simplicity of description.

List of users (list_user):

1
2
3
admin_1
admin
msfadmin

List of passwords (list_password)

1
2
3
4
password_1
password
msfadmin
password_2

There are 12 combinations to check (3 users times 4 passwords). These combinations include default credentials for DVWA login form and Metasploitable FTP (admin/password for DVWA login form; msfadmin/msfadmin for Metasploitable FTP).

5. Metasploitable—Dictionary Attack on FTP

Use the following command to launch the attack:

1
dawid@lab:~$ hydra -L list_user -P list_password 192.168.56.101 ftp -V

The aforementioned dictionaries (list_user and list_password) are used. The IP address of Metasploitable FTP server is 192.168.56.101. FTP is attacked. That’s why ftp module is used in the command. One should use -V to see username and password for each attempt.

As we can see below, Hydra has found one valid pair of username and password (username: msfadmin, password: msfadmin).

6. DVWA—Dictionary Attack on Login Form

Use the following command to launch the attack:

1
dawid@lab:~$ hydra -L list_user -P list_password 192.168.56.101 http-post-form "/dvwa/login.php:username=^USER^&password=^PASS^&Login=Login:Login failed" -V

The aforementioned dictionaries (list_user and list_password) are used again. The IP address of DVWA is 192.168.56.101. The login form of DVWA is available in Metasploitable at 192.168.56.101/dvwa/login.php. When the user logs in, the following request is generated (intercepted by Burp Suite [4]):

The key parts were marked on the screenshot. They are the values of the parameters of http-post-form module:

Read more at the InfoSec Institute website here.

1 reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.