Hydra can be used to attack many different services including IMAP, SMB, HTTP, VNC, MS-SQL MySQL, SMTP, SSH, and many more.
(Hydra is to online-cracking of passwords, what John The Ripper is to offline-cracking of password hashes)
Often, web-based login forms authenticate using the HTTP POST method, but judging from several blogs I have read on this subject, it sounds like some people have great difficulty in getting Hydra to work effectively in this situation.
I have had a great deal of success with hydra, so here I describe how to get Hydra working with web-based form logins.
This attack is not limited to websites, and I would argue that it is more suited for gaining login access to software products that have a web UI, for example in penetration tests.
This tool should not be used to attack websites or services where you do not have permission to do so. Use this for legitimate testing purposes only.
Some differences between online and off-line password cracking
There are significant differences between online and off-line password cracking.
With off-line cracking, you have the hashes on your system, they are static, and you can try dictionary, hybrid, and brute force attacks to you hearts content. You have as long as you want, and you can try many billions of attempts in a short space of time.
The attack success is purely dependent on password strength, verses processor-power and time (and few user-chosen passwords will be strong enough to last).
With online password attacks there are more issues to consider, such as; network bandwidth, account lockouts, tar-pitting, changing passwords, detection in logs and IDS.
Online attacks are more suited to relatively small and focused dictionary attacks rather than exhaustive brute-force.
A simple Hydra SSH example
Here is a simple example of running a Hydra attack against an SSH server.
hydra 192.168.1.26 ssh2 -s 22 -P pass.txt -L users.txt -e ns -t 10
This will attack the system 192.1.68.1.26, on port 22 with the SSH protocol, 10 threads at a time, and try all the combinations of usernames and passwords supplied in the files user.txt and pass.txt (+ empty passwords and passwords the same as the username)
This can take a while, so it is best to only use usernames you know exist, and a relatively small list of passwords (many thousands rather than many millions). This attack generally works very well for simple dictionary passwords.
Web-based login forms prerequisites
For web-based forms, you have to know much more information about the form you are attacking before you start the attack. Every web-based form is slightly different, different URLs and parameters, and different responses for success or failure.
You need to know:
- The hostname/IP and URL
- Whether it is a HTTPS or HTTP service
- Whether the form supports GET or POST (or both)
- The parameters of the request
- The difference in response between success and failure
- Whether any session cookies are required to be set or maintained
- What lockout features and thresholds are enabled (if any)
For the parameters of the request, you can intercept and examine a normal login attempt with a web proxy (such as owasp-zap, webscarab or burpsuite) or use a browser plugin (such as tamperdata) or just look at the HTML form.
An example attack
The Web Security Dojo VM has various vulnerable applications that you can use to test these techniques. So looking at an example the w3af testing framework has a test login at the following location
http://192.168.1.69/w3af/bruteforce/form_login/
The important parts of the HTML form are:
<form name="input" action="dataReceptor.php" method="post">
Username:
<input type="text" name="user">
Password:
<input type="password" name="pass">
If we put in one wrong username and password combination we get:

thank you.
ReplyDeletehey, I want to hack srbac-rs.com/administrator...can you give me a script for that...I keep getting unknown service error... username name is usrname and password name is pass..thanks
ReplyDeletethack you for your information.
ReplyDeletethanx a lot man...
ReplyDeletefucking skiddies dont need to have these capabilities
ReplyDeletevery nice Post , But can tell me if my Source page show like it :
ReplyDelete<input class="form_input ltr" id="user" type="text"
how can i do it ? its not name="user" and hydra dont put my username and password
Hmm i always seem to get false positives what ever success or fail string I enter.
ReplyDeletecan any1 telll me how to hack gmail?
ReplyDeleteI have read so many article of this site in which some of them were very
ReplyDeleteinteresting and inspiring.This article has good title with good description.i am very happy that i found this site. I have bookmarkedthis site to visit again and find out the new post.I just want to say,is a wonderful article. "custom article writing"
When there is no Username input there,only password field is there,how u configure in hydra
ReplyDelete