baner

Thứ Tư, 1 tháng 1, 2014

Online Dictionary Attack with Hydra

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):
[plain]
admin_1
admin
msfadmin
[/plain]
List of passwords (list_password)
[plain]
password_1
password
msfadmin
password_2
[/plain]
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:
[plain]
dawid@lab:~$ hydra -L list_user -P list_password 192.168.56.101 ftp -V
[/plain]
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:
[plain]
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
[/plain]
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]):

Want to learn more?? The InfoSec Institute Ethical Hacking course goes in-depth into the techniques used by malicious, black hat hackers with attention getting lectures and hands-on lab exercises. While these hacking skills can be used for malicious purposes, this class teaches you how to use the same hacking techniques to perform a white-hat, ethical hack, on your organization. You leave with the ability to quantitatively assess and measure threats to information assets; and discover where your organization is most vulnerable to black hat hackers. Some features of this course include:
  • Dual Certification - CEH and CPT
  • 5 days of Intensive Hands-On Labs
  • Expert Instruction
  • CTF exercises in the evening
  • Most up-to-date proprietary courseware available

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

[plain]
"/dvwa/login.php:username=^USER^&password=^PASS^&Login=Login:Login failed"
[/plain]
^USER^ and ^PASS^ are replaced with usernames (from list_user) and passwords (list_password) respectively. When the login attempt is unsuccessful, the server responds with a “Login failed” message, which is the value of the last parameter.
Finally, 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: admin, password: password).

7. Summary
This article introduced two types of online password attack (brute force, dictionary) and explained how to use Hydra to launch an online dictionary attack against FTP and a web form. Hydra is a network logon cracker that supports many services [1]. Metasploitable can be used to practice penetration testing skills [2]. DVWA (Damn Vulnerable Web Application) is helpful for those who want to play with web application security stuff [3].
References:
[1] Hydra
http://www.thc.org/thc-hydra/ (access date: 7 September 2013)
[2] Metasploitable
http://www.offensive-security.com/metasploit-unleashed/Metasploitable (access date: 7 September 2013)
[3] DVWA (Damn Vulnerable Web Application)
http://www.dvwa.co.uk/ (access date: 7 September 2013)
[4] Burp Suite
http://portswigger.net/burp/ (access date: 7 September 2013)

0 nhận xét:

Đăng nhận xét