Hydra is a command-line password cracking tool used in ethical hacking to test authentication security through dictionary attacks and password spraying against network services like FTP.
Hydra Password Cracking
We're going to take a look at a password cracking software called Hydra. Just a quick reminder, this is for ethical hacking purposes only.
The command that we're going to use is pretty simple. We're going to start out with hydra. Then we're going to type in -l and username, and then -p, the password, the host we're trying to get to or test, and the protocol.
Let's see what that looks like. I'm on a Kali Linux box. I also have a Debian server that's set up with an FTP server. What we're going to do is try to crack a password on the FTP server using Hydra.
So I'm going to type in hydra -l and then we will type in the username. In this case, we are going to test out password crack demo. And then the password there that we're going to try is going to be "test password." And then we'll do the IP address, which is 10.110.40. And then we're testing FTP. So we're going to hit enter on this. It's going to go and test this out, and as we'll see, it's not successful. It says zero valid passwords found. So no success there.
All right, well, we can try something else. We could try -p "test password one." As you can see, this is not only tedious, but it's really no different than logging into the server, testing things on the FTP server.
So this Hydra is more powerful than that. We can actually do more things with it. This is the command we just ran. We used the lowercase l to specify a username and a lowercase p to specify a password, but we could actually specify an uppercase P to have a password file.
So let's see what that looks like. What I'm going to do is do an ls so we can see what files we have in here. I have a password file here called rockyou.txt, or the one we're actually going to use is this word list. Let's take a look inside that word list. I'm just going to do a cat wordlist and we'll hit enter. And there you go, there's the passwords that it's testing, just some variations of these passwords.
So now let's give this a try and test things out. We're going to go back to that command that we had before, but instead of specifying a single password, we're going to do an uppercase P and then we're going to specify that word list, so wordlist.txt. We'll hit enter and see what happens with this one. As you can see, it found the password. The password to the PW crack demo is "monkey one." So now you can see that we could run through that. And if we take a look at the cat rockyou.txt, you can see it's a whole bunch of passwords. So we could just run this Hydra and test out a bunch of different passwords.
We could also do the same thing with the username. We could reference a username file — we would use a capital L — or we could do both a username file and a password file with a capital L and a capital P. So as you can see, we have several different combinations that we could run with this.
Essentially, what we're doing, if we're using a word list like we did with just that last demo there, is a type of dictionary attack. We've got a list of passwords and we're testing out that list of passwords. If we are changing the username and using the same password, that's called password spraying. And we'll get more into password spraying in another lesson.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →